aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBen Elliston <bje@au.ibm.com>2004-12-03 02:01:35 +0000
committerBen Elliston <bje@gcc.gnu.org>2004-12-03 13:01:35 +1100
commit9208393247645077a2d64d0542cd43227e7ae500 (patch)
tree8fed81c7de05791be906b75aaa0d9d49894d8300 /gcc
parentdda7d95b7dea9f0df16389082e5973c96a06247d (diff)
downloadgcc-9208393247645077a2d64d0542cd43227e7ae500.zip
gcc-9208393247645077a2d64d0542cd43227e7ae500.tar.gz
gcc-9208393247645077a2d64d0542cd43227e7ae500.tar.bz2
cfg.texi (Edges): Update.
* doc/cfg.texi (Edges): Update. Document the edge_iterator data type and its methods. From-SVN: r91671
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/doc/cfg.texi69
2 files changed, 69 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3bfaa0e..ad04198 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-03 Ben Elliston <bje@au.ibm.com>
+
+ * doc/cfg.texi (Edges): Update. Document the edge_iterator data
+ type and its methods.
+
2004-12-02 Richard Henderson <rth@redhat.com>
* expr.c (write_complex_part): Use simplify_gen_subreg when the
diff --git a/gcc/doc/cfg.texi b/gcc/doc/cfg.texi
index c3529aa..e25e116 100644
--- a/gcc/doc/cfg.texi
+++ b/gcc/doc/cfg.texi
@@ -145,11 +145,70 @@ a predecessor of B, and B is a successor of A@. Edges are represented
in GCC with the @code{edge} data type. Each @code{edge} acts as a
link between two basic blocks: the @code{src} member of an edge
points to the predecessor basic block of the @code{dest} basic block.
-The members @code{pred} and @code{succ} of the @code{basic_block} data
-type point to singly linked lists of edges to the predecessors and
-successors of the block. The edges are linked via the
-@code{succ_next} and @code{pred_next} members of the @code{edge} data
-type.
+The members @code{preds} and @code{succs} of the @code{basic_block} data
+type point to type-safe vectors of edges to the predecessors and
+successors of the block.
+
+@cindex edge iterators
+When walking the edges in an edge vector, @dfn{edge iterators} should
+be used. Edge iterators are constructed using the
+@code{edge_iterator} data structure and several methods are available
+to operate on them:
+
+@ftable @code
+@item ei_start
+This function initializes an @code{edge_iterator} that points to the
+first edge in a vector of edges.
+
+@item ei_last
+This function initializes an @code{edge_iterator} that points to the
+last edge in a vector of edges.
+
+@item ei_end_p
+This predicate is @code{true} if an @code{edge_iterator} represents
+the last edge in an edge vector.
+
+@item ei_one_before_end_p
+This predicate is @code{true} if an @code{edge_iterator} represents
+the second last edge in an edge vector.
+
+@item ei_next
+This function takes a pointer to an @code{edge_iterator} and makes it
+point to the next edge in the sequence.
+
+@item ei_prev
+This function takes a pointer to an @code{edge_iterator} and makes it
+point to the previous edge in the sequence.
+
+@item ei_edge
+This function returns the @code{edge} currently pointed to by an
+@code{edge_iterator}.
+
+@item ei_safe_safe
+This function returns the @code{edge} currently pointed to by an
+@code{edge_iterator}, but returns @code{NULL} if the iterator is
+pointing at the end of the sequence. This function has been provided
+for existing code makes the assumption that a @code{NULL} edge
+indicates the end of the sequence.
+
+@end ftable
+
+The convenience macro @code{FOR_EACH_EDGE} can be used to visit all of
+the edges in a sequence of predecessor or successor edges. It must
+not be used when an element might be removed during the traversal,
+otherwise elements will be missed. Here is an example of how to use
+the macro:
+
+@smallexample
+edge e;
+edge_iterator ei;
+
+FOR_EACH_EDGE (e, ei, bb->succs)
+ @{
+ if (e->flags & EDGE_FALLTHRU)
+ break;
+ @}
+@end smallexample
@findex fall-thru
There are various reasons why control flow may transfer from one block