From f3522a84f3aedacbfa06a31d334f1b4d6738fcfc Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 26 Apr 2005 14:27:35 +0000 Subject: [PATCH] basic-block.h (ei_cond): New. * basic-block.h (ei_cond): New. (FOR_EACH_EDGE): Call ei_cond. From-SVN: r98769 --- gcc/ChangeLog | 5 +++++ gcc/basic-block.h | 25 ++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06506ed..74a7b89 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-04-26 Kazu Hirata + + * basic-block.h (ei_cond): New. + (FOR_EACH_EDGE): Call ei_cond. + 2005-04-25 Roger Sayle * sched-deps.c (sched_analyze_1): On STACK_REGS targets, x87, treat 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); -- 2.7.4