In some cases (indicated below, there could be others) you may want to
verify that a given list is backward, or is forward. One simple (necessary
and insufficient) property to check is that all CON (PRO) fields are the
same, say by deps_list_consistent_back_p(list) and
deps_list_consistent_forw_p(list). Then deps_list_consistent_p could also
check if deps_list_consistent_back_p || deps_list_consistent_forw_p.
+/* Add a dependency described by DEP to the list L.
+ L should be either INSN_BACK_DEPS or INSN_RESOLVED_BACK_DEPS. */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+void
+add_back_dep_to_deps_list (deps_list_t l, dep_t dep_from)
+{
+ dep_node_t n = (dep_node_t) obstack_alloc (dn_obstack,
+ sizeof (*n));
+ dep_t dep_to = DEP_NODE_DEP (n);
+ dep_link_t back = DEP_NODE_BACK (n);
+ dep_link_t forw = DEP_NODE_FORW (n);
+
gcc_assert (deps_list_consistent_back_p (l)); ??
You may find it useful to also provide FOR_EACH_PRO(PRO, LINK, CON) and
FOR_EACH_CON(PRO, LINK, CON) macros, e.g. something like
+#define FOR_EACH_PRO(PRO, LINK, CON) \
+ for (LINK = DEPS_LIST_FIRST (INSN_BACK_DEPS (CON)), \
+ PRO = (LINK? DEP_LINK_PRO (LINK) : NULL); \
+ LINK != NULL; \
+ LINK = DEP_LINK_NEXT (LINK), \
+ PRO = (LINK? DEP_LINK_PRO (LINK) : NULL))
or so, to make sure people take PRO when traversing (RESOLVED?)_BACK_DEPS,
and CON when traversing FORW_DEPS.
+ /* Pointer to the next field of the previous link in the list.
+ For the first link this points to the deps_list->first and for the
last
+ one it is NULL.
^^^^^^^^^^^^^^^^^^^^^^^?
Only need to comment regarding first link; for the last link (if it is not
also first) also points to next field of the previous link in the list. You
may want to comment that the next field of the last link is NULL, as
probably intended.