basic-block.h (ei_cond): New.
authorKazu Hirata <kazu@cs.umass.edu>
Tue, 26 Apr 2005 14:27:35 +0000 (14:27 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Tue, 26 Apr 2005 14:27:35 +0000 (14:27 +0000)
* basic-block.h (ei_cond): New.
(FOR_EACH_EDGE): Call ei_cond.

From-SVN: r98769

gcc/ChangeLog
gcc/basic-block.h

index 06506ed..74a7b89 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-26  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * basic-block.h (ei_cond): New.
+       (FOR_EACH_EDGE): Call ei_cond.
+
 2005-04-25  Roger Sayle  <roger@eyesopen.com>
 
        * sched-deps.c (sched_analyze_1): On STACK_REGS targets, x87, treat
index 6f29513..baca9d7 100644 (file)
@@ -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);