summaryrefslogtreecommitdiff
path: root/gcc/cfgloop.h
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-19 15:19:09 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-19 15:19:09 +0000
commitf21d4d003ea9d2064d33c74fca8a96d16d987a51 (patch)
tree34623898ed17a6ada892874aaaea06c9394a310a /gcc/cfgloop.h
parent8011b3ea7f5f8babca8a61f38c04eb3bb0e2d5e8 (diff)
downloadgcc-f21d4d003ea9d2064d33c74fca8a96d16d987a51.tar.gz
2013-11-19 Richard Biener <rguenther@suse.de>
* cfgloop.h (struct loop_iterator): C++-ify, add constructor and destructor and make fel_next a member function. (fel_next): Transform into ... (loop_iterator::next): ... this. (fel_init): Transform into ... (loop_iterator::loop_iterator): ... this. (loop_iterator::~loop_iterator): New. (FOR_EACH_LOOP): Remove loop-iterator argument. (FOR_EACH_LOOP_BREAK): Remove no longer necessary macro. * cfgloop.c, cfgloopmanip.c, config/mn10300/mn10300.c, graphite-clast-to-gimple.c, graphite-scop-detection.c, graphite-sese-to-poly.c, ipa-inline-analysis.c, ipa-pure-const.c, loop-init.c, loop-invariant.c, loop-unroll.c, loop-unswitch.c, modulo-sched.c, predict.c, sel-sched-ir.c, tree-cfg.c, tree-data-ref.c, tree-if-conv.c, tree-loop-distribution.c, tree-parloops.c, tree-predcom.c, tree-scalar-evolution.c, tree-ssa-dce.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-manip.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vrp.c: Adjust uses of FOR_EACH_LOOP and remove loop_iterator variables. Replace FOR_EACH_LOOP_BREAK with break. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205032 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloop.h')
-rw-r--r--gcc/cfgloop.h62
1 files changed, 33 insertions, 29 deletions
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 87086d49022..68285a6d1b8 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -542,48 +542,52 @@ enum li_flags
/* The iterator for loops. */
-typedef struct
+struct loop_iterator
{
+ loop_iterator (loop_p *loop, unsigned flags);
+ ~loop_iterator ();
+
+ inline loop_p next ();
+
/* The list of loops to visit. */
vec<int> to_visit;
/* The index of the actual loop. */
unsigned idx;
-} loop_iterator;
+};
-static inline void
-fel_next (loop_iterator *li, loop_p *loop)
+inline loop_p
+loop_iterator::next ()
{
int anum;
- while (li->to_visit.iterate (li->idx, &anum))
+ while (this->to_visit.iterate (this->idx, &anum))
{
- li->idx++;
- *loop = get_loop (cfun, anum);
- if (*loop)
- return;
+ this->idx++;
+ loop_p loop = get_loop (cfun, anum);
+ if (loop)
+ return loop;
}
- li->to_visit.release ();
- *loop = NULL;
+ return NULL;
}
-static inline void
-fel_init (loop_iterator *li, loop_p *loop, unsigned flags)
+inline
+loop_iterator::loop_iterator (loop_p *loop, unsigned flags)
{
struct loop *aloop;
unsigned i;
int mn;
- li->idx = 0;
+ this->idx = 0;
if (!current_loops)
{
- li->to_visit.create (0);
+ this->to_visit.create (0);
*loop = NULL;
return;
}
- li->to_visit.create (number_of_loops (cfun));
+ this->to_visit.create (number_of_loops (cfun));
mn = (flags & LI_INCLUDE_ROOT) ? 0 : 1;
if (flags & LI_ONLY_INNERMOST)
@@ -592,7 +596,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags)
if (aloop != NULL
&& aloop->inner == NULL
&& aloop->num >= mn)
- li->to_visit.quick_push (aloop->num);
+ this->to_visit.quick_push (aloop->num);
}
else if (flags & LI_FROM_INNERMOST)
{
@@ -605,7 +609,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags)
while (1)
{
if (aloop->num >= mn)
- li->to_visit.quick_push (aloop->num);
+ this->to_visit.quick_push (aloop->num);
if (aloop->next)
{
@@ -627,7 +631,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags)
while (1)
{
if (aloop->num >= mn)
- li->to_visit.quick_push (aloop->num);
+ this->to_visit.quick_push (aloop->num);
if (aloop->inner != NULL)
aloop = aloop->inner;
@@ -642,19 +646,19 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags)
}
}
- fel_next (li, loop);
+ *loop = this->next ();
}
-#define FOR_EACH_LOOP(LI, LOOP, FLAGS) \
- for (fel_init (&(LI), &(LOOP), FLAGS); \
- (LOOP); \
- fel_next (&(LI), &(LOOP)))
+inline
+loop_iterator::~loop_iterator ()
+{
+ this->to_visit.release ();
+}
-#define FOR_EACH_LOOP_BREAK(LI) \
- { \
- (LI).to_visit.release (); \
- break; \
- }
+#define FOR_EACH_LOOP(LOOP, FLAGS) \
+ for (loop_iterator li(&(LOOP), FLAGS); \
+ (LOOP); \
+ (LOOP) = li.next ())
/* The properties of the target. */
struct target_cfgloop {