aboutsummaryrefslogtreecommitdiff
path: root/gcc/basic-block.h
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2005-04-26 14:27:35 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2005-04-26 14:27:35 +0000
commitf3522a84f3aedacbfa06a31d334f1b4d6738fcfc (patch)
treed84d375ad74f53f9af91c2ba68d00078af10d7f6 /gcc/basic-block.h
parent44ecf603649098d1d89bd855155a215507bf9e86 (diff)
downloadgcc-f3522a84f3aedacbfa06a31d334f1b4d6738fcfc.zip
gcc-f3522a84f3aedacbfa06a31d334f1b4d6738fcfc.tar.gz
gcc-f3522a84f3aedacbfa06a31d334f1b4d6738fcfc.tar.bz2
basic-block.h (ei_cond): New.
* basic-block.h (ei_cond): New. (FOR_EACH_EDGE): Call ei_cond. From-SVN: r98769
Diffstat (limited to 'gcc/basic-block.h')
-rw-r--r--gcc/basic-block.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 6f29513..baca9d7 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -736,6 +736,25 @@ ei_safe_edge (edge_iterator i)
return !ei_end_p (i) ? ei_edge (i) : NULL;
}
+/* Return 1 if we should continue to iterate. Return 0 otherwise.
+ *Edge P is set to the next edge if we are to continue to iterate
+ and NULL otherwise. */
+
+static inline bool
+ei_cond (edge_iterator ei, edge *p)
+{
+ if (!ei_end_p (ei))
+ {
+ *p = ei_edge (ei);
+ return 1;
+ }
+ else
+ {
+ *p = NULL;
+ return 0;
+ }
+}
+
/* This macro serves as a convenient way to iterate each edge in a
vector of predecessor or successor edges. It must not be used when
an element might be removed during the traversal, otherwise
@@ -751,9 +770,9 @@ ei_safe_edge (edge_iterator i)
}
*/
-#define FOR_EACH_EDGE(EDGE,ITER,EDGE_VEC) \
- for ((EDGE) = NULL, (ITER) = ei_start ((EDGE_VEC)); \
- ((EDGE) = ei_safe_edge ((ITER))); \
+#define FOR_EACH_EDGE(EDGE,ITER,EDGE_VEC) \
+ for ((ITER) = ei_start ((EDGE_VEC)); \
+ ei_cond ((ITER), &(EDGE)); \
ei_next (&(ITER)))
struct edge_list * create_edge_list (void);