summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-20 12:48:59 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-20 12:48:59 +0000
commit48148244971e4e4bcc2fb879e007afb23db72052 (patch)
tree7983da0de4d80a3a7b43caa30ccd5dc36d8bf25e
parente83c4d0fa5687f2bb35f7b748a2039f5cc39f0db (diff)
downloadgcc-48148244971e4e4bcc2fb879e007afb23db72052.tar.gz
gcc/
* vec.h (FOR_EACH_VEC_ELT): Define. * c-decl.c: Use it. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/bfin/bfin.c: Likewise. * config/mips/mips.c: Likewise. * config/rs6000/rs6000.c: Likewise. * dbxout.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * dse.c: Likewise. * dwarf2out.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * ggc-common.c: Likewise. * gimplify.c: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * ipa-prop.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * lambda-code.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-opts.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-symtab.c: Likewise. * matrix-reorg.c: Likewise. * opts.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-data-ref.c: Likewise. * tree-emutls.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * vmsdbgout.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Use FOR_EACH_VEC_ELT. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. gcc/c-family/ * c-common.c: Use FOR_EACH_VEC_ELT. * c-gimplify.c: Likewise. * c-pragma.c: Likewise. gcc/cp/ * call.c: Use FOR_EACH_VEC_ELT. * class.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * error.c: Likewise. * except.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * repo.c: Likewise. * semantics.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * trans-openmp.c: Use FOR_EACH_VEC_ELT. gcc/java/ * class.c: Use FOR_EACH_VEC_ELT. * expr.c: Likewise. * jcf-parse.c: Likewise. * resource.c: Likewise. gcc/lto/ * lto.c: Use FOR_EACH_VEC_ELT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163401 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog102
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/gcc-interface/decl.c2
-rw-r--r--gcc/ada/gcc-interface/trans.c4
-rw-r--r--gcc/ada/gcc-interface/utils.c4
-rw-r--r--gcc/c-decl.c30
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-common.c2
-rw-r--r--gcc/c-family/c-gimplify.c2
-rw-r--r--gcc/c-family/c-pragma.c16
-rw-r--r--gcc/cfgloop.c18
-rw-r--r--gcc/cfgloopmanip.c6
-rw-r--r--gcc/cgraph.c4
-rw-r--r--gcc/cgraphunit.c2
-rw-r--r--gcc/combine.c2
-rw-r--r--gcc/config/bfin/bfin.c12
-rw-r--r--gcc/config/mips/mips.c4
-rw-r--r--gcc/config/rs6000/rs6000.c4
-rw-r--r--gcc/cp/ChangeLog17
-rw-r--r--gcc/cp/call.c6
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/decl.c21
-rw-r--r--gcc/cp/decl2.c10
-rw-r--r--gcc/cp/error.c2
-rw-r--r--gcc/cp/except.c4
-rw-r--r--gcc/cp/mangle.c4
-rw-r--r--gcc/cp/method.c2
-rw-r--r--gcc/cp/name-lookup.c20
-rw-r--r--gcc/cp/parser.c34
-rw-r--r--gcc/cp/pt.c21
-rw-r--r--gcc/cp/repo.c4
-rw-r--r--gcc/cp/semantics.c18
-rw-r--r--gcc/cp/typeck2.c4
-rw-r--r--gcc/dbxout.c2
-rw-r--r--gcc/df-scan.c20
-rw-r--r--gcc/dominance.c10
-rw-r--r--gcc/dse.c14
-rw-r--r--gcc/dwarf2out.c68
-rw-r--r--gcc/except.c2
-rw-r--r--gcc/expr.c4
-rw-r--r--gcc/fortran/ChangeLog4
-rw-r--r--gcc/fortran/trans-openmp.c2
-rw-r--r--gcc/function.c6
-rw-r--r--gcc/gcse.c10
-rw-r--r--gcc/genattr.c4
-rw-r--r--gcc/ggc-common.c4
-rw-r--r--gcc/gimplify.c15
-rw-r--r--gcc/graphite-blocking.c4
-rw-r--r--gcc/graphite-clast-to-gimple.c2
-rw-r--r--gcc/graphite-dependences.c46
-rw-r--r--gcc/graphite-interchange.c10
-rw-r--r--gcc/graphite-poly.c40
-rw-r--r--gcc/graphite-scop-detection.c30
-rw-r--r--gcc/graphite-sese-to-poly.c56
-rw-r--r--gcc/graphite.c10
-rw-r--r--gcc/haifa-sched.c10
-rw-r--r--gcc/ifcvt.c4
-rw-r--r--gcc/implicit-zee.c12
-rw-r--r--gcc/ipa-prop.c8
-rw-r--r--gcc/ipa-struct-reorg.c52
-rw-r--r--gcc/ipa.c2
-rw-r--r--gcc/ira-build.c16
-rw-r--r--gcc/ira-color.c2
-rw-r--r--gcc/ira-emit.c2
-rw-r--r--gcc/java/ChangeLog7
-rw-r--r--gcc/java/class.c12
-rw-r--r--gcc/java/expr.c2
-rw-r--r--gcc/java/jcf-parse.c6
-rw-r--r--gcc/java/resource.c2
-rw-r--r--gcc/lambda-code.c14
-rw-r--r--gcc/loop-invariant.c10
-rw-r--r--gcc/loop-unroll.c16
-rw-r--r--gcc/lower-subreg.c2
-rw-r--r--gcc/lto-cgraph.c6
-rw-r--r--gcc/lto-opts.c6
-rw-r--r--gcc/lto-streamer-in.c4
-rw-r--r--gcc/lto-streamer-out.c24
-rw-r--r--gcc/lto-streamer.c2
-rw-r--r--gcc/lto-symtab.c2
-rw-r--r--gcc/lto/ChangeLog4
-rw-r--r--gcc/lto/lto.c6
-rw-r--r--gcc/matrix-reorg.c4
-rw-r--r--gcc/opts.c22
-rw-r--r--gcc/predict.c2
-rw-r--r--gcc/print-tree.c2
-rw-r--r--gcc/sdbout.c2
-rw-r--r--gcc/sel-sched-dump.c2
-rw-r--r--gcc/sel-sched-ir.c4
-rw-r--r--gcc/sel-sched.c16
-rw-r--r--gcc/sese.c2
-rw-r--r--gcc/stor-layout.c2
-rw-r--r--gcc/tree-cfg.c10
-rw-r--r--gcc/tree-cfgcleanup.c2
-rw-r--r--gcc/tree-chrec.c2
-rw-r--r--gcc/tree-data-ref.c66
-rw-r--r--gcc/tree-emutls.c4
-rw-r--r--gcc/tree-inline.c2
-rw-r--r--gcc/tree-into-ssa.c2
-rw-r--r--gcc/tree-loop-distribution.c28
-rw-r--r--gcc/tree-loop-linear.c6
-rw-r--r--gcc/tree-mudflap.c2
-rw-r--r--gcc/tree-outof-ssa.c4
-rw-r--r--gcc/tree-parloops.c6
-rw-r--r--gcc/tree-predcom.c62
-rw-r--r--gcc/tree-pretty-print.c2
-rw-r--r--gcc/tree-scalar-evolution.c4
-rw-r--r--gcc/tree-ssa-live.c2
-rw-r--r--gcc/tree-ssa-loop-im.c22
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c2
-rw-r--r--gcc/tree-ssa-loop-ivopts.c2
-rw-r--r--gcc/tree-ssa-loop-manip.c2
-rw-r--r--gcc/tree-ssa-loop-niter.c8
-rw-r--r--gcc/tree-ssa-loop-prefetch.c10
-rw-r--r--gcc/tree-ssa-phiprop.c2
-rw-r--r--gcc/tree-ssa-pre.c20
-rw-r--r--gcc/tree-ssa-reassoc.c12
-rw-r--r--gcc/tree-ssa-sccvn.c18
-rw-r--r--gcc/tree-ssa-structalias.c78
-rw-r--r--gcc/tree-ssa.c2
-rw-r--r--gcc/tree-vect-data-refs.c32
-rw-r--r--gcc/tree-vect-loop-manip.c6
-rw-r--r--gcc/tree-vect-loop.c16
-rw-r--r--gcc/tree-vect-patterns.c4
-rw-r--r--gcc/tree-vect-slp.c65
-rw-r--r--gcc/tree-vect-stmts.c8
-rw-r--r--gcc/tree-vrp.c6
-rw-r--r--gcc/tree.c22
-rw-r--r--gcc/value-prof.c2
-rw-r--r--gcc/var-tracking.c8
-rw-r--r--gcc/varasm.c8
-rw-r--r--gcc/vec.h5
-rw-r--r--gcc/vmsdbgout.c4
132 files changed, 829 insertions, 790 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 11a82db620b..c525cad4719 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,105 @@
+2010-08-20 Nathan Froyd <froydnj@codesourcery.com>
+
+ * vec.h (FOR_EACH_VEC_ELT): Define.
+ * c-decl.c: Use it.
+ * cfgloop.c: Likewise.
+ * cfgloopmanip.c: Likewise.
+ * cgraph.c: Likewise.
+ * cgraphunit.c: Likewise.
+ * combine.c: Likewise.
+ * config/bfin/bfin.c: Likewise.
+ * config/mips/mips.c: Likewise.
+ * config/rs6000/rs6000.c: Likewise.
+ * dbxout.c: Likewise.
+ * df-scan.c: Likewise.
+ * dominance.c: Likewise.
+ * dse.c: Likewise.
+ * dwarf2out.c: Likewise.
+ * except.c: Likewise.
+ * expr.c: Likewise.
+ * function.c: Likewise.
+ * gcse.c: Likewise.
+ * genattr.c: Likewise.
+ * ggc-common.c: Likewise.
+ * gimplify.c: Likewise.
+ * graphite-blocking.c: Likewise.
+ * graphite-clast-to-gimple.c: Likewise.
+ * graphite-dependences.c: Likewise.
+ * graphite-interchange.c: Likewise.
+ * graphite-poly.c: Likewise.
+ * graphite-scop-detection.c: Likewise.
+ * graphite-sese-to-poly.c: Likewise.
+ * graphite.c: Likewise.
+ * haifa-sched.c: Likewise.
+ * ifcvt.c: Likewise.
+ * implicit-zee.c: Likewise.
+ * ipa-prop.c: Likewise.
+ * ipa-struct-reorg.c: Likewise.
+ * ipa.c: Likewise.
+ * ira-build.c: Likewise.
+ * ira-color.c: Likewise.
+ * ira-emit.c: Likewise.
+ * lambda-code.c: Likewise.
+ * loop-invariant.c: Likewise.
+ * loop-unroll.c: Likewise.
+ * lower-subreg.c: Likewise.
+ * lto-cgraph.c: Likewise.
+ * lto-opts.c: Likewise.
+ * lto-streamer-in.c: Likewise.
+ * lto-streamer-out.c: Likewise.
+ * lto-streamer.c: Likewise.
+ * lto-symtab.c: Likewise.
+ * matrix-reorg.c: Likewise.
+ * opts.c: Likewise.
+ * predict.c: Likewise.
+ * print-tree.c: Likewise.
+ * sdbout.c: Likewise.
+ * sel-sched-dump.c: Likewise.
+ * sel-sched-ir.c: Likewise.
+ * sel-sched.c: Likewise.
+ * sese.c: Likewise.
+ * stor-layout.c: Likewise.
+ * tree-cfg.c: Likewise.
+ * tree-cfgcleanup.c: Likewise.
+ * tree-chrec.c: Likewise.
+ * tree-data-ref.c: Likewise.
+ * tree-emutls.c: Likewise.
+ * tree-inline.c: Likewise.
+ * tree-into-ssa.c: Likewise.
+ * tree-loop-distribution.c: Likewise.
+ * tree-loop-linear.c: Likewise.
+ * tree-mudflap.c: Likewise.
+ * tree-outof-ssa.c: Likewise.
+ * tree-parloops.c: Likewise.
+ * tree-predcom.c: Likewise.
+ * tree-pretty-print.c: Likewise.
+ * tree-scalar-evolution.c: Likewise.
+ * tree-ssa-live.c: Likewise.
+ * tree-ssa-loop-im.c: Likewise.
+ * tree-ssa-loop-ivcanon.c: Likewise.
+ * tree-ssa-loop-ivopts.c: Likewise.
+ * tree-ssa-loop-manip.c: Likewise.
+ * tree-ssa-loop-niter.c: Likewise.
+ * tree-ssa-loop-prefetch.c: Likewise.
+ * tree-ssa-phiprop.c: Likewise.
+ * tree-ssa-pre.c: Likewise.
+ * tree-ssa-reassoc.c: Likewise.
+ * tree-ssa-sccvn.c: Likewise.
+ * tree-ssa-structalias.c: Likewise.
+ * tree-ssa.c: Likewise.
+ * tree-vect-data-refs.c: Likewise.
+ * tree-vect-loop-manip.c: Likewise.
+ * tree-vect-loop.c: Likewise.
+ * tree-vect-patterns.c: Likewise.
+ * tree-vect-slp.c: Likewise.
+ * tree-vect-stmts.c: Likewise.
+ * tree-vrp.c: Likewise.
+ * tree.c: Likewise.
+ * value-prof.c: Likewise.
+ * var-tracking.c: Likewise.
+ * varasm.c: Likewise.
+ * vmsdbgout.c: Likewise.
+
2010-08-20 Joseph Myers <joseph@codesourcery.com>
* doc/tm.texi.in (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED): Document to
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 41a91f2033e..ad734d1e61a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-20 Nathan Froyd <froydnj@codesourcery.com>
+
+ * gcc-interface/decl.c: Use FOR_EACH_VEC_ELT.
+ * gcc-interface/trans.c: Likewise.
+ * gcc-interface/utils.c: Likewise.
+
2010-08-18 Eric Botcazou <ebotcazou@adacore.com>
* tracebak.c (i386): Use GCC unwinder on Linux with GCC > 4.5.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 88d57167bf2..2e68eaadf26 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -4966,7 +4966,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
unsigned int i;
tree t;
- for (i = 0; VEC_iterate (tree, defer_finalize_list, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, defer_finalize_list, i, t)
rest_of_type_decl_compilation_no_defer (t);
VEC_free (tree, heap, defer_finalize_list);
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 5abc5624551..d32639aeee5 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -1603,7 +1603,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
and the dimension in the cache and create a new one on failure. */
if (!optimize && Present (gnat_param))
{
- for (i = 0; VEC_iterate (parm_attr, f_parm_attr_cache, i, pa); i++)
+ FOR_EACH_VEC_ELT (parm_attr, f_parm_attr_cache, i, pa)
if (pa->id == gnat_param && pa->dim == Dimension)
break;
@@ -2521,7 +2521,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
start_stmt_group ();
- for (i = 0; VEC_iterate (parm_attr, cache, i, pa); i++)
+ FOR_EACH_VEC_ELT (parm_attr, cache, i, pa)
{
if (pa->first)
add_stmt_with_node (pa->first, gnat_node);
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index e1f4bbc18e5..cef72322e1b 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -1690,7 +1690,7 @@ invalidate_global_renaming_pointers (void)
unsigned int i;
tree iter;
- for (i = 0; VEC_iterate(tree, global_renaming_pointers, i, iter); i++)
+ FOR_EACH_VEC_ELT (tree, global_renaming_pointers, i, iter)
SET_DECL_RENAMED_OBJECT (iter, NULL_TREE);
VEC_free (tree, gc, global_renaming_pointers);
@@ -4661,7 +4661,7 @@ builtin_decl_for (tree name)
unsigned i;
tree decl;
- for (i = 0; VEC_iterate(tree, builtin_decls, i, decl); i++)
+ FOR_EACH_VEC_ELT (tree, builtin_decls, i, decl)
if (DECL_NAME (decl) == name)
return decl;
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 5606df82ec5..10600c80074 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -999,9 +999,7 @@ update_label_decls (struct c_scope *scope)
/* Update the bindings of any goto statements associated
with this label. */
- for (ix = 0;
- VEC_iterate (c_goto_bindings_p, label_vars->gotos, ix, g);
- ++ix)
+ FOR_EACH_VEC_ELT (c_goto_bindings_p, label_vars->gotos, ix, g)
update_spot_bindings (scope, &g->goto_bindings);
}
}
@@ -1352,9 +1350,7 @@ c_bindings_start_stmt_expr (struct c_spot_bindings* switch_bindings)
continue;
label_vars = b->u.label;
++label_vars->label_bindings.stmt_exprs;
- for (ix = 0;
- VEC_iterate (c_goto_bindings_p, label_vars->gotos, ix, g);
- ++ix)
+ FOR_EACH_VEC_ELT (c_goto_bindings_p, label_vars->gotos, ix, g)
++g->goto_bindings.stmt_exprs;
}
}
@@ -1392,9 +1388,7 @@ c_bindings_end_stmt_expr (struct c_spot_bindings *switch_bindings)
label_vars->label_bindings.left_stmt_expr = true;
label_vars->label_bindings.stmt_exprs = 0;
}
- for (ix = 0;
- VEC_iterate (c_goto_bindings_p, label_vars->gotos, ix, g);
- ++ix)
+ FOR_EACH_VEC_ELT (c_goto_bindings_p, label_vars->gotos, ix, g)
{
--g->goto_bindings.stmt_exprs;
if (g->goto_bindings.stmt_exprs < 0)
@@ -3120,7 +3114,7 @@ lookup_label_for_goto (location_t loc, tree name)
...
goto lab;
Issue a warning or error. */
- for (ix = 0; VEC_iterate (tree, label_vars->decls_in_scope, ix, decl); ++ix)
+ FOR_EACH_VEC_ELT (tree, label_vars->decls_in_scope, ix, decl)
warn_about_goto (loc, label, decl);
if (label_vars->label_bindings.left_stmt_expr)
@@ -3172,9 +3166,7 @@ check_earlier_gotos (tree label, struct c_label_vars* label_vars)
unsigned int ix;
struct c_goto_bindings *g;
- for (ix = 0;
- VEC_iterate (c_goto_bindings_p, label_vars->gotos, ix, g);
- ++ix)
+ FOR_EACH_VEC_ELT (c_goto_bindings_p, label_vars->gotos, ix, g)
{
struct c_binding *b;
struct c_scope *scope;
@@ -6788,7 +6780,7 @@ warn_cxx_compat_finish_struct (tree fieldlist)
because the flag is used to issue visibility warnings, and we
only want to issue those warnings if the type is referenced
outside of the struct declaration. */
- for (ix = 0; VEC_iterate (tree, struct_parse_info->struct_types, ix, x); ++ix)
+ FOR_EACH_VEC_ELT (tree, struct_parse_info->struct_types, ix, x)
C_TYPE_DEFINED_IN_STRUCT (x) = 1;
/* The TYPEDEFS_SEEN field of STRUCT_PARSE_INFO is a list of
@@ -6804,9 +6796,7 @@ warn_cxx_compat_finish_struct (tree fieldlist)
a pointer_set because identifiers are interned. */
struct pointer_set_t *tset = pointer_set_create ();
- for (ix = 0;
- VEC_iterate (tree, struct_parse_info->typedefs_seen, ix, x);
- ++ix)
+ FOR_EACH_VEC_ELT (tree, struct_parse_info->typedefs_seen, ix, x)
pointer_set_insert (tset, DECL_NAME (x));
for (x = fieldlist; x != NULL_TREE; x = DECL_CHAIN (x))
@@ -6827,9 +6817,7 @@ warn_cxx_compat_finish_struct (tree fieldlist)
/* For each field which has a binding and which was not defined in
an enclosing struct, clear the in_struct field. */
- for (ix = 0;
- VEC_iterate (c_binding_ptr, struct_parse_info->fields, ix, b);
- ++ix)
+ FOR_EACH_VEC_ELT (c_binding_ptr, struct_parse_info->fields, ix, b)
b->in_struct = 0;
}
@@ -8090,7 +8078,7 @@ store_parm_decls (void)
tree t;
int i;
- for (i = 0; VEC_iterate (tree, pending_sizes, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, pending_sizes, i, t)
add_stmt (t);
}
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index b88684a62b8..072aad4d4ca 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-20 Nathan Froyd <froydnj@codesourcery.com>
+
+ * c-common.c: Use FOR_EACH_VEC_ELT.
+ * c-gimplify.c: Likewise.
+ * c-pragma.c: Likewise.
+
2010-08-16 Joseph Myers <joseph@codesourcery.com>
* c.opt (MDX): Change back to MD. Mark NoDriverArg instead of
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index e2a0561c7c6..e2c5d28d08e 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -9300,7 +9300,7 @@ make_tree_vector_copy (const VEC(tree,gc) *orig)
ret = make_tree_vector ();
VEC_reserve (tree, gc, ret, VEC_length (tree, orig));
- for (ix = 0; VEC_iterate (tree, orig, ix, t); ++ix)
+ FOR_EACH_VEC_ELT (tree, orig, ix, t)
VEC_quick_push (tree, ret, t);
return ret;
}
diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c
index f446ebbb214..f8a2ab4bce2 100644
--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -112,7 +112,7 @@ add_block_to_enclosing (tree block)
gimple bind;
VEC(gimple, heap) *stack = gimple_bind_expr_stack ();
- for (i = 0; VEC_iterate (gimple, stack, i, bind); i++)
+ FOR_EACH_VEC_ELT (gimple, stack, i, bind)
if (gimple_bind_block (bind))
break;
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index 81e42be597b..6aaa2f7535f 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -306,7 +306,7 @@ maybe_apply_pragma_weak (tree decl)
id = DECL_ASSEMBLER_NAME (decl);
- for (i = 0; VEC_iterate (pending_weak, pending_weaks, i, pe); i++)
+ FOR_EACH_VEC_ELT (pending_weak, pending_weaks, i, pe)
if (id == pe->name)
{
apply_pragma_weak (decl, pe->value);
@@ -324,7 +324,7 @@ maybe_apply_pending_pragma_weaks (void)
int i;
pending_weak *pe;
- for (i = 0; VEC_iterate (pending_weak, pending_weaks, i, pe); i++)
+ FOR_EACH_VEC_ELT (pending_weak, pending_weaks, i, pe)
{
alias_id = pe->name;
id = pe->value;
@@ -486,9 +486,7 @@ add_to_renaming_pragma_list (tree oldname, tree newname)
unsigned ix;
pending_redefinition *p;
- for (ix = 0;
- VEC_iterate (pending_redefinition, pending_redefine_extname, ix, p);
- ix++)
+ FOR_EACH_VEC_ELT (pending_redefinition, pending_redefine_extname, ix, p)
if (oldname == p->oldname)
{
if (p->newname != newname)
@@ -553,9 +551,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname)
"conflict with previous rename");
/* Take any pending redefine_extname off the list. */
- for (ix = 0;
- VEC_iterate (pending_redefinition, pending_redefine_extname, ix, p);
- ix++)
+ FOR_EACH_VEC_ELT (pending_redefinition, pending_redefine_extname, ix, p)
if (DECL_NAME (decl) == p->oldname)
{
/* Only warn if there is a conflict. */
@@ -571,9 +567,7 @@ maybe_apply_renaming_pragma (tree decl, tree asmname)
}
/* Find out if we have a pending #pragma redefine_extname. */
- for (ix = 0;
- VEC_iterate (pending_redefinition, pending_redefine_extname, ix, p);
- ix++)
+ FOR_EACH_VEC_ELT (pending_redefinition, pending_redefine_extname, ix, p)
if (DECL_NAME (decl) == p->oldname)
{
tree newname = p->newname;
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 516a72eb941..c242756e848 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -130,7 +130,7 @@ flow_loop_dump (const struct loop *loop, FILE *file,
{
fprintf (file, "multiple latches:");
latches = get_loop_latch_edges (loop);
- for (i = 0; VEC_iterate (edge, latches, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, latches, i, e)
fprintf (file, " %d", e->src->index);
VEC_free (edge, heap, latches);
fprintf (file, "\n");
@@ -209,7 +209,7 @@ flow_loops_free (struct loops *loops)
loop_p loop;
/* Free the loop descriptors. */
- for (i = 0; VEC_iterate (loop_p, loops->larray, i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, loops->larray, i, loop)
{
if (!loop)
continue;
@@ -286,7 +286,7 @@ establish_preds (struct loop *loop, struct loop *father)
VEC_truncate (loop_p, loop->superloops, 0);
VEC_reserve (loop_p, gc, loop->superloops, depth);
- for (i = 0; VEC_iterate (loop_p, father->superloops, i, ploop); i++)
+ FOR_EACH_VEC_ELT (loop_p, father->superloops, i, ploop)
VEC_quick_push (loop_p, loop->superloops, ploop);
VEC_quick_push (loop_p, loop->superloops, father);
@@ -530,7 +530,7 @@ find_subloop_latch_edge_by_profile (VEC (edge, heap) *latches)
edge e, me = NULL;
gcov_type mcount = 0, tcount = 0;
- for (i = 0; VEC_iterate (edge, latches, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, latches, i, e)
{
if (e->count > mcount)
{
@@ -579,7 +579,7 @@ find_subloop_latch_edge_by_ivs (struct loop *loop ATTRIBUTE_UNUSED, VEC (edge, h
latch = e;
/* Verify that it dominates all the latch edges. */
- for (i = 0; VEC_iterate (edge, latches, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, latches, i, e)
if (!dominated_by_p (CDI_DOMINATORS, e->src, latch->src))
return NULL;
@@ -598,7 +598,7 @@ find_subloop_latch_edge_by_ivs (struct loop *loop ATTRIBUTE_UNUSED, VEC (edge, h
if (!bb || !flow_bb_inside_loop_p (loop, bb))
continue;
- for (i = 0; VEC_iterate (edge, latches, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, latches, i, e)
if (e != latch
&& PHI_ARG_DEF_FROM_EDGE (phi, e) == lop)
return NULL;
@@ -696,7 +696,7 @@ merge_latch_edges (struct loop *loop)
fprintf (dump_file, "Merged latch edges of loop %d\n", loop->num);
mfb_reis_set = pointer_set_create ();
- for (i = 0; VEC_iterate (edge, latches, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, latches, i, e)
pointer_set_insert (mfb_reis_set, e);
latch = make_forwarder_block (loop->header, mfb_redirect_edges_in_set,
NULL);
@@ -1192,7 +1192,7 @@ add_bb_to_loop (basic_block bb, struct loop *loop)
bb->loop_father = loop;
bb->loop_depth = loop_depth (loop);
loop->num_nodes++;
- for (i = 0; VEC_iterate (loop_p, loop->superloops, i, ploop); i++)
+ FOR_EACH_VEC_ELT (loop_p, loop->superloops, i, ploop)
ploop->num_nodes++;
FOR_EACH_EDGE (e, ei, bb->succs)
@@ -1217,7 +1217,7 @@ remove_bb_from_loops (basic_block bb)
gcc_assert (loop != NULL);
loop->num_nodes--;
- for (i = 0; VEC_iterate (loop_p, loop->superloops, i, ploop); i++)
+ FOR_EACH_VEC_ELT (loop_p, loop->superloops, i, ploop)
ploop->num_nodes--;
bb->loop_father = NULL;
bb->loop_depth = 0;
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 69ed980fa20..4363cc51f64 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -130,7 +130,7 @@ fix_loop_placement (struct loop *loop)
struct loop *father = current_loops->tree_root, *act;
bool ret = false;
- for (i = 0; VEC_iterate (edge, exits, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, e)
{
act = find_common_loop (loop, e->dest->loop_father);
if (flow_loop_nested_p (father, act))
@@ -146,7 +146,7 @@ fix_loop_placement (struct loop *loop)
/* The exit edges of LOOP no longer exits its original immediate
superloops; remove them from the appropriate exit lists. */
- for (i = 0; VEC_iterate (edge, exits, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, e)
rescan_loop_exit (e, false, false);
ret = true;
@@ -1271,7 +1271,7 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e,
bb->aux = 0;
dom_bbs = get_dominated_by (CDI_DOMINATORS, bb);
- for (j = 0; VEC_iterate (basic_block, dom_bbs, j, dominated); j++)
+ FOR_EACH_VEC_ELT (basic_block, dom_bbs, j, dominated)
{
if (flow_bb_inside_loop_p (loop, dominated))
continue;
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 63fed497b47..32ad190135b 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -2149,7 +2149,7 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq,
n->count = 0;
}
- for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++)
+ FOR_EACH_VEC_ELT (cgraph_edge_p, redirect_callers, i, e)
{
/* Redirect calls to the old version node to point to its new
version. */
@@ -2272,7 +2272,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
DECL_WEAK (new_node->decl) = 0;
new_node->clone.tree_map = tree_map;
new_node->clone.args_to_skip = args_to_skip;
- for (i = 0; VEC_iterate (ipa_replace_map_p, tree_map, i, map); i++)
+ FOR_EACH_VEC_ELT (ipa_replace_map_p, tree_map, i, map)
{
tree var = map->new_tree;
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 4d02057420a..4ef63a2d350 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2160,7 +2160,7 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
e->lto_stmt_uid, REG_BR_PROB_BASE,
CGRAPH_FREQ_BASE,
e->loop_nest, true);
- for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++)
+ FOR_EACH_VEC_ELT (cgraph_edge_p, redirect_callers, i, e)
{
/* Redirect calls to the old version node to point to its new
version. */
diff --git a/gcc/combine.c b/gcc/combine.c
index 9c5d8d00040..1f8e97007ee 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1417,7 +1417,7 @@ init_reg_last (void)
unsigned int i;
reg_stat_type *p;
- for (i = 0; VEC_iterate (reg_stat_type, reg_stat, i, p); ++i)
+ FOR_EACH_VEC_ELT (reg_stat_type, reg_stat, i, p)
memset (p, 0, offsetof (reg_stat_type, sign_bit_copies));
}
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 566c08bc1d9..d0a13969f8d 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3795,12 +3795,12 @@ bfin_dump_loops (loop_info loops)
fprintf (dump_file, "{head:%d, depth:%d}", loop->head->index, loop->depth);
fprintf (dump_file, " blocks: [ ");
- for (ix = 0; VEC_iterate (basic_block, loop->blocks, ix, b); ix++)
+ FOR_EACH_VEC_ELT (basic_block, loop->blocks, ix, b)
fprintf (dump_file, "%d ", b->index);
fprintf (dump_file, "] ");
fprintf (dump_file, " inner loops: [ ");
- for (ix = 0; VEC_iterate (loop_info, loop->loops, ix, i); ix++)
+ FOR_EACH_VEC_ELT (loop_info, loop->loops, ix, i)
fprintf (dump_file, "%d ", i->loop_no);
fprintf (dump_file, "]\n");
}
@@ -3826,7 +3826,7 @@ bfin_scan_loop (loop_info loop, rtx reg, rtx loop_end)
unsigned ix;
basic_block bb;
- for (ix = 0; VEC_iterate (basic_block, loop->blocks, ix, bb); ix++)
+ FOR_EACH_VEC_ELT (basic_block, loop->blocks, ix, bb)
{
rtx insn;
@@ -3902,7 +3902,7 @@ bfin_optimize_loop (loop_info loop)
/* Every loop contains in its list of inner loops every loop nested inside
it, even if there are intermediate loops. This works because we're doing
a depth-first search here and never visit a loop more than once. */
- for (ix = 0; VEC_iterate (loop_info, loop->loops, ix, inner); ix++)
+ FOR_EACH_VEC_ELT (loop_info, loop->loops, ix, inner)
{
bfin_optimize_loop (inner);
@@ -4052,7 +4052,7 @@ bfin_optimize_loop (loop_info loop)
reg_lb0 = gen_rtx_REG (SImode, REG_LB0);
reg_lb1 = gen_rtx_REG (SImode, REG_LB1);
- for (ix = 0; VEC_iterate (basic_block, loop->blocks, ix, bb); ix++)
+ FOR_EACH_VEC_ELT (basic_block, loop->blocks, ix, bb)
{
rtx insn;
@@ -4433,7 +4433,7 @@ bfin_discover_loop (loop_info loop, basic_block tail_bb, rtx tail_insn)
if (!loop->bad)
{
int pass, retry;
- for (dwork = 0; VEC_iterate (basic_block, loop->blocks, dwork, bb); dwork++)
+ FOR_EACH_VEC_ELT (basic_block, loop->blocks, dwork, bb)
{
edge e;
edge_iterator ei;
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 5fc78c1fc35..24732199312 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -4021,9 +4021,7 @@ mips_multi_write (void)
struct mips_multi_member *member;
unsigned int i;
- for (i = 0;
- VEC_iterate (mips_multi_member, mips_multi_members, i, member);
- i++)
+ FOR_EACH_VEC_ELT (mips_multi_member, mips_multi_members, i, member)
if (member->is_label_p)
fprintf (asm_out_file, "%s\n", member->format);
else
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 2621af9107f..89e0127a479 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -24602,7 +24602,7 @@ no_previous_def (tree function_name)
branch_island *bi;
unsigned ix;
- for (ix = 0; VEC_iterate (branch_island, branch_islands, ix, bi); ix++)
+ FOR_EACH_VEC_ELT (branch_island, branch_islands, ix, bi)
if (function_name == bi->function_name)
return 0;
return 1;
@@ -24617,7 +24617,7 @@ get_prev_label (tree function_name)
branch_island *bi;
unsigned ix;
- for (ix = 0; VEC_iterate (branch_island, branch_islands, ix, bi); ix++)
+ FOR_EACH_VEC_ELT (branch_island, branch_islands, ix, bi)
if (function_name == bi->function_name)
return bi->label_name;
return NULL_TREE;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 82c8299990b..719658db523 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-20 Nathan Froyd <froydnj@codesourcery.com>
+
+ * call.c: Use FOR_EACH_VEC_ELT.
+ * class.c: Likewise.
+ * decl.c: Likewise.
+ * decl2.c: Likewise.
+ * error.c: Likewise.
+ * except.c: Likewise.
+ * mangle.c: Likewise.
+ * method.c: Likewise.
+ * name-lookup.c: Likewise.
+ * parser.c: Likewise.
+ * pt.c: Likewise.
+ * repo.c: Likewise.
+ * semantics.c: Likewise.
+ * typeck2.c: Likewise.
+
2010-08-19 Jason Merrill <jason@redhat.com>
* call.c (reference_related_p): Check for error_mark_node.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index adcf9847587..36f5a556af5 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3161,7 +3161,7 @@ resolve_args (VEC(tree,gc) *args)
unsigned int ix;
tree arg;
- for (ix = 0; VEC_iterate (tree, args, ix, arg); ++ix)
+ FOR_EACH_VEC_ELT (tree, args, ix, arg)
{
if (error_operand_p (arg))
return NULL;
@@ -5423,7 +5423,7 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum)
}
/* Detect recursion. */
- for (i = 0; VEC_iterate (tree, default_arg_context, i, t); ++i)
+ FOR_EACH_VEC_ELT (tree, default_arg_context, i, t)
if (t == fn)
{
error ("recursive evaluation of default argument for %q#D", fn);
@@ -5620,7 +5620,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
++nargs;
alcarray = XALLOCAVEC (tree, nargs);
alcarray[0] = first_arg;
- for (ix = 0; VEC_iterate (tree, args, ix, arg); ++ix)
+ FOR_EACH_VEC_ELT (tree, args, ix, arg)
alcarray[ix + 1] = arg;
argarray = alcarray;
}
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c00b7de794c..35b6db13c1f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2048,7 +2048,7 @@ get_vcall_index (tree fn, tree type)
tree_pair_p p;
unsigned ix;
- for (ix = 0; VEC_iterate (tree_pair_s, indices, ix, p); ix++)
+ FOR_EACH_VEC_ELT (tree_pair_s, indices, ix, p)
if ((DECL_DESTRUCTOR_P (fn) && DECL_DESTRUCTOR_P (p->purpose))
|| same_signature_p (fn, p->purpose))
return p->value;
@@ -8125,7 +8125,7 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
signature as FN, then we do not need a second vcall offset.
Check the list of functions already present in the derived
class vtable. */
- for (i = 0; VEC_iterate (tree, vid->fns, i, derived_entry); ++i)
+ FOR_EACH_VEC_ELT (tree, vid->fns, i, derived_entry)
{
if (same_signature_p (derived_entry, orig_fn)
/* We only use one vcall offset for virtual destructors,
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 198921fd082..6465658f5de 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -720,9 +720,8 @@ poplevel (int keep, int reverse, int functionbody)
/* Remove declarations for any `for' variables from inner scopes
that we kept around. */
- for (ix = VEC_length (tree, current_binding_level->dead_vars_from_for) - 1;
- VEC_iterate (tree, current_binding_level->dead_vars_from_for, ix, decl);
- ix--)
+ FOR_EACH_VEC_ELT_REVERSE (tree, current_binding_level->dead_vars_from_for,
+ ix, decl)
pop_binding (DECL_NAME (decl), decl);
/* Restore the IDENTIFIER_TYPE_VALUEs. */
@@ -731,11 +730,9 @@ poplevel (int keep, int reverse, int functionbody)
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (link), TREE_VALUE (link));
/* Restore the IDENTIFIER_LABEL_VALUEs for local labels. */
- for (ix = VEC_length (cp_label_binding,
- current_binding_level->shadowed_labels) - 1;
- VEC_iterate (cp_label_binding, current_binding_level->shadowed_labels,
- ix, label_bind);
- ix--)
+ FOR_EACH_VEC_ELT_REVERSE (cp_label_binding,
+ current_binding_level->shadowed_labels,
+ ix, label_bind)
pop_local_label (label_bind->label, label_bind->prev_value);
/* There may be OVERLOADs (wrapped in TREE_LISTs) on the BLOCK_VARs
@@ -2712,7 +2709,7 @@ check_goto (tree decl)
identified = true;
}
- for (ix = 0; VEC_iterate (tree, ent->bad_decls, ix, bad); ix++)
+ FOR_EACH_VEC_ELT (tree, ent->bad_decls, ix, bad)
{
int u = decl_jump_unsafe (bad);
@@ -4598,9 +4595,7 @@ maybe_deduce_size_from_array_init (tree decl, tree init)
VEC(constructor_elt,gc) *v = CONSTRUCTOR_ELTS (initializer);
constructor_elt *ce;
HOST_WIDE_INT i;
- for (i = 0;
- VEC_iterate (constructor_elt, v, i, ce);
- ++i)
+ FOR_EACH_VEC_ELT (constructor_elt, v, i, ce)
if (!check_array_designated_initializer (ce))
failure = 1;
}
@@ -12837,7 +12832,7 @@ finish_function (int flags)
unsigned int i;
tree decl;
- for (i = 0; VEC_iterate (tree, deferred_mark_used_calls, i, decl); i++)
+ FOR_EACH_VEC_ELT (tree, deferred_mark_used_calls, i, decl)
mark_used (decl);
VEC_free (tree, gc, deferred_mark_used_calls);
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index fed345246a6..f2330554a14 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3300,7 +3300,7 @@ generate_ctor_or_dtor_function (bool constructor_p, int priority,
/* Call the static storage duration function with appropriate
arguments. */
- for (i = 0; VEC_iterate (tree, ssdf_decls, i, fndecl); ++i)
+ FOR_EACH_VEC_ELT (tree, ssdf_decls, i, fndecl)
{
/* Calls to pure or const functions will expand to nothing. */
if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE)))
@@ -3742,7 +3742,7 @@ cp_write_global_declarations (void)
/* Go through the set of inline functions whose bodies have not
been emitted yet. If out-of-line copies of these functions
are required, emit them. */
- for (i = 0; VEC_iterate (tree, deferred_fns, i, decl); ++i)
+ FOR_EACH_VEC_ELT (tree, deferred_fns, i, decl)
{
/* Does it need synthesizing? */
if (DECL_DEFAULTED_FN (decl) && ! DECL_INITIAL (decl)
@@ -3844,7 +3844,7 @@ cp_write_global_declarations (void)
reconsider = true;
/* Static data members are just like namespace-scope globals. */
- for (i = 0; VEC_iterate (tree, pending_statics, i, decl); ++i)
+ FOR_EACH_VEC_ELT (tree, pending_statics, i, decl)
{
if (var_finalized_p (decl) || DECL_REALLY_EXTERN (decl)
/* Don't write it out if we haven't seen a definition. */
@@ -3866,7 +3866,7 @@ cp_write_global_declarations (void)
while (reconsider);
/* All used inline functions must have a definition at this point. */
- for (i = 0; VEC_iterate (tree, deferred_fns, i, decl); ++i)
+ FOR_EACH_VEC_ELT (tree, deferred_fns, i, decl)
{
if (/* Check online inline functions that were actually used. */
DECL_ODR_USED (decl) && DECL_DECLARED_INLINE_P (decl)
@@ -3888,7 +3888,7 @@ cp_write_global_declarations (void)
}
/* So must decls that use a type with no linkage. */
- for (i = 0; VEC_iterate (tree, no_linkage_decls, i, decl); ++i)
+ FOR_EACH_VEC_ELT (tree, no_linkage_decls, i, decl)
if (!decl_defined_p (decl))
no_linkage_error (decl);
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index cff822a55c1..2bcc35bcc3f 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -304,7 +304,7 @@ dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames)
parms = TREE_CHAIN (parms);
}
- for (i = 0; VEC_iterate (tree, typenames, i, t); ++i)
+ FOR_EACH_VEC_ELT (tree, typenames, i, t)
{
if (need_comma)
pp_separate_with_comma (cxx_pp);
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 20b44e3ed04..351e685a687 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1104,9 +1104,7 @@ perform_deferred_noexcept_checks (void)
int i;
pending_noexcept *p;
location_t saved_loc = input_location;
- for (i = 0;
- VEC_iterate (pending_noexcept, pending_noexcept_checks, i, p);
- ++i)
+ FOR_EACH_VEC_ELT (pending_noexcept, pending_noexcept_checks, i, p)
{
input_location = p->loc;
maybe_noexcept_warning (p->fn);
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index a47dfa8babf..03e28374810 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -307,7 +307,7 @@ dump_substitution_candidates (void)
tree el;
fprintf (stderr, " ++ substitutions ");
- for (i = 0; VEC_iterate (tree, G.substitutions, i, el); ++i)
+ FOR_EACH_VEC_ELT (tree, G.substitutions, i, el)
{
const char *name = "???";
@@ -387,7 +387,7 @@ add_substitution (tree node)
int i;
tree candidate;
- for (i = 0; VEC_iterate (tree, G.substitutions, i, candidate); i++)
+ FOR_EACH_VEC_ELT (tree, G.substitutions, i, candidate)
{
gcc_assert (!(DECL_P (node) && node == candidate));
gcc_assert (!(TYPE_P (node) && TYPE_P (candidate)
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index b9511f5a628..359e71d1b32 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1204,7 +1204,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
if (diag)
msg = ("virtual base %qT does not have a move constructor "
"or trivial copy constructor");
- for (i = 0; VEC_iterate (tree, vbases, i, base_binfo); ++i)
+ FOR_EACH_VEC_ELT (tree, vbases, i, base_binfo)
{
if (copy_arg_p)
argtype = build_stub_type (BINFO_TYPE (base_binfo), quals, move_p);
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 800e340de95..af6cef41229 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -327,9 +327,7 @@ new_class_binding (tree name, tree value, tree type, cxx_scope *scope)
/* Fixup the current bindings, as they might have moved. */
size_t i;
- for (i = 0;
- VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb);
- i++)
+ FOR_EACH_VEC_ELT (cp_class_binding, scope->class_shadowed, i, cb)
{
cxx_binding **b;
b = &IDENTIFIER_BINDING (cb->identifier);
@@ -1687,9 +1685,7 @@ print_binding_level (struct cp_binding_level* lvl)
size_t i;
cp_class_binding *b;
fprintf (stderr, " class-shadowed:");
- for (i = 0;
- VEC_iterate(cp_class_binding, lvl->class_shadowed, i, b);
- ++i)
+ FOR_EACH_VEC_ELT (cp_class_binding, lvl->class_shadowed, i, b)
fprintf (stderr, " %s ", IDENTIFIER_POINTER (b->identifier));
fprintf (stderr, "\n");
}
@@ -2644,9 +2640,7 @@ poplevel_class (void)
/* Remove the bindings for all of the class-level declarations. */
if (level->class_shadowed)
{
- for (i = 0;
- VEC_iterate (cp_class_binding, level->class_shadowed, i, cb);
- ++i)
+ FOR_EACH_VEC_ELT (cp_class_binding, level->class_shadowed, i, cb)
IDENTIFIER_BINDING (cb->identifier) = cb->base.previous;
ggc_free (level->class_shadowed);
level->class_shadowed = NULL;
@@ -4048,7 +4042,7 @@ tree_vec_contains (VEC(tree,gc)* vec, tree target)
{
unsigned int i;
tree elt;
- for (i = 0; VEC_iterate(tree,vec,i,elt); ++i)
+ FOR_EACH_VEC_ELT (tree,vec,i,elt)
if (elt == target)
return true;
return false;
@@ -5001,7 +4995,7 @@ arg_assoc_args_vec (struct arg_lookup *k, VEC(tree,gc) *args)
unsigned int ix;
tree arg;
- for (ix = 0; VEC_iterate (tree, args, ix, arg); ++ix)
+ FOR_EACH_VEC_ELT (tree, args, ix, arg)
if (arg_assoc (k, arg))
return true;
return false;
@@ -5484,7 +5478,7 @@ push_to_top_level (void)
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t));
}
- for (i = 0; VEC_iterate (cxx_saved_binding, s->old_bindings, i, sb); ++i)
+ FOR_EACH_VEC_ELT (cxx_saved_binding, s->old_bindings, i, sb)
IDENTIFIER_MARKED (sb->identifier) = 0;
s->prev = scope_chain;
@@ -5521,7 +5515,7 @@ pop_from_top_level (void)
current_lang_base = 0;
scope_chain = s->prev;
- for (i = 0; VEC_iterate (cxx_saved_binding, s->old_bindings, i, saved); ++i)
+ FOR_EACH_VEC_ELT (cxx_saved_binding, s->old_bindings, i, saved)
{
tree id = saved->identifier;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index dd6f04c0002..6c4fe1de63b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11187,14 +11187,10 @@ cp_parser_template_id (cp_parser *parser,
access_check = check_value->checks;
if (access_check)
{
- for (i = 0 ;
- VEC_iterate (deferred_access_check, access_check, i, chk) ;
- ++i)
- {
- perform_or_defer_access_check (chk->binfo,
- chk->decl,
- chk->diag_decl);
- }
+ FOR_EACH_VEC_ELT (deferred_access_check, access_check, i, chk)
+ perform_or_defer_access_check (chk->binfo,
+ chk->decl,
+ chk->diag_decl);
}
/* Return the stored value. */
return check_value->value;
@@ -16319,10 +16315,8 @@ cp_parser_class_specifier (cp_parser* parser)
};
*/
- for (ix = 0;
- VEC_iterate (cp_default_arg_entry, unparsed_funs_with_default_args,
- ix, e);
- ix++)
+ FOR_EACH_VEC_ELT (cp_default_arg_entry, unparsed_funs_with_default_args,
+ ix, e)
{
fn = e->decl;
/* If there are default arguments that have not yet been processed,
@@ -16345,9 +16339,7 @@ cp_parser_class_specifier (cp_parser* parser)
pop_scope (pushed_scope);
VEC_truncate (cp_default_arg_entry, unparsed_funs_with_default_args, 0);
/* Now parse the body of the functions. */
- for (ix = 0;
- VEC_iterate (tree, unparsed_funs_with_definitions, ix, fn);
- ix++)
+ FOR_EACH_VEC_ELT (tree, unparsed_funs_with_definitions, ix, fn)
cp_parser_late_parsing_for_member (parser, fn);
VEC_truncate (tree, unparsed_funs_with_definitions, 0);
}
@@ -20469,14 +20461,10 @@ cp_parser_pre_parsed_nested_name_specifier (cp_parser *parser)
checks = check_value->checks;
if (checks)
{
- for (i = 0 ;
- VEC_iterate (deferred_access_check, checks, i, chk) ;
- ++i)
- {
- perform_or_defer_access_check (chk->binfo,
- chk->decl,
- chk->diag_decl);
- }
+ FOR_EACH_VEC_ELT (deferred_access_check, checks, i, chk)
+ perform_or_defer_access_check (chk->binfo,
+ chk->decl,
+ chk->diag_decl);
}
/* Set the scope from the stored value. */
parser->scope = check_value->value;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 02c54f9db8c..759e22f6679 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7735,11 +7735,9 @@ perform_typedefs_access_check (tree tmpl, tree targs)
return;
saved_location = input_location;
- for (i = 0;
- VEC_iterate (qualified_typedef_usage_t,
+ FOR_EACH_VEC_ELT (qualified_typedef_usage_t,
get_types_needing_access_check (tmpl),
- i, iter);
- ++i)
+ i, iter)
{
tree type_decl = iter->typedef_decl;
tree type_scope = iter->context;
@@ -12799,7 +12797,7 @@ tsubst_copy_and_build (tree t,
n = VEC_copy (constructor_elt, gc, CONSTRUCTOR_ELTS (t));
newlen = VEC_length (constructor_elt, n);
- for (idx = 0; VEC_iterate (constructor_elt, n, idx, ce); idx++)
+ FOR_EACH_VEC_ELT (constructor_elt, n, idx, ce)
{
if (ce->index && process_index_p)
ce->index = RECUR (ce->index);
@@ -12833,8 +12831,7 @@ tsubst_copy_and_build (tree t,
VEC(constructor_elt,gc) *old_n = n;
n = VEC_alloc (constructor_elt, gc, newlen);
- for (idx = 0; VEC_iterate (constructor_elt, old_n, idx, ce);
- idx++)
+ FOR_EACH_VEC_ELT (constructor_elt, old_n, idx, ce)
{
if (TREE_CODE (ce->value) == TREE_VEC)
{
@@ -17923,7 +17920,7 @@ any_type_dependent_arguments_p (const VEC(tree,gc) *args)
unsigned int i;
tree arg;
- for (i = 0; VEC_iterate (tree, args, i, arg); ++i)
+ FOR_EACH_VEC_ELT (tree, args, i, arg)
{
if (type_dependent_expression_p (arg))
return true;
@@ -18359,7 +18356,7 @@ make_args_non_dependent (VEC(tree,gc) *args)
unsigned int ix;
tree arg;
- for (ix = 0; VEC_iterate (tree, args, ix, arg); ++ix)
+ FOR_EACH_VEC_ELT (tree, args, ix, arg)
{
tree newarg = build_non_dependent_expr (arg);
if (newarg != arg)
@@ -18662,11 +18659,9 @@ append_type_to_template_for_access_check (tree templ,
gcc_assert (type_decl && (TREE_CODE (type_decl) == TYPE_DECL));
/* Make sure we don't append the type to the template twice. */
- for (i = 0;
- VEC_iterate (qualified_typedef_usage_t,
+ FOR_EACH_VEC_ELT (qualified_typedef_usage_t,
get_types_needing_access_check (templ),
- i, iter);
- ++i)
+ i, iter)
if (iter->typedef_decl == type_decl && scope == iter->context)
return;
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index 2a08c8fa412..22d58af0f84 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -267,9 +267,7 @@ finish_repo (void)
fprintf (repo_file, "\n");
}
- for (ix = VEC_length (tree, pending_repo) - 1;
- VEC_iterate (tree, pending_repo, ix, val);
- ix--)
+ FOR_EACH_VEC_ELT_REVERSE (tree, pending_repo, ix, val)
{
tree name = DECL_ASSEMBLER_NAME (val);
char type = IDENTIFIER_REPO_CHOSEN (name) ? 'C' : 'O';
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 949e108902a..0afa8f994ea 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -232,14 +232,10 @@ pop_to_parent_deferring_access_checks (void)
int i, j;
deferred_access_check *chk, *probe;
- for (i = 0 ;
- VEC_iterate (deferred_access_check, checks, i, chk) ;
- ++i)
+ FOR_EACH_VEC_ELT (deferred_access_check, checks, i, chk)
{
- for (j = 0 ;
- VEC_iterate (deferred_access_check,
- ptr->deferred_access_checks, j, probe) ;
- ++j)
+ FOR_EACH_VEC_ELT (deferred_access_check,
+ ptr->deferred_access_checks, j, probe)
{
if (probe->binfo == chk->binfo &&
probe->decl == chk->decl &&
@@ -268,7 +264,7 @@ perform_access_checks (VEC (deferred_access_check,gc)* checks)
if (!checks)
return;
- for (i = 0 ; VEC_iterate (deferred_access_check, checks, i, chk) ; ++i)
+ FOR_EACH_VEC_ELT (deferred_access_check, checks, i, chk)
enforce_access (chk->binfo, chk->decl, chk->diag_decl);
}
@@ -323,10 +319,8 @@ perform_or_defer_access_check (tree binfo, tree decl, tree diag_decl)
}
/* See if we are already going to perform this check. */
- for (i = 0 ;
- VEC_iterate (deferred_access_check,
- ptr->deferred_access_checks, i, chk) ;
- ++i)
+ FOR_EACH_VEC_ELT (deferred_access_check,
+ ptr->deferred_access_checks, i, chk)
{
if (chk->decl == decl && chk->binfo == binfo &&
chk->diag_decl == diag_decl)
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 59b9c40960e..b9c027a68cf 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -412,7 +412,7 @@ abstract_virtuals_error (tree decl, tree type)
" because the following virtual functions are pure within %qT:",
type);
- for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
+ FOR_EACH_VEC_ELT (tree, pure, ix, fn)
inform (input_location, "\t%+#D", fn);
/* Now truncate the vector. This leaves it non-null, so we know
there are pure virtuals, but empty so we don't list them out
@@ -1035,7 +1035,7 @@ process_init_constructor_array (tree type, tree init)
if (!unbounded && VEC_length (constructor_elt, v) > len)
error ("too many initializers for %qT", type);
- for (i = 0; VEC_iterate (constructor_elt, v, i, ce); ++i)
+ FOR_EACH_VEC_ELT (constructor_elt, v, i, ce)
{
if (ce->index)
{
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 2de3fcbda36..d43a4bf59aa 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -2504,7 +2504,7 @@ output_used_types (void)
qsort (VEC_address (tree, types), VEC_length (tree, types),
sizeof (tree), output_types_sort);
- for (i = 0; VEC_iterate (tree, types, i, type); i++)
+ FOR_EACH_VEC_ELT (tree, types, i, type)
debug_queue_symbol (type);
VEC_free (tree, heap, types);
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 8b17ae29488..ddd2387b200 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -1180,15 +1180,13 @@ df_free_collection_rec (struct df_collection_rec *collection_rec)
df_ref ref;
struct df_mw_hardreg *mw;
- for (ix = 0; VEC_iterate (df_ref, collection_rec->def_vec, ix, ref); ++ix)
+ FOR_EACH_VEC_ELT (df_ref, collection_rec->def_vec, ix, ref)
df_free_ref (ref);
- for (ix = 0; VEC_iterate (df_ref, collection_rec->use_vec, ix, ref); ++ix)
+ FOR_EACH_VEC_ELT (df_ref, collection_rec->use_vec, ix, ref)
df_free_ref (ref);
- for (ix = 0; VEC_iterate (df_ref, collection_rec->eq_use_vec, ix, ref); ++ix)
+ FOR_EACH_VEC_ELT (df_ref, collection_rec->eq_use_vec, ix, ref)
df_free_ref (ref);
- for (ix = 0;
- VEC_iterate (df_mw_hardreg_ptr, collection_rec->mw_vec, ix, mw);
- ++ix)
+ FOR_EACH_VEC_ELT (df_mw_hardreg_ptr, collection_rec->mw_vec, ix, mw)
pool_free (problem_data->mw_reg_pool, mw);
VEC_free (df_ref, stack, collection_rec->def_vec);
@@ -2664,7 +2662,7 @@ df_install_refs (basic_block bb,
if (add_to_table && df->analyze_subset)
add_to_table = bitmap_bit_p (df->blocks_to_analyze, bb->index);
- for (ix = 0; VEC_iterate (df_ref, old_vec, ix, this_ref); ++ix)
+ FOR_EACH_VEC_ELT (df_ref, old_vec, ix, this_ref)
{
new_vec[ix] = this_ref;
df_install_ref (this_ref, reg_info[DF_REF_REGNO (this_ref)],
@@ -3398,7 +3396,7 @@ df_get_conditional_uses (struct df_collection_rec *collection_rec)
unsigned int ix;
df_ref ref;
- for (ix = 0; VEC_iterate (df_ref, collection_rec->def_vec, ix, ref); ++ix)
+ FOR_EACH_VEC_ELT (df_ref, collection_rec->def_vec, ix, ref)
{
if (DF_REF_FLAGS_IS_SET (ref, DF_REF_CONDITIONAL))
{
@@ -3446,7 +3444,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec,
/* Do not generate clobbers for registers that are the result of the
call. This causes ordering problems in the chain building code
depending on which def is seen first. */
- for (i = 0; VEC_iterate (df_ref, collection_rec->def_vec, i, def); ++i)
+ FOR_EACH_VEC_ELT (df_ref, collection_rec->def_vec, i, def)
bitmap_set_bit (&defs_generated, DF_REF_REGNO (def));
/* Record the registers used to pass arguments, and explicitly
@@ -4382,7 +4380,7 @@ df_refs_verify (VEC(df_ref,stack) *new_rec, df_ref *old_rec,
unsigned int ix;
df_ref new_ref;
- for (ix = 0; VEC_iterate (df_ref, new_rec, ix, new_ref); ++ix)
+ FOR_EACH_VEC_ELT (df_ref, new_rec, ix, new_ref)
{
if (*old_rec == NULL || !df_ref_equal_p (new_ref, *old_rec))
{
@@ -4421,7 +4419,7 @@ df_mws_verify (VEC(df_mw_hardreg_ptr,stack) *new_rec,
unsigned int ix;
struct df_mw_hardreg *new_reg;
- for (ix = 0; VEC_iterate (df_mw_hardreg_ptr, new_rec, ix, new_reg); ++ix)
+ FOR_EACH_VEC_ELT (df_mw_hardreg_ptr, new_rec, ix, new_reg)
{
if (*old_rec == NULL || !df_mw_equal_p (new_reg, *old_rec))
{
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 7507de3dced..b0b97c6b6ec 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -1198,7 +1198,7 @@ determine_dominators_for_sons (struct graph *g, VEC (basic_block, heap) *bbs,
for (i = nc - 1; i >= 0; i--)
{
dom = NULL;
- for (si = 0; VEC_iterate (int, sccs[i], si, a); si++)
+ FOR_EACH_VEC_ELT (int, sccs[i], si, a)
{
bb = VEC_index (basic_block, bbs, a);
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -1211,7 +1211,7 @@ determine_dominators_for_sons (struct graph *g, VEC (basic_block, heap) *bbs,
}
gcc_assert (dom != NULL);
- for (si = 0; VEC_iterate (int, sccs[i], si, a); si++)
+ FOR_EACH_VEC_ELT (int, sccs[i], si, a)
{
bb = VEC_index (basic_block, bbs, a);
set_immediate_dominator (CDI_DOMINATORS, bb, dom);
@@ -1314,7 +1314,7 @@ iterate_fix_dominators (enum cdi_direction dir, VEC (basic_block, heap) *bbs,
conservatively correct, setting the dominators using the
heuristics in prune_bbs_to_update_dominators could
create cycles in the dominance "tree", and cause ICE. */
- for (i = 0; VEC_iterate (basic_block, bbs, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
set_immediate_dominator (CDI_DOMINATORS, bb, NULL);
}
@@ -1334,7 +1334,7 @@ iterate_fix_dominators (enum cdi_direction dir, VEC (basic_block, heap) *bbs,
/* Construct the graph G. */
map = pointer_map_create ();
- for (i = 0; VEC_iterate (basic_block, bbs, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
{
/* If the dominance tree is conservatively correct, split it now. */
if (conservative)
@@ -1346,7 +1346,7 @@ iterate_fix_dominators (enum cdi_direction dir, VEC (basic_block, heap) *bbs,
g = new_graph (n + 1);
for (y = 0; y < g->n_vertices; y++)
g->vertices[y].data = BITMAP_ALLOC (NULL);
- for (i = 0; VEC_iterate (basic_block, bbs, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
{
FOR_EACH_EDGE (e, ei, bb->preds)
{
diff --git a/gcc/dse.c b/gcc/dse.c
index 77c55116904..5dd7bd68bb6 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2772,7 +2772,7 @@ dse_step2_init (void)
unsigned int i;
group_info_t group;
- for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++)
+ FOR_EACH_VEC_ELT (group_info_t, rtx_group_vec, i, group)
{
/* For all non stack related bases, we only consider a store to
be deletable if there are two or more stores for that
@@ -2824,7 +2824,7 @@ dse_step2_nospill (void)
unused. */
current_position = 1;
- for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++)
+ FOR_EACH_VEC_ELT (group_info_t, rtx_group_vec, i, group)
{
bitmap_iterator bi;
unsigned int j;
@@ -3067,7 +3067,7 @@ scan_reads_nospill (insn_info_t insn_info, bitmap gen, bitmap kill)
/* If this insn reads the frame, kill all the frame related stores. */
if (insn_info->frame_read)
{
- for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++)
+ FOR_EACH_VEC_ELT (group_info_t, rtx_group_vec, i, group)
if (group->process_globally && group->frame_related)
{
if (kill)
@@ -3078,7 +3078,7 @@ scan_reads_nospill (insn_info_t insn_info, bitmap gen, bitmap kill)
while (read_info)
{
- for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++)
+ FOR_EACH_VEC_ELT (group_info_t, rtx_group_vec, i, group)
{
if (group->process_globally)
{
@@ -3259,7 +3259,7 @@ dse_step3_exit_block_scan (bb_info_t bb_info)
unsigned int i;
group_info_t group;
- for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++)
+ FOR_EACH_VEC_ELT (group_info_t, rtx_group_vec, i, group)
{
if (group->process_globally && group->frame_related)
bitmap_ior_into (bb_info->gen, group->group_kill);
@@ -3341,7 +3341,7 @@ dse_step3 (bool for_spills)
group_info_t group;
all_ones = BITMAP_ALLOC (NULL);
- for (j = 0; VEC_iterate (group_info_t, rtx_group_vec, j, group); j++)
+ FOR_EACH_VEC_ELT (group_info_t, rtx_group_vec, j, group)
bitmap_ior_into (all_ones, group->group_kill);
}
if (!bb_info->out)
@@ -3743,7 +3743,7 @@ dse_step7 (bool global_done)
group_info_t group;
basic_block bb;
- for (i = 0; VEC_iterate (group_info_t, rtx_group_vec, i, group); i++)
+ FOR_EACH_VEC_ELT (group_info_t, rtx_group_vec, i, group)
{
free (group->offset_map_n);
free (group->offset_map_p);
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 4b4042adb68..d63aec578fb 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -7560,7 +7560,7 @@ get_AT (dw_die_ref die, enum dwarf_attribute attr_kind)
if (! die)
return NULL;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
if (a->dw_attr == attr_kind)
return a;
else if (a->dw_attr == DW_AT_specification
@@ -7689,7 +7689,7 @@ remove_AT (dw_die_ref die, enum dwarf_attribute attr_kind)
if (! die)
return;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
if (a->dw_attr == attr_kind)
{
if (AT_class (a) == dw_val_class_str)
@@ -8277,7 +8277,7 @@ print_die (dw_die_ref die, FILE *outfile)
fprintf (outfile, "\n");
}
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
{
print_spaces (outfile);
fprintf (outfile, " %s: ", dwarf_attr_name (a->dw_attr));
@@ -8556,7 +8556,7 @@ die_checksum (dw_die_ref die, struct md5_ctx *ctx, int *mark)
CHECKSUM (die->die_tag);
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
attr_checksum (a, ctx, mark);
FOR_EACH_CHILD (die, c, die_checksum (c, ctx, mark));
@@ -8869,7 +8869,7 @@ collect_checksum_attributes (struct checksum_attributes *attrs, dw_die_ref die)
dw_attr_ref a;
unsigned ix;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
{
switch (a->dw_attr)
{
@@ -9303,7 +9303,7 @@ same_die_p (dw_die_ref die1, dw_die_ref die2, int *mark)
!= VEC_length (dw_attr_node, die2->die_attr))
return 0;
- for (ix = 0; VEC_iterate (dw_attr_node, die1->die_attr, ix, a1); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die1->die_attr, ix, a1)
if (!same_attr_p (a1, VEC_index (dw_attr_node, die2->die_attr, ix), mark))
return 0;
@@ -9664,7 +9664,7 @@ is_declaration_die (dw_die_ref die)
dw_attr_ref a;
unsigned ix;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
if (a->dw_attr == DW_AT_declaration)
return 1;
@@ -9735,7 +9735,7 @@ clone_die (dw_die_ref die)
clone = ggc_alloc_cleared_die_node ();
clone->die_tag = die->die_tag;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
add_dwarf_attr (clone, a);
return clone;
@@ -9776,7 +9776,7 @@ clone_as_declaration (dw_die_ref die)
clone = ggc_alloc_cleared_die_node ();
clone->die_tag = die->die_tag;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
{
/* We don't want to copy over all attributes.
For example we don't want DW_AT_byte_size because otherwise we will no
@@ -9833,7 +9833,7 @@ copy_declaration_context (dw_die_ref unit, dw_die_ref die)
remove_AT (die, DW_AT_specification);
- for (ix = 0; VEC_iterate (dw_attr_node, decl->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, decl->die_attr, ix, a)
{
if (a->dw_attr != DW_AT_name
&& a->dw_attr != DW_AT_declaration
@@ -10129,7 +10129,7 @@ copy_decls_walk (dw_die_ref unit, dw_die_ref die, htab_t decl_table)
dw_attr_ref a;
unsigned ix;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
{
if (AT_class (a) == dw_val_class_die_ref)
{
@@ -10248,7 +10248,7 @@ output_location_lists (dw_die_ref die)
dw_attr_ref a;
unsigned ix;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
if (AT_class (a) == dw_val_class_loc_list)
output_loc_list (AT_loc_list (a));
@@ -10271,7 +10271,7 @@ build_abbrev_table (dw_die_ref die)
/* Scan the DIE references, and mark as external any that refer to
DIEs from other CUs (i.e. those which are not marked). */
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
if (AT_class (a) == dw_val_class_die_ref
&& AT_ref (a)->die_mark == 0)
{
@@ -10295,7 +10295,7 @@ build_abbrev_table (dw_die_ref die)
!= VEC_length (dw_attr_node, die->die_attr))
continue;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, die_a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, die_a)
{
abbrev_a = VEC_index (dw_attr_node, abbrev->die_attr, ix);
if ((abbrev_a->dw_attr != die_a->dw_attr)
@@ -10359,7 +10359,7 @@ size_of_die (dw_die_ref die)
unsigned ix;
size += size_of_uleb128 (die->die_abbrev);
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
{
switch (AT_class (a))
{
@@ -10531,7 +10531,7 @@ unmark_all_dies (dw_die_ref die)
FOR_EACH_CHILD (die, c, unmark_all_dies (c));
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
if (AT_class (a) == dw_val_class_die_ref)
unmark_all_dies (AT_ref (a));
}
@@ -10547,7 +10547,7 @@ size_of_pubnames (VEC (pubname_entry, gc) * names)
pubname_ref p;
size = DWARF_PUBNAMES_HEADER_SIZE;
- for (i = 0; VEC_iterate (pubname_entry, names, i, p); i++)
+ FOR_EACH_VEC_ELT (pubname_entry, names, i, p)
if (names != pubtype_table
|| p->die->die_offset != 0
|| !flag_eliminate_unused_debug_types)
@@ -10905,7 +10905,7 @@ output_die (dw_die_ref die)
(unsigned long)die->die_offset,
dwarf_tag_name (die->die_tag));
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
{
const char *name = dwarf_attr_name (a->dw_attr);
@@ -11371,7 +11371,7 @@ output_pubnames (VEC (pubname_entry, gc) * names)
dw2_asm_output_data (DWARF_OFFSET_SIZE, next_die_offset,
"Compilation Unit Length");
- for (i = 0; VEC_iterate (pubname_entry, names, i, pub); i++)
+ FOR_EACH_VEC_ELT (pubname_entry, names, i, pub)
{
/* We shouldn't see pubnames for DIEs outside of the main CU. */
if (names == pubname_table)
@@ -12318,7 +12318,7 @@ size_of_dcall_table (void)
size = 2 + DWARF_OFFSET_SIZE + 1;
/* Each entry: code label + DIE offset. */
- for (i = 0; VEC_iterate (dcall_entry, dcall_table, i, p); i++)
+ FOR_EACH_VEC_ELT (dcall_entry, dcall_table, i, p)
{
gcc_assert (p->targ_die != NULL);
/* Insert a "from" entry when the point-of-call DIE offset changes. */
@@ -12360,7 +12360,7 @@ output_dcall_table (void)
"Offset of Compilation Unit Info");
dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Pointer Size (in bytes)");
- for (i = 0; VEC_iterate (dcall_entry, dcall_table, i, p); i++)
+ FOR_EACH_VEC_ELT (dcall_entry, dcall_table, i, p)
{
/* Insert a "from" entry when the point-of-call DIE offset changes. */
if (p->poc_decl != last_poc_decl)
@@ -12394,7 +12394,7 @@ size_of_vcall_table (void)
size = 2 + 1;
/* Each entry: code label + vtable slot index. */
- for (i = 0; VEC_iterate (vcall_entry, vcall_table, i, p); i++)
+ FOR_EACH_VEC_ELT (vcall_entry, vcall_table, i, p)
size += DWARF_OFFSET_SIZE + size_of_uleb128 (p->vtable_slot);
return size;
@@ -12419,7 +12419,7 @@ output_vcall_table (void)
dw2_asm_output_data (2, 4, "Version number");
dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Pointer Size (in bytes)");
- for (i = 0; VEC_iterate (vcall_entry, vcall_table, i, p); i++)
+ FOR_EACH_VEC_ELT (vcall_entry, vcall_table, i, p)
{
ASM_GENERATE_INTERNAL_LABEL (poc_label, "LPOC", p->poc_label_num);
dw2_asm_output_addr (DWARF_OFFSET_SIZE, poc_label, "Point of call");
@@ -16713,9 +16713,7 @@ native_encode_initializer (tree init, unsigned char *array, int size)
min_index = tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0);
memset (array, '\0', size);
- for (cnt = 0;
- VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (init), cnt, ce);
- cnt++)
+ FOR_EACH_VEC_ELT (constructor_elt, CONSTRUCTOR_ELTS (init), cnt, ce)
{
tree val = ce->value;
tree index = ce->index;
@@ -16761,9 +16759,7 @@ native_encode_initializer (tree init, unsigned char *array, int size)
if (TREE_CODE (type) == RECORD_TYPE)
field = TYPE_FIELDS (type);
- for (cnt = 0;
- VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (init), cnt, ce);
- cnt++, field = field ? DECL_CHAIN (field) : 0)
+ FOR_EACH_VEC_ELT (constructor_elt, CONSTRUCTOR_ELTS (init), cnt, ce)
{
tree val = ce->value;
int pos, fieldsize;
@@ -21121,9 +21117,7 @@ gen_remaining_tmpl_value_param_die_attribute (void)
unsigned i;
die_arg_entry *e;
- for (i = 0;
- VEC_iterate (die_arg_entry, tmpl_value_parm_die_table, i, e);
- i++)
+ FOR_EACH_VEC_ELT (die_arg_entry, tmpl_value_parm_die_table, i, e)
tree_add_const_value_attribute (e->die, e->arg);
}
}
@@ -21733,7 +21727,7 @@ prune_unused_types_walk_attribs (dw_die_ref die)
dw_attr_ref a;
unsigned ix;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
{
if (a->dw_attr_val.val_class == dw_val_class_die_ref)
{
@@ -21918,7 +21912,7 @@ prune_unused_types_update_strings (dw_die_ref die)
dw_attr_ref a;
unsigned ix;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
if (AT_class (a) == dw_val_class_str)
{
struct indirect_string_node *s = a->dw_attr_val.v.val_str;
@@ -22025,13 +22019,13 @@ prune_unused_types (void)
/* Also set the mark on nodes referenced from the
pubname_table or arange_table. */
- for (i = 0; VEC_iterate (pubname_entry, pubname_table, i, pub); i++)
+ FOR_EACH_VEC_ELT (pubname_entry, pubname_table, i, pub)
prune_unused_types_mark (pub->die, 1);
for (i = 0; i < arange_table_in_use; i++)
prune_unused_types_mark (arange_table[i], 1);
/* Mark nodes referenced from the direct call table. */
- for (i = 0; VEC_iterate (dcall_entry, dcall_table, i, dcall); i++)
+ FOR_EACH_VEC_ELT (dcall_entry, dcall_table, i, dcall)
prune_unused_types_mark (dcall->targ_die, 1);
/* Get rid of nodes that aren't marked; and update the string counts. */
@@ -22190,7 +22184,7 @@ resolve_addr (dw_die_ref die)
dw_loc_list_ref *curr;
unsigned ix;
- for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ FOR_EACH_VEC_ELT (dw_attr_node, die->die_attr, ix, a)
switch (AT_class (a))
{
case dw_val_class_loc_list:
diff --git a/gcc/except.c b/gcc/except.c
index 419936a4838..0df1996124b 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -3057,7 +3057,7 @@ output_one_function_exception_table (const char * ARG_UNUSED (fnname),
/* ??? Decode and interpret the data for flag_debug_asm. */
{
uchar uc;
- for (i = 0; VEC_iterate (uchar, crtl->eh.action_record_data, i, uc); ++i)
+ FOR_EACH_VEC_ELT (uchar, crtl->eh.action_record_data, i, uc)
dw2_asm_output_data (1, uc, i ? NULL : "Action record table");
}
diff --git a/gcc/expr.c b/gcc/expr.c
index 2cfb5b379ff..5793f9d1581 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6599,9 +6599,7 @@ safe_from_p (const_rtx x, tree exp, int top_p)
constructor_elt *ce;
unsigned HOST_WIDE_INT idx;
- for (idx = 0;
- VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (exp), idx, ce);
- idx++)
+ FOR_EACH_VEC_ELT (constructor_elt, CONSTRUCTOR_ELTS (exp), idx, ce)
if ((ce->index != NULL_TREE && !safe_from_p (x, ce->index, 0))
|| !safe_from_p (x, ce->value, 0))
return 0;
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 90d26fbc469..b5330ae6938 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-20 Nathan Froyd <froydnj@codesourcery.com>
+
+ * trans-openmp.c: Use FOR_EACH_VEC_ELT.
+
2010-08-19 Daniel Kraft <d@domob.eu>
PR fortran/29785
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 4a7f70e7b6e..14e3e2f2236 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -1357,7 +1357,7 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
gfc_start_block (&body);
- for (ix = 0; VEC_iterate (dovar_init, inits, ix, di); ix++)
+ FOR_EACH_VEC_ELT (dovar_init, inits, ix, di)
gfc_add_modify (&body, di->var, di->init);
VEC_free (dovar_init, heap, inits);
diff --git a/gcc/function.c b/gcc/function.c
index 95b9577076d..66f95828d37 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -2171,7 +2171,7 @@ split_complex_args (VEC(tree, heap) **args)
unsigned i;
tree p;
- for (i = 0; VEC_iterate (tree, *args, i, p); ++i)
+ FOR_EACH_VEC_ELT (tree, *args, i, p)
{
tree type = TREE_TYPE (p);
if (TREE_CODE (type) == COMPLEX_TYPE
@@ -3295,7 +3295,7 @@ assign_parms (tree fndecl)
assign_parms_initialize_all (&all);
fnargs = assign_parms_augmented_arg_list (&all);
- for (i = 0; VEC_iterate (tree, fnargs, i, parm); ++i)
+ FOR_EACH_VEC_ELT (tree, fnargs, i, parm)
{
struct assign_parm_data_one data;
@@ -3523,7 +3523,7 @@ gimplify_parameters (void)
assign_parms_initialize_all (&all);
fnargs = assign_parms_augmented_arg_list (&all);
- for (i = 0; VEC_iterate (tree, fnargs, i, parm); ++i)
+ FOR_EACH_VEC_ELT (tree, fnargs, i, parm)
{
struct assign_parm_data_one data;
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 15809aa0526..775c7e14127 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4413,9 +4413,7 @@ hoist_code (void)
/* Walk over each basic block looking for potentially hoistable
expressions, nothing gets hoisted from the entry block. */
- for (dom_tree_walk_index = 0;
- VEC_iterate (basic_block, dom_tree_walk, dom_tree_walk_index, bb);
- dom_tree_walk_index++)
+ FOR_EACH_VEC_ELT (basic_block, dom_tree_walk, dom_tree_walk_index, bb)
{
domby = get_dominated_to_depth (CDI_DOMINATORS, bb, MAX_HOIST_DEPTH);
@@ -4468,7 +4466,7 @@ hoist_code (void)
/* We've found a potentially hoistable expression, now
we look at every block BB dominates to see if it
computes the expression. */
- for (j = 0; VEC_iterate (basic_block, domby, j, dominated); j++)
+ FOR_EACH_VEC_ELT (basic_block, domby, j, dominated)
{
int max_distance;
@@ -4552,9 +4550,7 @@ hoist_code (void)
/* Walk through occurences of I'th expressions we want
to hoist to BB and make the transformations. */
- for (j = 0;
- VEC_iterate (occr_t, occrs_to_hoist, j, occr);
- j++)
+ FOR_EACH_VEC_ELT (occr_t, occrs_to_hoist, j, occr)
{
rtx insn;
rtx set;
diff --git a/gcc/genattr.c b/gcc/genattr.c
index 4fd22e219e3..acb3a382588 100644
--- a/gcc/genattr.c
+++ b/gcc/genattr.c
@@ -142,13 +142,13 @@ find_tune_attr (rtx exp)
if (strcmp (XSTR (exp, 0), "alternative") == 0)
return false;
- for (i = 0; VEC_iterate (rtx, const_attrs, i, attr); i++)
+ FOR_EACH_VEC_ELT (rtx, const_attrs, i, attr)
if (strcmp (XSTR (attr, 0), XSTR (exp, 0)) == 0)
{
unsigned int j;
rtx resv;
- for (j = 0; VEC_iterate (rtx, reservations, j, resv); j++)
+ FOR_EACH_VEC_ELT (rtx, reservations, j, resv)
if (! check_tune_attr (XSTR (attr, 0), XEXP (resv, 2)))
return false;
return true;
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 982d266dfba..cb1b64576a0 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -168,7 +168,7 @@ ggc_mark_roots (void)
for (i = 0; i < rti->nelt; i++)
(*rti->cb) (*(void **)((char *)rti->base + rti->stride * i));
- for (i = 0; VEC_iterate (const_ggc_root_tab_t, extra_root_vec, i, rtp); i++)
+ FOR_EACH_VEC_ELT (const_ggc_root_tab_t, extra_root_vec, i, rtp)
{
for (rti = rtp; rti->base != NULL; rti++)
for (i = 0; i < rti->nelt; i++)
@@ -183,7 +183,7 @@ ggc_mark_roots (void)
for (ct = gt_ggc_cache_rtab; *ct; ct++)
ggc_scan_cache_tab (*ct);
- for (i = 0; VEC_iterate (const_ggc_cache_tab_t, extra_cache_vec, i, ctp); i++)
+ FOR_EACH_VEC_ELT (const_ggc_cache_tab_t, extra_cache_vec, i, ctp)
ggc_scan_cache_tab (ctp);
if (! ggc_protect_identifiers)
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 6b654be9c11..32d07f0cc84 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3328,7 +3328,7 @@ gimplify_init_ctor_preeval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
constructor_elt *ce;
VEC(constructor_elt,gc) *v = CONSTRUCTOR_ELTS (*expr_p);
- for (ix = 0; VEC_iterate (constructor_elt, v, ix, ce); ix++)
+ FOR_EACH_VEC_ELT (constructor_elt, v, ix, ce)
gimplify_init_ctor_preeval (&ce->value, pre_p, post_p, data);
return;
@@ -3957,7 +3957,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
/* Vector types use CONSTRUCTOR all the way through gimple
compilation as a general initializer. */
- for (ix = 0; VEC_iterate (constructor_elt, elts, ix, ce); ix++)
+ FOR_EACH_VEC_ELT (constructor_elt, elts, ix, ce)
{
enum gimplify_status tret;
tret = gimplify_expr (&ce->value, pre_p, post_p, is_gimple_val,
@@ -6918,14 +6918,11 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
if (fallback == fb_none)
{
unsigned HOST_WIDE_INT ix;
- constructor_elt *ce;
+ tree val;
tree temp = NULL_TREE;
- for (ix = 0;
- VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (*expr_p),
- ix, ce);
- ix++)
- if (TREE_SIDE_EFFECTS (ce->value))
- append_to_statement_list (ce->value, &temp);
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (*expr_p), ix, val)
+ if (TREE_SIDE_EFFECTS (val))
+ append_to_statement_list (val, &temp);
*expr_p = temp;
ret = temp ? GS_OK : GS_ALL_DONE;
diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c
index deb25ec50e7..5108ed069bc 100644
--- a/gcc/graphite-blocking.c
+++ b/gcc/graphite-blocking.c
@@ -212,7 +212,7 @@ lst_do_strip_mine_loop (lst_p lst, int depth)
{
bool res = false;
- for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
res |= lst_do_strip_mine_loop (l, depth);
return res;
@@ -239,7 +239,7 @@ lst_do_strip_mine (lst_p lst)
|| !LST_LOOP_P (lst))
return false;
- for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
res |= lst_do_strip_mine (l);
depth = lst_depth (lst);
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 138c0df541e..3f26ad3aaec 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1224,7 +1224,7 @@ build_cloog_prog (scop_p scop, CloogProgram *prog,
cloog_program_set_nb_scattdims (prog, nbs);
initialize_cloog_names (scop, prog);
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
{
CloogStatement *stmt;
CloogBlock *block;
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 3f13ac32b4d..6296bfc2f3d 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -585,7 +585,7 @@ reduction_dr_1 (poly_bb_p pbb1, poly_dr_p pdr1, poly_dr_p pdr2)
int i;
poly_dr_p pdr;
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), i, pdr); i++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), i, pdr)
if (PDR_TYPE (pdr) == PDR_WRITE)
break;
@@ -722,8 +722,8 @@ graphite_legal_transform_bb (poly_bb_p pbb1, poly_bb_p pbb2)
if (reduction_ddr_p (pbb1, pbb2))
return true;
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), i, pdr1); i++)
- for (j = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), j, pdr2); j++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), i, pdr1)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), j, pdr2)
if (!graphite_legal_transform_dr (pdr1, pdr2))
return false;
@@ -741,8 +741,8 @@ graphite_legal_transform (scop_p scop)
timevar_push (TV_GRAPHITE_DATA_DEPS);
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb1); i++)
- for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2)
if (!graphite_legal_transform_bb (pbb1, pbb2))
{
timevar_pop (TV_GRAPHITE_DATA_DEPS);
@@ -803,8 +803,8 @@ dependency_between_pbbs_p (poly_bb_p pbb1, poly_bb_p pbb2, int level)
timevar_push (TV_GRAPHITE_DATA_DEPS);
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), i, pdr1); i++)
- for (j = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), j, pdr2); j++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), i, pdr1)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), j, pdr2)
if (graphite_carried_dependence_level_k (pdr1, pdr2, level))
{
timevar_pop (TV_GRAPHITE_DATA_DEPS);
@@ -825,11 +825,11 @@ dot_original_deps_stmt_1 (FILE *file, scop_p scop)
poly_bb_p pbb1, pbb2;
poly_dr_p pdr1, pdr2;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb1); i++)
- for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2)
{
- for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++)
- for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), k, pdr1)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), l, pdr2)
if (!pddr_is_empty (dependence_polyhedron (pdr1, pdr2, 1, true)))
{
fprintf (file, "OS%d -> OS%d\n",
@@ -850,11 +850,11 @@ dot_transformed_deps_stmt_1 (FILE *file, scop_p scop)
poly_bb_p pbb1, pbb2;
poly_dr_p pdr1, pdr2;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb1); i++)
- for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2)
{
- for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++)
- for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), k, pdr1)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), l, pdr2)
{
poly_ddr_p pddr = dependence_polyhedron (pdr1, pdr2, 1, false);
@@ -898,10 +898,10 @@ dot_original_deps (FILE *file, scop_p scop)
poly_bb_p pbb1, pbb2;
poly_dr_p pdr1, pdr2;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb1); i++)
- for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++)
- for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++)
- for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), k, pdr1)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), l, pdr2)
if (!pddr_is_empty (dependence_polyhedron (pdr1, pdr2, 1, true)))
fprintf (file, "OS%d_D%d -> OS%d_D%d\n",
pbb_index (pbb1), PDR_ID (pdr1),
@@ -918,10 +918,10 @@ dot_transformed_deps (FILE *file, scop_p scop)
poly_bb_p pbb1, pbb2;
poly_dr_p pdr1, pdr2;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb1); i++)
- for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++)
- for (k = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), k, pdr1); k++)
- for (l = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), l, pdr2); l++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), k, pdr1)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), l, pdr2)
{
poly_ddr_p pddr = dependence_polyhedron (pdr1, pdr2, 1, false);
diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
index 2392ce8dcf6..83027d36b21 100644
--- a/gcc/graphite-interchange.c
+++ b/gcc/graphite-interchange.c
@@ -349,11 +349,11 @@ memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, mpz_t strides)
mpz_init (s);
mpz_init (n);
- for (j = 0; VEC_iterate (lst_p, LST_SEQ (loop), j, l); j++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (loop), j, l)
if (LST_LOOP_P (l))
memory_strides_in_loop_1 (l, depth, strides);
else
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (LST_PBB (l)), i, pdr); i++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (LST_PBB (l)), i, pdr)
{
pdr_stride_in_loop (s, depth, pdr);
mpz_set_si (n, PDR_NB_REFS (pdr));
@@ -526,7 +526,7 @@ lst_apply_interchange (lst_p lst, int depth1, int depth2)
int i;
lst_p l;
- for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
lst_apply_interchange (l, depth1, depth2);
}
else
@@ -672,7 +672,7 @@ lst_interchange_select_inner (scop_p scop, lst_p outer_father, int outer,
loop1 = VEC_index (lst_p, LST_SEQ (outer_father), outer);
- for (inner = 0; VEC_iterate (lst_p, LST_SEQ (inner_father), inner, loop2); inner++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (inner_father), inner, loop2)
if (LST_LOOP_P (loop2)
&& (lst_try_interchange_loops (scop, loop1, loop2)
|| lst_interchange_select_inner (scop, outer_father, outer, loop2)))
@@ -708,7 +708,7 @@ lst_interchange_select_outer (scop_p scop, lst_p loop, int outer)
}
if (LST_LOOP_P (loop))
- for (i = 0; VEC_iterate (lst_p, LST_SEQ (loop), i, l); i++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (loop), i, l)
if (LST_LOOP_P (l))
res |= lst_interchange_select_outer (scop, l, i);
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 7d33aa8c4a9..ae6ad4451ae 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -62,7 +62,7 @@ scop_max_loop_depth (scop_p scop)
poly_bb_p pbb;
int max_nb_loops = 0;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
{
int nb_loops = pbb_dim_iter_domain (pbb);
if (max_nb_loops < nb_loops)
@@ -127,10 +127,10 @@ unify_scattering_dimensions (scop_p scop)
poly_bb_p pbb;
graphite_dim_t max_scattering = 0;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
max_scattering = MAX (pbb_nb_scattering_transform (pbb), max_scattering);
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
extend_scattering (pbb, max_scattering);
return max_scattering;
@@ -221,7 +221,7 @@ print_scattering_functions (FILE *file, scop_p scop, int verbosity)
int i;
poly_bb_p pbb;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
print_scattering_function (file, pbb, verbosity);
}
@@ -234,7 +234,7 @@ print_iteration_domains (FILE *file, scop_p scop, int verbosity)
int i;
poly_bb_p pbb;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
print_iteration_domain (file, pbb, verbosity);
}
@@ -342,8 +342,8 @@ pbb_remove_duplicate_pdrs (poly_bb_p pbb)
unsigned n = VEC_length (poly_dr_p, PBB_DRS (pbb));
VEC (poly_dr_p, heap) *collapsed = VEC_alloc (poly_dr_p, heap, n);
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr1); i++)
- for (j = 0; VEC_iterate (poly_dr_p, collapsed, j, pdr2); j++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr1)
+ FOR_EACH_VEC_ELT (poly_dr_p, collapsed, j, pdr2)
if (!can_collapse_pdrs (pdr1, pdr2))
VEC_quick_push (poly_dr_p, collapsed, pdr1);
@@ -422,7 +422,7 @@ free_poly_bb (poly_bb_p pbb)
poly_scattering_free (PBB_ORIGINAL (pbb));
if (PBB_DRS (pbb))
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr)
free_poly_dr (pdr);
VEC_free (poly_dr_p, heap, PBB_DRS (pbb));
@@ -533,7 +533,7 @@ free_scop (scop_p scop)
int i;
poly_bb_p pbb;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
free_poly_bb (pbb);
VEC_free (poly_bb_p, heap, SCOP_BBS (scop));
@@ -600,7 +600,7 @@ dump_gbb_cases (FILE *file, gimple_bb_p gbb)
fprintf (file, "# cases bb_%d (\n", GBB_BB (gbb)->index);
- for (i = 0; VEC_iterate (gimple, cases, i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, cases, i, stmt)
{
fprintf (file, "# ");
print_gimple_stmt (file, stmt, 0, 0);
@@ -627,7 +627,7 @@ dump_gbb_conditions (FILE *file, gimple_bb_p gbb)
fprintf (file, "# conditions bb_%d (\n", GBB_BB (gbb)->index);
- for (i = 0; VEC_iterate (gimple, conditions, i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, conditions, i, stmt)
{
fprintf (file, "# ");
print_gimple_stmt (file, stmt, 0, 0);
@@ -662,7 +662,7 @@ print_pdrs (FILE *file, poly_bb_p pbb, int verbosity)
fprintf (file, "# Access informations are provided\n");
fprintf (file, "1\n");
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr)
if (PDR_TYPE (pdr) == PDR_READ)
nb_reads++;
else
@@ -675,7 +675,7 @@ print_pdrs (FILE *file, poly_bb_p pbb, int verbosity)
fprintf (file, "# Read access informations\n");
fprintf (file, "%d\n", nb_reads);
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr)
if (PDR_TYPE (pdr) == PDR_READ)
print_pdr (file, pdr, verbosity);
@@ -689,7 +689,7 @@ print_pdrs (FILE *file, poly_bb_p pbb, int verbosity)
fprintf (file, "# Write access informations\n");
fprintf (file, "%d\n", nb_writes);
- for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+ FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr)
if (PDR_TYPE (pdr) != PDR_READ)
print_pdr (file, pdr, verbosity);
@@ -784,7 +784,7 @@ print_scop_params (FILE *file, scop_p scop, int verbosity)
fprintf (file, "0\n");
}
- for (i = 0; VEC_iterate (tree, SESE_PARAMS (SCOP_REGION (scop)), i, t); i++)
+ FOR_EACH_VEC_ELT (tree, SESE_PARAMS (SCOP_REGION (scop)), i, t)
{
print_generic_expr (file, t, 0);
fprintf (file, " ");
@@ -841,7 +841,7 @@ print_scop (FILE *file, scop_p scop, int verbosity)
fprintf (file, "%d\n",VEC_length (poly_bb_p, SCOP_BBS (scop)));
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
print_pbb (file, pbb, verbosity);
if (verbosity > 1)
@@ -880,7 +880,7 @@ print_cloog (FILE *file, scop_p scop, int verbosity)
fprintf (file, "%d\n", VEC_length (poly_bb_p, SCOP_BBS (scop)));
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
{
if (verbosity > 1)
fprintf (file, "# pbb_%d (\n", pbb_index (pbb));
@@ -909,7 +909,7 @@ print_cloog (FILE *file, scop_p scop, int verbosity)
fprintf (file, "%d\n", VEC_length (poly_bb_p, SCOP_BBS (scop)));
unify_scattering_dimensions (scop);
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
{
if (!PBB_TRANSFORMED (pbb)
|| !(PBB_TRANSFORMED_SCATTERING (pbb)
@@ -1214,7 +1214,7 @@ print_lst (FILE *file, lst_p lst, int indent)
else
fprintf (file, "#(root");
- for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
print_lst (file, l, indent + 2);
fprintf (file, ")");
@@ -1255,7 +1255,7 @@ dot_lst_1 (FILE *file, lst_p lst)
lst_depth (lst),
lst_dewey_number (lst));
- for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
dot_lst_1 (file, l);
}
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 07d94d02b37..e2847b88be5 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -148,7 +148,7 @@ move_sd_regions (VEC (sd_region, heap) **source,
sd_region *s;
int i;
- for (i = 0; VEC_iterate (sd_region, *source, i, s); i++)
+ FOR_EACH_VEC_ELT (sd_region, *source, i, s)
VEC_safe_push (sd_region, heap, *target, s);
VEC_free (sd_region, heap, *source);
@@ -284,7 +284,7 @@ stmt_has_simple_data_refs_p (loop_p outermost_loop, gimple stmt)
graphite_find_data_references_in_stmt (outermost_loop, stmt, &drs);
- for (j = 0; VEC_iterate (data_reference_p, drs, j, dr); j++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, j, dr)
for (i = 0; i < DR_NUM_DIMENSIONS (dr); i++)
if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i), loop))
{
@@ -552,7 +552,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
- The exit destinations are dominated by another bb inside
the loop.
- The loop dominates bbs, that are not exit destinations. */
- for (i = 0; VEC_iterate (edge, exits, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, e)
if (e->src->loop_father == loop
&& dominated_by_p (CDI_DOMINATORS, e->dest, e->src))
{
@@ -590,7 +590,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
/* First check the successors of BB, and check if it is
possible to join the different branches. */
- for (i = 0; VEC_iterate (edge, bb->succs, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, bb->succs, i, e)
{
/* Ignore loop exits. They will be handled after the loop
body. */
@@ -676,7 +676,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
/* Scan remaining bbs dominated by BB. */
dominated = get_dominated_by (CDI_DOMINATORS, bb);
- for (i = 0; VEC_iterate (basic_block, dominated, i, dom_bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, dominated, i, dom_bb)
{
/* Ignore loop exits: they will be handled after the loop body. */
if (loop_depth (find_common_loop (loop, dom_bb->loop_father))
@@ -990,7 +990,7 @@ unmark_exit_edges (VEC (sd_region, heap) *regions)
edge e;
edge_iterator ei;
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ FOR_EACH_VEC_ELT (sd_region, regions, i, s)
FOR_EACH_EDGE (e, ei, s->exit->preds)
e->aux = NULL;
}
@@ -1007,7 +1007,7 @@ mark_exit_edges (VEC (sd_region, heap) *regions)
edge e;
edge_iterator ei;
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ FOR_EACH_VEC_ELT (sd_region, regions, i, s)
FOR_EACH_EDGE (e, ei, s->exit->preds)
if (bb_in_sd_region (e->src, s))
e->aux = s;
@@ -1021,12 +1021,12 @@ create_sese_edges (VEC (sd_region, heap) *regions)
int i;
sd_region *s;
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ FOR_EACH_VEC_ELT (sd_region, regions, i, s)
create_single_entry_edge (s);
mark_exit_edges (regions);
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ FOR_EACH_VEC_ELT (sd_region, regions, i, s)
/* Don't handle multiple edges exiting the function. */
if (!find_single_exit_edge (s)
&& s->exit != EXIT_BLOCK_PTR)
@@ -1052,7 +1052,7 @@ build_graphite_scops (VEC (sd_region, heap) *regions,
int i;
sd_region *s;
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ FOR_EACH_VEC_ELT (sd_region, regions, i, s)
{
edge entry = find_single_entry_edge (s);
edge exit = find_single_exit_edge (s);
@@ -1070,7 +1070,7 @@ build_graphite_scops (VEC (sd_region, heap) *regions,
int j;
sd_region *s2;
- for (j = 0; VEC_iterate (sd_region, regions, j, s2); j++)
+ FOR_EACH_VEC_ELT (sd_region, regions, j, s2)
if (s != s2)
gcc_assert (!bb_in_sd_region (s->entry, s2));
}
@@ -1159,7 +1159,7 @@ print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
int i;
scop_p scop;
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
print_graphite_scop_statistics (file, scop);
}
@@ -1191,14 +1191,14 @@ limit_scops (VEC (scop_p, heap) **scops)
int i;
scop_p scop;
- for (i = 0; VEC_iterate (scop_p, *scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, *scops, i, scop)
{
int j;
loop_p loop;
sese region = SCOP_REGION (scop);
build_sese_loop_nests (region);
- for (j = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), j, loop); j++)
+ FOR_EACH_VEC_ELT (loop_p, SESE_LOOP_NEST (region), j, loop)
if (!loop_in_sese_p (loop_outer (loop), region)
&& single_exit (loop))
{
@@ -1380,7 +1380,7 @@ dot_all_scops_1 (FILE *file, VEC (scop_p, heap) *scops)
fprintf (file, "CELLSPACING=\"0\">\n");
/* Select color for SCoP. */
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
{
sese region = SCOP_REGION (scop);
if (bb_in_sese_p (bb, region)
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 4b94bcb4e77..0fd6120ced0 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -278,7 +278,7 @@ free_data_refs_aux (VEC (data_reference_p, heap) *datarefs)
unsigned int i;
struct data_reference *dr;
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
if (dr->aux)
{
base_alias_pair *bap = (base_alias_pair *)(dr->aux);
@@ -312,7 +312,7 @@ remove_gbbs_in_scop (scop_p scop)
int i;
poly_bb_p pbb;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
free_gimple_bb (PBB_BLACK_BOX (pbb));
}
@@ -324,7 +324,7 @@ free_scops (VEC (scop_p, heap) *scops)
int i;
scop_p scop;
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
{
remove_gbbs_in_scop (scop);
free_sese (SCOP_REGION (scop));
@@ -434,7 +434,7 @@ build_scop_bbs_1 (scop_p scop, sbitmap visited, basic_block bb, sbitmap reductio
int i;
basic_block dom_bb;
- for (i = 0; VEC_iterate (basic_block, dom, i, dom_bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, dom, i, dom_bb)
if (all_non_dominated_preds_marked_p (dom_bb, visited))
{
build_scop_bbs_1 (scop, visited, dom_bb, reductions);
@@ -616,7 +616,7 @@ build_scop_scattering (scop_p scop)
ppl_assign_Coefficient_from_mpz_t (c, v);
ppl_Linear_Expression_add_to_coefficient (static_schedule, 0, c);
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
{
gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
ppl_Linear_Expression_t common;
@@ -741,7 +741,7 @@ parameter_index_in_region_1 (tree name, sese region)
gcc_assert (TREE_CODE (name) == SSA_NAME);
- for (i = 0; VEC_iterate (tree, SESE_PARAMS (region), i, p); i++)
+ FOR_EACH_VEC_ELT (tree, SESE_PARAMS (region), i, p)
if (p == name)
return i;
@@ -955,12 +955,12 @@ find_params_in_bb (sese region, gimple_bb_p gbb)
mpz_set_si (one, 1);
/* Find parameters in the access functions of data references. */
- for (i = 0; VEC_iterate (data_reference_p, GBB_DATA_REFS (gbb), i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, GBB_DATA_REFS (gbb), i, dr)
for (j = 0; j < DR_NUM_DIMENSIONS (dr); j++)
scan_tree_for_params (region, DR_ACCESS_FN (dr, j), NULL, one);
/* Find parameters in conditional statements. */
- for (i = 0; VEC_iterate (gimple, GBB_CONDITIONS (gbb), i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, GBB_CONDITIONS (gbb), i, stmt)
{
tree lhs = scalar_evolution_in_region (region, loop,
gimple_cond_lhs (stmt));
@@ -990,7 +990,7 @@ find_scop_parameters (scop_p scop)
mpz_set_si (one, 1);
/* Find the parameters used in the loop bounds. */
- for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, SESE_LOOP_NEST (region), i, loop)
{
tree nb_iters = number_of_latch_executions (loop);
@@ -1004,7 +1004,7 @@ find_scop_parameters (scop_p scop)
mpz_clear (one);
/* Find the parameters used in data accesses. */
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
find_params_in_bb (region, PBB_BLACK_BOX (pbb));
scop_set_nb_params (scop, sese_nb_params (region));
@@ -1335,7 +1335,7 @@ add_conditions_to_domain (poly_bb_p pbb)
if (VEC_empty (gimple, GBB_CONDITIONS (gbb)))
return;
- for (i = 0; VEC_iterate (gimple, GBB_CONDITIONS (gbb), i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, GBB_CONDITIONS (gbb), i, stmt)
switch (gimple_code (stmt))
{
case GIMPLE_COND:
@@ -1490,7 +1490,7 @@ add_conditions_to_constraints (scop_p scop)
int i;
poly_bb_p pbb;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
add_conditions_to_domain (pbb);
}
@@ -1586,11 +1586,11 @@ build_scop_iteration_domain (scop_p scop)
ppl_new_C_Polyhedron_from_space_dimension (&ph, scop_nb_params (scop), 0);
- for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, SESE_LOOP_NEST (region), i, loop)
if (!loop_in_sese_p (loop_outer (loop), region))
build_loop_iteration_domains (scop, loop, ph, 0, domains);
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
if (domains[gbb_loop (PBB_BLACK_BOX (pbb))->num])
ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
(&PBB_DOMAIN (pbb), (ppl_const_Pointset_Powerset_C_Polyhedron_t)
@@ -1788,7 +1788,7 @@ write_alias_graph_to_ascii_dimacs (FILE *file, char *comment,
if (num_vertex == 0)
return true;
- for (i = 0; VEC_iterate (data_reference_p, drs, i, dr1); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, i, dr1)
for (j = i + 1; VEC_iterate (data_reference_p, drs, j, dr2); j++)
if (dr_may_alias_p (dr1, dr2))
edge_num++;
@@ -1800,7 +1800,7 @@ write_alias_graph_to_ascii_dimacs (FILE *file, char *comment,
fprintf (file, "p edge %d %d\n", num_vertex, edge_num);
- for (i = 0; VEC_iterate (data_reference_p, drs, i, dr1); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, i, dr1)
for (j = i + 1; VEC_iterate (data_reference_p, drs, j, dr2); j++)
if (dr_may_alias_p (dr1, dr2))
fprintf (file, "e %d %d\n", i + 1, j + 1);
@@ -1827,10 +1827,10 @@ write_alias_graph_to_ascii_dot (FILE *file, char *comment,
fprintf (file, "c %s\n", comment);
/* First print all the vertices. */
- for (i = 0; VEC_iterate (data_reference_p, drs, i, dr1); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, i, dr1)
fprintf (file, "n%d;\n", i);
- for (i = 0; VEC_iterate (data_reference_p, drs, i, dr1); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, i, dr1)
for (j = i + 1; VEC_iterate (data_reference_p, drs, j, dr2); j++)
if (dr_may_alias_p (dr1, dr2))
fprintf (file, "n%d n%d\n", i, j);
@@ -1856,7 +1856,7 @@ write_alias_graph_to_ascii_ecc (FILE *file, char *comment,
if (comment)
fprintf (file, "c %s\n", comment);
- for (i = 0; VEC_iterate (data_reference_p, drs, i, dr1); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, i, dr1)
for (j = i + 1; VEC_iterate (data_reference_p, drs, j, dr2); j++)
if (dr_may_alias_p (dr1, dr2))
fprintf (file, "%d %d\n", i, j);
@@ -1892,7 +1892,7 @@ build_alias_set_optimal_p (VEC (data_reference_p, heap) *drs)
int this_component_is_clique;
int all_components_are_cliques = 1;
- for (i = 0; VEC_iterate (data_reference_p, drs, i, dr1); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, i, dr1)
for (j = i+1; VEC_iterate (data_reference_p, drs, j, dr2); j++)
if (dr_may_alias_p (dr1, dr2))
{
@@ -1972,7 +1972,7 @@ build_base_obj_set_for_drs (VEC (data_reference_p, heap) *drs)
int i, j;
int *queue;
- for (i = 0; VEC_iterate (data_reference_p, drs, i, dr1); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, i, dr1)
for (j = i + 1; VEC_iterate (data_reference_p, drs, j, dr2); j++)
if (dr_same_base_object_p (dr1, dr2))
{
@@ -2010,7 +2010,7 @@ build_pbb_drs (poly_bb_p pbb)
data_reference_p dr;
VEC (data_reference_p, heap) *gbb_drs = GBB_DATA_REFS (PBB_BLACK_BOX (pbb));
- for (j = 0; VEC_iterate (data_reference_p, gbb_drs, j, dr); j++)
+ FOR_EACH_VEC_ELT (data_reference_p, gbb_drs, j, dr)
build_poly_dr (dr, pbb);
}
@@ -2060,12 +2060,12 @@ build_scop_drs (scop_p scop)
data_reference_p dr;
VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 3);
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
for (j = 0; VEC_iterate (data_reference_p,
GBB_DATA_REFS (PBB_BLACK_BOX (pbb)), j, dr); j++)
VEC_safe_push (data_reference_p, heap, drs, dr);
- for (i = 0; VEC_iterate (data_reference_p, drs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, drs, i, dr)
dr->aux = XNEW (base_alias_pair);
if (!build_alias_set_optimal_p (drs))
@@ -2083,7 +2083,7 @@ build_scop_drs (scop_p scop)
VEC_free (data_reference_p, heap, drs);
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
build_pbb_drs (pbb);
}
@@ -2549,7 +2549,7 @@ nb_pbbs_in_loops (scop_p scop)
poly_bb_p pbb;
int res = 0;
- for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb)
if (loop_in_sese_p (gbb_loop (PBB_BLACK_BOX (pbb)), SCOP_REGION (scop)))
res++;
@@ -2862,7 +2862,7 @@ remove_phi (gimple phi)
}
}
- for (i = 0; VEC_iterate (gimple, update, i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, update, i, stmt)
update_stmt (stmt);
VEC_free (gimple, heap, update);
@@ -2890,7 +2890,7 @@ translate_scalar_reduction_to_array (VEC (gimple, heap) *in,
gimple loop_phi;
tree red = NULL_TREE;
- for (i = 0; VEC_iterate (gimple, in, i, loop_phi); i++)
+ FOR_EACH_VEC_ELT (gimple, in, i, loop_phi)
{
gimple close_phi = VEC_index (gimple, out, i);
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 12dbd0c3a1a..6b083d12581 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -192,7 +192,7 @@ print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
scop_p scop;
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
print_graphite_scop_statistics (file, scop);
}
@@ -279,12 +279,12 @@ graphite_transform_loops (void)
reductions = sbitmap_alloc (last_basic_block * 2);
sbitmap_zero (reductions);
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
if (dbg_cnt (graphite_scop))
rewrite_commutative_reductions_out_of_ssa (SCOP_REGION (scop),
reductions);
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
if (dbg_cnt (graphite_scop))
{
rewrite_reductions_out_of_ssa (scop);
@@ -294,11 +294,11 @@ graphite_transform_loops (void)
sbitmap_free (reductions);
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
if (dbg_cnt (graphite_scop))
build_poly_scop (scop);
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
if (POLY_SCOP_P (scop)
&& apply_poly_transforms (scop)
&& gloog (scop, bb_pbb_mapping))
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 1865d45acc1..278768547a8 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -5093,7 +5093,7 @@ calc_priorities (rtx_vec_t roots)
int i;
rtx insn;
- for (i = 0; VEC_iterate (rtx, roots, i, insn); i++)
+ FOR_EACH_VEC_ELT (rtx, roots, i, insn)
priority (insn);
}
@@ -5321,7 +5321,7 @@ sched_scan (const struct sched_scan_info_def *ssi,
unsigned i;
basic_block x;
- for (i = 0; VEC_iterate (basic_block, bbs, i, x); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs, i, x)
init_bb (x);
}
@@ -5336,7 +5336,7 @@ sched_scan (const struct sched_scan_info_def *ssi,
unsigned i;
basic_block x;
- for (i = 0; VEC_iterate (basic_block, bbs, i, x); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs, i, x)
init_insns_in_bb (x);
}
@@ -5348,7 +5348,7 @@ sched_scan (const struct sched_scan_info_def *ssi,
unsigned i;
rtx x;
- for (i = 0; VEC_iterate (rtx, insns, i, x); i++)
+ FOR_EACH_VEC_ELT (rtx, insns, i, x)
init_insn (x);
}
@@ -5478,7 +5478,7 @@ haifa_finish_h_i_d (void)
haifa_insn_data_t data;
struct reg_use_data *use, *next;
- for (i = 0; VEC_iterate (haifa_insn_data_def, h_i_d, i, data); i++)
+ FOR_EACH_VEC_ELT (haifa_insn_data_def, h_i_d, i, data)
{
if (data->reg_pressure != NULL)
free (data->reg_pressure);
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index c0123aae527..9ac4b13caa7 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2760,7 +2760,7 @@ cond_move_process_if_block (struct noce_if_info *if_info)
source register does not change after the assignment. Also count
the number of registers set in only one of the blocks. */
c = 0;
- for (i = 0; VEC_iterate (int, then_regs, i, reg); i++)
+ FOR_EACH_VEC_ELT (int, then_regs, i, reg)
{
if (!then_vals[reg] && !else_vals[reg])
continue;
@@ -2781,7 +2781,7 @@ cond_move_process_if_block (struct noce_if_info *if_info)
}
/* Finish off c for MAX_CONDITIONAL_EXECUTE. */
- for (i = 0; VEC_iterate (int, else_regs, i, reg); ++i)
+ FOR_EACH_VEC_ELT (int, else_regs, i, reg)
if (!then_vals[reg])
++c;
diff --git a/gcc/implicit-zee.c b/gcc/implicit-zee.c
index e2716d305a7..a96dadd3035 100644
--- a/gcc/implicit-zee.c
+++ b/gcc/implicit-zee.c
@@ -727,7 +727,7 @@ combine_reaching_defs (rtx zero_extend_insn, rtx set_pat)
in this vector. */
vec = VEC_alloc (rtx, heap, 8);
- for (defs_ix = 0; VEC_iterate (rtx, defs_list, defs_ix, def_insn); defs_ix++)
+ FOR_EACH_VEC_ELT (rtx, defs_list, defs_ix, def_insn)
{
merge_code = get_insn_status (def_insn);
gcc_assert (merge_code == MERGE_NOT_ATTEMPTED);
@@ -746,7 +746,7 @@ combine_reaching_defs (rtx zero_extend_insn, rtx set_pat)
if (merge_successful)
{
- for (i = 0; VEC_iterate (rtx, copies_list, i, def_insn); i++)
+ FOR_EACH_VEC_ELT (rtx, copies_list, i, def_insn)
{
if (transform_ifelse (def_insn))
{
@@ -773,7 +773,7 @@ combine_reaching_defs (rtx zero_extend_insn, rtx set_pat)
if (dump_file)
fprintf (dump_file, "All merges were successful ....\n");
- for (i = 0; VEC_iterate (rtx, vec, i, def_insn); i++)
+ FOR_EACH_VEC_ELT (rtx, vec, i, def_insn)
{
set_insn_status (def_insn, MERGE_SUCCESS);
}
@@ -791,7 +791,7 @@ combine_reaching_defs (rtx zero_extend_insn, rtx set_pat)
if (dump_file)
{
- for (i = 0; VEC_iterate (rtx, vec, i, def_insn); i++)
+ FOR_EACH_VEC_ELT (rtx, vec, i, def_insn)
{
fprintf (dump_file, " Ummergable definitions : \n");
print_rtl_single (dump_file, def_insn);
@@ -916,7 +916,7 @@ find_and_remove_ze (void)
zeinsn_list = find_removable_zero_extends ();
- for (ix = 0; VEC_iterate (rtx, zeinsn_list, ix, curr_insn); ix++)
+ FOR_EACH_VEC_ELT (rtx, zeinsn_list, ix, curr_insn)
{
num_ze_opportunities++;
/* Try to combine the zero-extends with the definition here. */
@@ -937,7 +937,7 @@ find_and_remove_ze (void)
}
/* Delete all useless zero extensions here in one sweep. */
- for (ix = 0; VEC_iterate (rtx, zeinsn_del_list, ix, curr_insn); ix++)
+ FOR_EACH_VEC_ELT (rtx, zeinsn_del_list, ix, curr_insn)
delete_insn (curr_insn);
free (is_insn_merge_attempted);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 9d7df075292..83fdeaed09f 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1672,9 +1672,7 @@ ipa_free_all_edge_args (void)
int i;
struct ipa_edge_args *args;
- for (i = 0;
- VEC_iterate (ipa_edge_args_t, ipa_edge_args_vector, i, args);
- i++)
+ FOR_EACH_VEC_ELT (ipa_edge_args_t, ipa_edge_args_vector, i, args)
ipa_free_edge_args_substructures (args);
VEC_free (ipa_edge_args_t, gc, ipa_edge_args_vector);
@@ -1701,9 +1699,7 @@ ipa_free_all_node_params (void)
int i;
struct ipa_node_params *info;
- for (i = 0;
- VEC_iterate (ipa_node_params_t, ipa_node_params_vector, i, info);
- i++)
+ FOR_EACH_VEC_ELT (ipa_node_params_t, ipa_node_params_vector, i, info)
ipa_free_node_params_substructures (info);
VEC_free (ipa_node_params_t, heap, ipa_node_params_vector);
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index 6f62b703c5e..d787a66c1c2 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -556,7 +556,7 @@ finalize_new_vars_creation (void **slot, void *data ATTRIBUTE_UNUSED)
unsigned i;
tree var;
- for (i = 0; VEC_iterate (tree, n_var->new_vars, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, n_var->new_vars, i, var)
finalize_var_creation (var);
return 1;
}
@@ -570,7 +570,7 @@ find_var_in_new_vars_vec (new_var var, tree new_type)
tree n_var;
unsigned i;
- for (i = 0; VEC_iterate (tree, var->new_vars, i, n_var); i++)
+ FOR_EACH_VEC_ELT (tree, var->new_vars, i, n_var)
{
tree type = strip_type(get_type_of_var (n_var));
gcc_assert (type);
@@ -786,7 +786,7 @@ is_part_of_malloc (gimple stmt, tree fn_decl)
alloc_site_t *call;
unsigned i;
- for (i = 0; VEC_iterate (alloc_site_t, fallocs->allocs, i, call); i++)
+ FOR_EACH_VEC_ELT (alloc_site_t, fallocs->allocs, i, call)
if (call->stmt == stmt
|| get_final_alloc_stmt (call->stmt) == stmt)
return true;
@@ -1065,7 +1065,7 @@ find_structure (tree type)
type = TYPE_MAIN_VARIANT (type);
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
if (is_equal_types (str->decl, type))
return i;
@@ -1259,7 +1259,7 @@ create_new_stmts_for_cond_expr (gimple stmt)
arg = integer_zerop (arg0) ? arg1 : arg0;
pos = integer_zerop (arg0) ? 1 : 0;
- for (i = 0; VEC_iterate (tree, str->new_types, i, type); i++)
+ FOR_EACH_VEC_ELT (tree, str->new_types, i, type)
{
tree new_arg;
@@ -1313,7 +1313,7 @@ create_general_new_stmt (struct access_site *acc, tree new_type)
gimple_set_vdef (new_stmt, NULL_TREE);
}
- for (i = 0; VEC_iterate (tree, acc->vars, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, acc->vars, i, var)
{
tree new_var = find_new_var_of_type (var, new_type);
tree lhs, rhs = NULL_TREE;
@@ -1366,7 +1366,7 @@ create_new_stmts_for_general_acc (struct access_site *acc, d_str str)
gimple stmt = acc->stmt;
unsigned i;
- for (i = 0; VEC_iterate (tree, str->new_types, i, type); i++)
+ FOR_EACH_VEC_ELT (tree, str->new_types, i, type)
{
gimple new_stmt;
@@ -1475,7 +1475,7 @@ update_varpool_with_new_var (void **slot, void *data ATTRIBUTE_UNUSED)
tree var;
unsigned i;
- for (i = 0; VEC_iterate (tree, n_var->new_vars, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, n_var->new_vars, i, var)
insert_global_to_varpool (var);
return 1;
}
@@ -1566,7 +1566,7 @@ add_unsuitable_type (VEC (tree, heap) **unsuitable_types, tree type)
type = TYPE_MAIN_VARIANT (type);
- for (i = 0; VEC_iterate (tree, *unsuitable_types, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, *unsuitable_types, i, t)
if (is_equal_types (t, type))
break;
@@ -2088,7 +2088,7 @@ dump_acc (void **slot, void *data ATTRIBUTE_UNUSED)
print_gimple_stmt (dump_file, acc->stmt, 0, 0);
fprintf(dump_file, " : ");
- for (i = 0; VEC_iterate (tree, acc->vars, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, acc->vars, i, var)
{
print_generic_expr (dump_file, var, 0);
fprintf(dump_file, ", ");
@@ -2155,7 +2155,7 @@ create_new_accesses_in_bb (basic_block bb)
d_str str;
unsigned i;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
create_new_accs_for_struct (str, bb);
}
@@ -2168,7 +2168,7 @@ create_new_alloc_sites (fallocs_t m_data, tree context)
alloc_site_t *call;
unsigned j;
- for (j = 0; VEC_iterate (alloc_site_t, m_data->allocs, j, call); j++)
+ FOR_EACH_VEC_ELT (alloc_site_t, m_data->allocs, j, call)
{
gimple stmt = call->stmt;
d_str str = call->str;
@@ -2187,7 +2187,7 @@ create_new_alloc_sites (fallocs_t m_data, tree context)
}
/* Generate an allocation sites for each new structure type. */
- for (i = 0; VEC_iterate (tree, str->new_types, i, type); i++)
+ FOR_EACH_VEC_ELT (tree, str->new_types, i, type)
{
gimple new_malloc_stmt = NULL;
gimple last_stmt_tmp = NULL;
@@ -2646,7 +2646,7 @@ free_structures (void)
d_str str;
unsigned i;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
free_data_struct (str);
VEC_free (structure, heap, structures);
@@ -2874,7 +2874,7 @@ exclude_escaping_types_1 (VEC (tree, heap) **unsuitable_types)
d_str str;
unsigned i;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
check_type_escape (str, unsuitable_types);
}
@@ -3355,8 +3355,8 @@ remove_unsuitable_types (VEC (tree, heap) *unsuitable_types)
tree type;
unsigned i, j;
- for (j = 0; VEC_iterate (tree, unsuitable_types, j, type); j++)
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (tree, unsuitable_types, j, type)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
if (is_equal_types (str->decl, type))
{
remove_structure (i);
@@ -3375,7 +3375,7 @@ exclude_types_with_bit_fields (VEC (tree, heap) **unsuitable_types)
d_str str;
unsigned i;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
check_bitfields (str, unsuitable_types);
}
@@ -3406,7 +3406,7 @@ analyze_struct_form (VEC (tree, heap) **unsuitable_types)
d_str str;
unsigned i;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
check_struct_form (str, unsuitable_types);
}
@@ -3580,7 +3580,7 @@ dump_accesses (void)
if (!dump_file)
return;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
dump_accs (str);
}
@@ -3618,7 +3618,7 @@ exclude_alloc_and_field_accs (struct cgraph_node *node)
d_str str;
unsigned i;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
exclude_alloc_and_field_accs_1 (str, node);
}
@@ -3783,7 +3783,7 @@ dump_new_types (void)
fprintf (dump_file, "\nThe following are the new types generated by"
" this optimization:\n");
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
{
if (dump_file)
{
@@ -3792,7 +3792,7 @@ dump_new_types (void)
fprintf (dump_file, "\nthe number of new types is %d\n",
VEC_length (tree, str->new_types));
}
- for (j = 0; VEC_iterate (tree, str->new_types, j, type); j++)
+ FOR_EACH_VEC_ELT (tree, str->new_types, j, type)
dump_struct_type (type, 2, 0);
}
}
@@ -3806,7 +3806,7 @@ create_new_types (void)
unsigned i;
int str_num = 0;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
create_new_type (str, &str_num);
}
@@ -3911,7 +3911,7 @@ exclude_cold_structs (void)
d_str str;
/* We summarize counts of fields of a structure into the structure count. */
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
sum_counts (str, &hottest);
/* Remove cold structures from structures vector. */
@@ -3940,7 +3940,7 @@ peel_structs (void)
d_str str;
unsigned i;
- for (i = 0; VEC_iterate (structure, structures, i, str); i++)
+ FOR_EACH_VEC_ELT (structure, structures, i, str)
peel_hot_fields (str);
}
diff --git a/gcc/ipa.c b/gcc/ipa.c
index bac3406be39..be5c4a31e92 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -658,7 +658,7 @@ function_and_variable_visibility (bool whole_program)
alias_pair *p;
/* Discover aliased nodes. */
- for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++)
+ FOR_EACH_VEC_ELT (alias_pair, alias_pairs, i, p)
{
if (dump_file)
fprintf (dump_file, "Alias %s->%s",
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 1d3021b342c..00ddcb70ceb 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -127,7 +127,7 @@ create_loop_tree_nodes (bool loops_p)
ira_allocate (sizeof (struct ira_loop_tree_node)
* VEC_length (loop_p, ira_loops.larray)));
max_regno = max_reg_num ();
- for (i = 0; VEC_iterate (loop_p, ira_loops.larray, i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, ira_loops.larray, i, loop)
{
if (loop != ira_loops.tree_root)
{
@@ -145,7 +145,7 @@ create_loop_tree_nodes (bool loops_p)
if (skip_p)
continue;
edges = get_loop_exit_edges (loop);
- for (j = 0; VEC_iterate (edge, edges, j, e); j++)
+ FOR_EACH_VEC_ELT (edge, edges, j, e)
if ((e->flags & EDGE_ABNORMAL) && EDGE_CRITICAL_P (e))
{
skip_p = true;
@@ -176,7 +176,7 @@ more_one_region_p (void)
unsigned int i;
loop_p loop;
- for (i = 0; VEC_iterate (loop_p, ira_loops.larray, i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, ira_loops.larray, i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL
&& ira_loop_tree_root != &ira_loop_nodes[i])
return true;
@@ -206,7 +206,7 @@ finish_loop_tree_nodes (void)
unsigned int i;
loop_p loop;
- for (i = 0; VEC_iterate (loop_p, ira_loops.larray, i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, ira_loops.larray, i, loop)
finish_loop_tree_node (&ira_loop_nodes[i]);
ira_free (ira_loop_nodes);
for (i = 0; i < (unsigned int) last_basic_block_before_change; i++)
@@ -309,7 +309,7 @@ form_loop_tree (void)
/* We can not use loop/bb node access macros because of potential
checking and because the nodes are not initialized enough
yet. */
- for (i = 0; VEC_iterate (loop_p, ira_loops.larray, i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, ira_loops.larray, i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
{
ira_loop_nodes[i].children = NULL;
@@ -355,7 +355,7 @@ rebuild_regno_allocno_maps (void)
ira_allocno_iterator ai;
max_regno = max_reg_num ();
- for (l = 0; VEC_iterate (loop_p, ira_loops.larray, l, loop); l++)
+ FOR_EACH_VEC_ELT (loop_p, ira_loops.larray, l, loop)
if (ira_loop_nodes[l].regno_allocno_map != NULL)
{
ira_free (ira_loop_nodes[l].regno_allocno_map);
@@ -1615,7 +1615,7 @@ create_loop_tree_node_allocnos (ira_loop_tree_node_t loop_node)
create_loop_allocnos (e);
edges = get_loop_exit_edges (loop_node->loop);
- for (i = 0; VEC_iterate (edge, edges, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, edges, i, e)
create_loop_allocnos (e);
VEC_free (edge, heap, edges);
}
@@ -1875,7 +1875,7 @@ mark_all_loops_for_removal (void)
int i;
loop_p loop;
- for (i = 0; VEC_iterate (loop_p, ira_loops.larray, i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, ira_loops.larray, i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
{
if (ira_loop_nodes[i].parent == NULL)
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index e26eb71fb97..8360735f92d 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -1113,7 +1113,7 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
else
{
edges = get_loop_exit_edges (loop_node->loop);
- for (i = 0; VEC_iterate (edge, edges, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, edges, i, e)
if (regno < 0
|| (bitmap_bit_p (DF_LR_OUT (e->src), regno)
&& bitmap_bit_p (DF_LR_IN (e->dest), regno)))
diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index 51f79d75545..7221e444b0d 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -323,7 +323,7 @@ setup_entered_from_non_parent_p (void)
unsigned int i;
loop_p loop;
- for (i = 0; VEC_iterate (loop_p, ira_loops.larray, i, loop); i++)
+ FOR_EACH_VEC_ELT (loop_p, ira_loops.larray, i, loop)
if (ira_loop_nodes[i].regno_allocno_map != NULL)
ira_loop_nodes[i].entered_from_non_parent_p
= entered_from_non_parent_p (&ira_loop_nodes[i]);
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index d0da14b3b69..d45aa33c7b3 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-20 Nathan Froyd <froydnj@codesourcery.com>
+
+ * class.c: Use FOR_EACH_VEC_ELT.
+ * expr.c: Likewise.
+ * jcf-parse.c: Likewise.
+ * resource.c: Likewise.
+
2010-08-16 Joseph Myers <joseph@codesourcery.com>
* lang.opt (MD_, MMD_, version): Mark RejectDriver.
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 6ce8b85662e..ece261b8dd3 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1544,9 +1544,7 @@ make_method_value (tree mdecl)
e = VEC_index (constructor_elt, v, idx--);
e->value = null_pointer_node;
- for (ix = 0;
- VEC_iterate (tree, DECL_FUNCTION_THROWS (mdecl), ix, t);
- ix++)
+ FOR_EACH_VEC_ELT (tree, DECL_FUNCTION_THROWS (mdecl), ix, t)
{
tree sig = DECL_NAME (TYPE_NAME (t));
tree utf8
@@ -2762,7 +2760,7 @@ emit_indirect_register_classes (tree *list_p)
VAR_DECL, get_identifier ("_Jv_CLS"),
class_array_type);
tree reg_class_list;
- for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
+ FOR_EACH_VEC_ELT (tree, registered_class, i, klass)
{
t = fold_convert (ptr_type_node, build_static_class_ref (klass));
CONSTRUCTOR_APPEND_ELT (init, NULL_TREE, t);
@@ -2834,7 +2832,7 @@ emit_register_classes (tree *list_p)
#endif
assemble_align (POINTER_SIZE);
- for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
+ FOR_EACH_VEC_ELT (tree, registered_class, i, klass)
{
t = build_fold_addr_expr (klass);
output_constant (t, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE);
@@ -2852,7 +2850,7 @@ emit_register_classes (tree *list_p)
DECL_EXTERNAL (t) = 1;
register_class_fn = t;
- for (i = 0; VEC_iterate (tree, registered_class, i, klass); ++i)
+ FOR_EACH_VEC_ELT (tree, registered_class, i, klass)
{
t = build_fold_addr_expr (klass);
t = build_call_expr (register_class_fn, 1, t);
@@ -2928,7 +2926,7 @@ emit_symbol_table (tree name, tree the_table,
return the_table;
/* Build a list of _Jv_MethodSymbols for each entry in otable_methods. */
- for (index = 0; VEC_iterate (method_entry, decl_table, index, e); index++)
+ FOR_EACH_VEC_ELT (method_entry, decl_table, index, e)
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_symbol_entry (e->method, e->special));
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 3c987c5fe82..9f9667fa88a 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -2296,7 +2296,7 @@ get_symbol_table_index (tree t, tree special,
method_entry *e;
unsigned i;
- for (i = 0; VEC_iterate (method_entry, *symbol_table, i, e); i++)
+ FOR_EACH_VEC_ELT (method_entry, *symbol_table, i, e)
if (t == e->method && special == e->special)
goto done;
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index c27d4b553d8..cb486ae111e 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -1683,7 +1683,7 @@ predefined_filename_p (tree node)
unsigned ix;
tree f;
- for (ix = 0; VEC_iterate (tree, predefined_filenames, ix, f); ix++)
+ FOR_EACH_VEC_ELT (tree, predefined_filenames, ix, f)
if (f == node)
return 1;
@@ -1869,7 +1869,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
}
current_jcf = main_jcf;
- for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
+ FOR_EACH_VEC_ELT (tree, current_file_list, ix, node)
{
unsigned char magic_string[4];
char *real_path;
@@ -1956,7 +1956,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
}
}
- for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
+ FOR_EACH_VEC_ELT (tree, current_file_list, ix, node)
{
input_location = DECL_SOURCE_LOCATION (node);
if (CLASS_FILE_P (node))
diff --git a/gcc/java/resource.c b/gcc/java/resource.c
index d96d2d8d362..f954024fde1 100644
--- a/gcc/java/resource.c
+++ b/gcc/java/resource.c
@@ -107,7 +107,7 @@ write_resource_constructor (tree *list_p)
register_resource_fn = t;
/* Write out entries in the same order in which they were defined. */
- for (ix = 0; VEC_iterate (tree, resources, ix, decl); ix++)
+ FOR_EACH_VEC_ELT (tree, resources, ix, decl)
{
t = build_fold_addr_expr (decl);
t = build_call_expr (register_resource_fn, 1, t);
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 4a291935fbf..6236235f0d0 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1167,7 +1167,7 @@ gcc_tree_to_linear_expression (int depth, tree expr,
{
tree iv, invar;
size_t i;
- for (i = 0; VEC_iterate (tree, outerinductionvars, i, iv); i++)
+ FOR_EACH_VEC_ELT (tree, outerinductionvars, i, iv)
if (iv != NULL)
{
if (SSA_NAME_VAR (iv) == SSA_NAME_VAR (expr))
@@ -1181,7 +1181,7 @@ gcc_tree_to_linear_expression (int depth, tree expr,
LLE_DENOMINATOR (lle) = 1;
}
}
- for (i = 0; VEC_iterate (tree, invariants, i, invar); i++)
+ FOR_EACH_VEC_ELT (tree, invariants, i, invar)
if (invar != NULL)
{
if (SSA_NAME_VAR (invar) == SSA_NAME_VAR (expr))
@@ -1542,7 +1542,7 @@ gcc_loopnest_to_lambda_loopnest (struct loop *loop_nest,
ret = lambda_loopnest_new (depth, 2 * depth, lambda_obstack);
- for (i = 0; VEC_iterate (lambda_loop, loops, i, newloop); i++)
+ FOR_EACH_VEC_ELT (lambda_loop, loops, i, newloop)
LN_LOOPS (ret)[i] = newloop;
fail:
@@ -1837,7 +1837,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
/* Rewrite uses of the old ivs so that they are now specified in terms of
the new ivs. */
- for (i = 0; VEC_iterate (tree, old_ivs, i, oldiv); i++)
+ FOR_EACH_VEC_ELT (tree, old_ivs, i, oldiv)
{
imm_use_iterator imm_iter;
use_operand_p use_p;
@@ -2641,7 +2641,7 @@ lambda_transform_legal_p (lambda_trans_matrix trans,
distres = lambda_vector_new (nb_loops);
/* For each distance vector in the dependence graph. */
- for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, dependence_relations, i, ddr)
{
/* Don't care about relations for which we know that there is no
dependence, nor about read-read (aka. output-dependences):
@@ -2710,7 +2710,7 @@ lambda_collect_parameters (VEC (data_reference_p, heap) *datarefs,
struct pointer_set_t *parameter_set = pointer_set_create ();
data_reference_p data_reference;
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, data_reference); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, data_reference)
for (j = 0; j < DR_NUM_DIMENSIONS (data_reference); j++)
lambda_collect_parameters_from_af (DR_ACCESS_FN (data_reference, j),
parameter_set, parameters);
@@ -2862,7 +2862,7 @@ lambda_compute_access_matrices (VEC (data_reference_p, heap) *datarefs,
data_reference_p dataref;
unsigned ix;
- for (ix = 0; VEC_iterate (data_reference_p, datarefs, ix, dataref); ix++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, ix, dataref)
if (!build_access_matrix (dataref, parameters, nest, lambda_obstack))
return false;
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index cf427c3c5ed..77fd4aef6f1 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -536,7 +536,7 @@ merge_identical_invariants (void)
htab_t eq = htab_create (VEC_length (invariant_p, invariants),
hash_invariant_expr, eq_invariant_expr, free);
- for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++)
+ FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv)
find_identical_invariants (eq, inv);
htab_delete (eq);
@@ -1254,7 +1254,7 @@ best_gain_for_invariant (struct invariant **best, unsigned *regs_needed,
int i, gain = 0, again;
unsigned aregs_needed[N_REG_CLASSES], invno;
- for (invno = 0; VEC_iterate (invariant_p, invariants, invno, inv); invno++)
+ FOR_EACH_VEC_ELT (invariant_p, invariants, invno, inv)
{
if (inv->move)
continue;
@@ -1508,11 +1508,11 @@ move_invariants (struct loop *loop)
struct invariant *inv;
unsigned i;
- for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++)
+ FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv)
move_invariant_reg (loop, i);
if (flag_ira_loop_pressure && resize_reg_info ())
{
- for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++)
+ FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv)
if (inv->reg != NULL_RTX)
{
if (inv->orig_regno >= 0)
@@ -1561,7 +1561,7 @@ free_inv_motion_data (void)
}
}
- for (i = 0; VEC_iterate (invariant_p, invariants, i, inv); i++)
+ FOR_EACH_VEC_ELT (invariant_p, invariants, i, inv)
{
BITMAP_FREE (inv->depends_on);
free (inv);
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 8ea449d6bb7..47bfa05e1fa 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -501,7 +501,7 @@ peel_loop_completely (struct loop *loop)
}
/* Remove the exit edges. */
- for (i = 0; VEC_iterate (edge, remove_edges, i, ein); i++)
+ FOR_EACH_VEC_ELT (edge, remove_edges, i, ein)
remove_path (ein);
VEC_free (edge, heap, remove_edges);
}
@@ -789,7 +789,7 @@ unroll_loop_constant_iterations (struct loop *loop)
desc->niter_expr = GEN_INT (desc->niter);
/* Remove the edges. */
- for (i = 0; VEC_iterate (edge, remove_edges, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, remove_edges, i, e)
remove_path (e);
VEC_free (edge, heap, remove_edges);
@@ -992,7 +992,7 @@ unroll_loop_runtime_iterations (struct loop *loop)
basic_block bb;
ldom = get_dominated_by (CDI_DOMINATORS, body[i]);
- for (j = 0; VEC_iterate (basic_block, ldom, j, bb); j++)
+ FOR_EACH_VEC_ELT (basic_block, ldom, j, bb)
if (!flow_bb_inside_loop_p (loop, bb))
VEC_safe_push (basic_block, heap, dom_bbs, bb);
@@ -1161,7 +1161,7 @@ unroll_loop_runtime_iterations (struct loop *loop)
}
/* Remove the edges. */
- for (i = 0; VEC_iterate (edge, remove_edges, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, remove_edges, i, e)
remove_path (e);
VEC_free (edge, heap, remove_edges);
@@ -2124,7 +2124,7 @@ insert_var_expansion_initialization (struct var_to_expand *ve,
start_sequence ();
if (ve->op == PLUS || ve->op == MINUS)
- for (i = 0; VEC_iterate (rtx, ve->var_expansions, i, var); i++)
+ FOR_EACH_VEC_ELT (rtx, ve->var_expansions, i, var)
{
if (honor_signed_zero_p)
zero_init = simplify_gen_unary (NEG, mode, CONST0_RTX (mode), mode);
@@ -2134,7 +2134,7 @@ insert_var_expansion_initialization (struct var_to_expand *ve,
emit_move_insn (var, zero_init);
}
else if (ve->op == MULT)
- for (i = 0; VEC_iterate (rtx, ve->var_expansions, i, var); i++)
+ FOR_EACH_VEC_ELT (rtx, ve->var_expansions, i, var)
{
zero_init = CONST1_RTX (GET_MODE (var));
emit_move_insn (var, zero_init);
@@ -2166,13 +2166,13 @@ combine_var_copies_in_loop_exit (struct var_to_expand *ve, basic_block place)
start_sequence ();
if (ve->op == PLUS || ve->op == MINUS)
- for (i = 0; VEC_iterate (rtx, ve->var_expansions, i, var); i++)
+ FOR_EACH_VEC_ELT (rtx, ve->var_expansions, i, var)
{
sum = simplify_gen_binary (PLUS, GET_MODE (ve->reg),
var, sum);
}
else if (ve->op == MULT)
- for (i = 0; VEC_iterate (rtx, ve->var_expansions, i, var); i++)
+ FOR_EACH_VEC_ELT (rtx, ve->var_expansions, i, var)
{
sum = simplify_gen_binary (MULT, GET_MODE (ve->reg),
var, sum);
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 6876f0991ee..0569c05a060 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1312,7 +1312,7 @@ decompose_multiword_subregs (void)
unsigned int i;
bitmap b;
- for (i = 0; VEC_iterate (bitmap, reg_copy_graph, i, b); ++i)
+ FOR_EACH_VEC_ELT (bitmap, reg_copy_graph, i, b)
if (b)
BITMAP_FREE (b);
}
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 9c7af2ba507..9bd0f70d0e7 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1268,7 +1268,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
len = lto_input_uleb128 (ib);
}
- for (i = 0; VEC_iterate (cgraph_node_ptr, nodes, i, node); i++)
+ FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
{
int ref = (int) (intptr_t) node->global.inlined_to;
@@ -1307,7 +1307,7 @@ input_varpool_1 (struct lto_file_decl_data *file_data,
input_varpool_node (file_data, ib));
len--;
}
- for (i = 0; VEC_iterate (varpool_node_ptr, varpool, i, node); i++)
+ FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
{
int ref = (int) (intptr_t) node->same_comdat_group;
@@ -1481,7 +1481,7 @@ output_node_opt_summary (struct output_block *ob,
lto_output_uleb128_stream (ob->main_stream, index);
lto_output_uleb128_stream (ob->main_stream,
VEC_length (ipa_replace_map_p, node->clone.tree_map));
- for (i = 0; VEC_iterate (ipa_replace_map_p, node->clone.tree_map, i, map); i++)
+ FOR_EACH_VEC_ELT (ipa_replace_map_p, node->clone.tree_map, i, map)
{
int parm_num;
tree parm;
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index bff03259141..3666b17fc94 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -128,7 +128,7 @@ clear_options (VEC(opt_t, heap) **opts_p)
int i;
opt_t *o;
- for (i = 0; VEC_iterate (opt_t, *opts_p, i, o); i++)
+ FOR_EACH_VEC_ELT (opt_t, *opts_p, i, o)
free (o->arg);
VEC_free (opt_t, heap, *opts_p);
@@ -278,7 +278,7 @@ output_options (struct lto_output_stream *stream)
output_data_stream (stream, &length, sizeof (length));
- for (i = 0; VEC_iterate (opt_t, opts, i, o); i++)
+ FOR_EACH_VEC_ELT (opt_t, opts, i, o)
{
output_data_stream (stream, &o->type, sizeof (o->type));
output_data_stream (stream, &o->code, sizeof (o->code));
@@ -397,7 +397,7 @@ lto_reissue_options (void)
int i;
opt_t *o;
- for (i = 0; VEC_iterate (opt_t, opts, i, o); i++)
+ FOR_EACH_VEC_ELT (opt_t, opts, i, o)
{
const struct cl_option *option = &cl_options[o->code];
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 3451b84c076..9ee15108fae 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -539,7 +539,7 @@ fixup_eh_region_pointers (struct function *fn, HOST_WIDE_INT root_region)
/* Convert all the index numbers stored in pointer fields into
pointers to the corresponding slots in the EH region array. */
- for (i = 0; VEC_iterate (eh_region, eh_array, i, r); i++)
+ FOR_EACH_VEC_ELT (eh_region, eh_array, i, r)
{
/* The array may contain NULL regions. */
if (r == NULL)
@@ -554,7 +554,7 @@ fixup_eh_region_pointers (struct function *fn, HOST_WIDE_INT root_region)
/* Convert all the index numbers stored in pointer fields into
pointers to the corresponding slots in the EH landing pad array. */
- for (i = 0; VEC_iterate (eh_landing_pad, lp_array, i, lp); i++)
+ FOR_EACH_VEC_ELT (eh_landing_pad, lp_array, i, lp)
{
/* The array may contain NULL landing pads. */
if (lp == NULL)
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 562e934baba..e00fd865e50 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1042,7 +1042,7 @@ lto_output_ts_block_tree_pointers (struct output_block *ob, tree expr,
lto_output_chain (ob, BLOCK_VARS (expr), ref_p);
output_uleb128 (ob, VEC_length (tree, BLOCK_NONLOCALIZED_VARS (expr)));
- for (i = 0; VEC_iterate (tree, BLOCK_NONLOCALIZED_VARS (expr), i, t); i++)
+ FOR_EACH_VEC_ELT (tree, BLOCK_NONLOCALIZED_VARS (expr), i, t)
lto_output_tree_or_ref (ob, t, ref_p);
lto_output_tree_or_ref (ob, BLOCK_SUPERCONTEXT (expr), ref_p);
@@ -1067,7 +1067,7 @@ lto_output_ts_binfo_tree_pointers (struct output_block *ob, tree expr,
/* Note that the number of BINFO slots has already been emitted in
EXPR's header (see lto_output_tree_header) because this length
is needed to build the empty BINFO node on the reader side. */
- for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (expr), i, t); i++)
+ FOR_EACH_VEC_ELT (tree, BINFO_BASE_BINFOS (expr), i, t)
lto_output_tree_or_ref (ob, t, ref_p);
output_zero (ob);
@@ -1077,7 +1077,7 @@ lto_output_ts_binfo_tree_pointers (struct output_block *ob, tree expr,
lto_output_tree_or_ref (ob, BINFO_VPTR_FIELD (expr), ref_p);
output_uleb128 (ob, VEC_length (tree, BINFO_BASE_ACCESSES (expr)));
- for (i = 0; VEC_iterate (tree, BINFO_BASE_ACCESSES (expr), i, t); i++)
+ FOR_EACH_VEC_ELT (tree, BINFO_BASE_ACCESSES (expr), i, t)
lto_output_tree_or_ref (ob, t, ref_p);
lto_output_tree_or_ref (ob, BINFO_INHERITANCE_CHAIN (expr), ref_p);
@@ -1508,17 +1508,17 @@ output_eh_regions (struct output_block *ob, struct function *fn)
/* Emit all the EH regions in the region array. */
output_sleb128 (ob, VEC_length (eh_region, fn->eh->region_array));
- for (i = 0; VEC_iterate (eh_region, fn->eh->region_array, i, eh); i++)
+ FOR_EACH_VEC_ELT (eh_region, fn->eh->region_array, i, eh)
output_eh_region (ob, eh);
/* Emit all landing pads. */
output_sleb128 (ob, VEC_length (eh_landing_pad, fn->eh->lp_array));
- for (i = 0; VEC_iterate (eh_landing_pad, fn->eh->lp_array, i, lp); i++)
+ FOR_EACH_VEC_ELT (eh_landing_pad, fn->eh->lp_array, i, lp)
output_eh_lp (ob, lp);
/* Emit all the runtime type data. */
output_sleb128 (ob, VEC_length (tree, fn->eh->ttype_data));
- for (i = 0; VEC_iterate (tree, fn->eh->ttype_data, i, ttype); i++)
+ FOR_EACH_VEC_ELT (tree, fn->eh->ttype_data, i, ttype)
lto_output_tree_ref (ob, ttype);
/* Emit the table of action chains. */
@@ -1526,16 +1526,14 @@ output_eh_regions (struct output_block *ob, struct function *fn)
{
tree t;
output_sleb128 (ob, VEC_length (tree, fn->eh->ehspec_data.arm_eabi));
- for (i = 0;
- VEC_iterate (tree, fn->eh->ehspec_data.arm_eabi, i, t);
- i++)
+ FOR_EACH_VEC_ELT (tree, fn->eh->ehspec_data.arm_eabi, i, t)
lto_output_tree_ref (ob, t);
}
else
{
uchar c;
output_sleb128 (ob, VEC_length (uchar, fn->eh->ehspec_data.other));
- for (i = 0; VEC_iterate (uchar, fn->eh->ehspec_data.other, i, c); i++)
+ FOR_EACH_VEC_ELT (uchar, fn->eh->ehspec_data.other, i, c)
lto_output_1_stream (ob->main_stream, c);
}
}
@@ -1908,7 +1906,7 @@ output_function (struct cgraph_node *node)
/* Output all the local variables in the function. */
output_sleb128 (ob, VEC_length (tree, fn->local_decls));
- for (i = 0; VEC_iterate (tree, fn->local_decls, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, fn->local_decls, i, t)
lto_output_tree_ref (ob, t);
/* Output the head of the arguments list. */
@@ -2013,7 +2011,7 @@ output_unreferenced_globals (cgraph_node_set set, varpool_node_set vset)
output_zero (ob);
/* Emit the alias pairs for the nodes in SET. */
- for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++)
+ FOR_EACH_VEC_ELT (alias_pair, alias_pairs, i, p)
{
if (output_alias_pair_p (p, set, vset))
{
@@ -2446,7 +2444,7 @@ produce_symtab (struct output_block *ob,
}
/* Write all aliases. */
- for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++)
+ FOR_EACH_VEC_ELT (alias_pair, alias_pairs, i, p)
if (output_alias_pair_p (p, set, vset))
write_symbol (cache, &stream, p->decl, seen, true);
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index 0536bb97b25..2b3d1724fe7 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -643,7 +643,7 @@ lto_streamer_cache_create (void)
unnecessarily. */
common_nodes = lto_get_common_nodes ();
- for (i = 0; VEC_iterate (tree, common_nodes, i, node); i++)
+ FOR_EACH_VEC_ELT (tree, common_nodes, i, node)
preload_common_node (cache, node);
VEC_free(tree, heap, common_nodes);
diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c
index 9e782d578a2..bdfbd7d67a2 100644
--- a/gcc/lto-symtab.c
+++ b/gcc/lto-symtab.c
@@ -601,7 +601,7 @@ lto_symtab_merge_decls_2 (void **slot)
return;
/* Diagnose all mismatched re-declarations. */
- for (i = 0; VEC_iterate (tree, mismatches, i, decl); ++i)
+ FOR_EACH_VEC_ELT (tree, mismatches, i, decl)
{
if (!gimple_types_compatible_p (TREE_TYPE (prevailing->decl),
TREE_TYPE (decl), GTC_DIAG))
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 2652a284f43..d2bb78e0799 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-20 Nathan Froyd <froydnj@codesourcery.com>
+
+ * lto.c: Use FOR_EACH_VEC_ELT.
+
2010-07-27 Andi Kleen <ak@linux.intel.com>
* Make-lang.in (lto.o): Add dependency to splay-tree.h
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index e4ee214f622..84a6e28e1a1 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1063,7 +1063,7 @@ lto_wpa_write_files (void)
compiled by LTRANS. After this loop, only those sets that
contain callgraph nodes from more than one file will need to be
compiled by LTRANS. */
- for (i = 0; VEC_iterate (ltrans_partition, ltrans_partitions, i, part); i++)
+ FOR_EACH_VEC_ELT (ltrans_partition, ltrans_partitions, i, part)
lto_stats.num_output_cgraph_nodes += VEC_length (cgraph_node_ptr,
part->cgraph_set->nodes);
@@ -1592,7 +1592,7 @@ lto_fixup_decls (struct lto_file_decl_data **files)
htab_traverse (file->function_decl_states, lto_fixup_state_aux, &data);
}
- for (i = 0; VEC_iterate (tree, lto_global_var_decls, i, decl); i++)
+ FOR_EACH_VEC_ELT (tree, lto_global_var_decls, i, decl)
{
tree saved_decl = decl;
walk_tree (&decl, lto_fixup_tree, &data, NULL);
@@ -1892,7 +1892,7 @@ materialize_cgraph (void)
set_cfun (NULL);
/* Inform the middle end about the global variables we have seen. */
- for (i = 0; VEC_iterate (tree, lto_global_var_decls, i, decl); i++)
+ FOR_EACH_VEC_ELT (tree, lto_global_var_decls, i, decl)
rest_of_decl_compilation (decl, 1, 0);
if (!quiet_flag)
diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c
index 84c6e6ea3c2..3789af0a0d9 100644
--- a/gcc/matrix-reorg.c
+++ b/gcc/matrix-reorg.c
@@ -890,9 +890,7 @@ analyze_transpose (void **slot, void *data ATTRIBUTE_UNUSED)
{
if (mi->access_l)
{
- for (i = 0;
- VEC_iterate (access_site_info_p, mi->access_l, i, acc_info);
- i++)
+ FOR_EACH_VEC_ELT (access_site_info_p, mi->access_l, i, acc_info)
free (acc_info);
VEC_free (access_site_info_p, heap, mi->access_l);
diff --git a/gcc/opts.c b/gcc/opts.c
index d04e81c6493..d1f956889a9 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -592,14 +592,10 @@ flag_instrument_functions_exclude_p (tree fndecl)
char *s;
name = lang_hooks.decl_printable_name (fndecl, 0);
- for (i = 0;
- VEC_iterate (char_p, flag_instrument_functions_exclude_functions,
- i, s);
- ++i)
- {
- if (strstr (name, s) != NULL)
- return true;
- }
+ FOR_EACH_VEC_ELT (char_p, flag_instrument_functions_exclude_functions,
+ i, s)
+ if (strstr (name, s) != NULL)
+ return true;
}
if (VEC_length (char_p, flag_instrument_functions_exclude_files) > 0)
@@ -609,13 +605,9 @@ flag_instrument_functions_exclude_p (tree fndecl)
char *s;
name = DECL_SOURCE_FILE (fndecl);
- for (i = 0;
- VEC_iterate (char_p, flag_instrument_functions_exclude_files, i, s);
- ++i)
- {
- if (strstr (name, s) != NULL)
- return true;
- }
+ FOR_EACH_VEC_ELT (char_p, flag_instrument_functions_exclude_files, i, s)
+ if (strstr (name, s) != NULL)
+ return true;
}
return false;
diff --git a/gcc/predict.c b/gcc/predict.c
index cd04be5f764..1b61ee47322 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -942,7 +942,7 @@ predict_loops (void)
exits = get_loop_exit_edges (loop);
n_exits = VEC_length (edge, exits);
- for (j = 0; VEC_iterate (edge, exits, j, ex); j++)
+ FOR_EACH_VEC_ELT (edge, exits, j, ex)
{
tree niter = NULL;
HOST_WIDE_INT nitercst;
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 10ac8f32062..5ca762eecf2 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -1009,7 +1009,7 @@ print_vec_tree (FILE *file, const char *prefix, VEC(tree,gc) *vec, int indent)
fprintf (file, "%s <VEC", prefix);
dump_addr (file, " ", vec);
- for (ix = 0; VEC_iterate (tree, vec, ix, elt); ++ix)
+ FOR_EACH_VEC_ELT (tree, vec, ix, elt)
{
char temp[10];
sprintf (temp, "elt %d", ix);
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index f7bf9e334a1..5d2896c4062 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -1484,7 +1484,7 @@ sdbout_finish (const char *main_filename ATTRIBUTE_UNUSED)
size_t i;
tree decl;
- for (i = 0; VEC_iterate (tree, deferred_global_decls, i, decl); i++)
+ FOR_EACH_VEC_ELT (tree, deferred_global_decls, i, decl)
sdbout_symbol (decl, 0);
}
diff --git a/gcc/sel-sched-dump.c b/gcc/sel-sched-dump.c
index c9f68067389..af76b5b6c54 100644
--- a/gcc/sel-sched-dump.c
+++ b/gcc/sel-sched-dump.c
@@ -467,7 +467,7 @@ dump_insn_vector (rtx_vec_t succs)
int i;
rtx succ;
- for (i = 0; VEC_iterate (rtx, succs, i, succ); i++)
+ FOR_EACH_VEC_ELT (rtx, succs, i, succ)
if (succ)
dump_insn (succ);
else
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 4e15eba16ff..f23b7cf8d98 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -5822,7 +5822,7 @@ make_region_from_loop_preheader (VEC(basic_block, heap) **loop_blocks)
new_rgn_number = sel_create_new_region ();
- for (i = 0; VEC_iterate (basic_block, *loop_blocks, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, *loop_blocks, i, bb)
{
gcc_assert (new_rgn_number >= 0);
@@ -6167,7 +6167,7 @@ sel_remove_loop_preheader (void)
{
/* If all preheader blocks are empty - dont create new empty region.
Instead, remove them completely. */
- for (i = 0; VEC_iterate (basic_block, preheader_blocks, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, preheader_blocks, i, bb)
{
edge e;
edge_iterator ei;
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 449a362ac1e..0f02c0c9618 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -2736,7 +2736,7 @@ compute_av_set_at_bb_end (insn_t insn, ilist_t p, int ws)
/* Add insn to to the tail of current path. */
ilist_add (&p, insn);
- for (is = 0; VEC_iterate (rtx, sinfo->succs_ok, is, succ); is++)
+ FOR_EACH_VEC_ELT (rtx, sinfo->succs_ok, is, succ)
{
av_set_t succ_set;
@@ -2790,7 +2790,7 @@ compute_av_set_at_bb_end (insn_t insn, ilist_t p, int ws)
/* Check liveness restrictions via hard way when there are more than
two successors. */
if (sinfo->succs_ok_n > 2)
- for (is = 0; VEC_iterate (rtx, sinfo->succs_ok, is, succ); is++)
+ FOR_EACH_VEC_ELT (rtx, sinfo->succs_ok, is, succ)
{
basic_block succ_bb = BLOCK_FOR_INSN (succ);
@@ -2801,7 +2801,7 @@ compute_av_set_at_bb_end (insn_t insn, ilist_t p, int ws)
/* Finally, check liveness restrictions on paths leaving the region. */
if (sinfo->all_succs_n > sinfo->succs_ok_n)
- for (is = 0; VEC_iterate (rtx, sinfo->succs_other, is, succ); is++)
+ FOR_EACH_VEC_ELT (rtx, sinfo->succs_other, is, succ)
mark_unavailable_targets
(av1, NULL, BB_LV_SET (BLOCK_FOR_INSN (succ)));
@@ -3572,7 +3572,7 @@ vinsn_vec_has_expr_p (vinsn_vec_t vinsn_vec, expr_t expr)
vinsn_t vinsn;
int n;
- for (n = 0; VEC_iterate (vinsn_t, vinsn_vec, n, vinsn); n++)
+ FOR_EACH_VEC_ELT (vinsn_t, vinsn_vec, n, vinsn)
if (VINSN_SEPARABLE_P (vinsn))
{
if (vinsn_equal_p (vinsn, EXPR_VINSN (expr)))
@@ -3646,7 +3646,7 @@ vinsn_vec_clear (vinsn_vec_t *vinsn_vec)
vinsn_t vinsn;
int n;
- for (n = 0; VEC_iterate (vinsn_t, *vinsn_vec, n, vinsn); n++)
+ FOR_EACH_VEC_ELT (vinsn_t, *vinsn_vec, n, vinsn)
vinsn_detach (vinsn);
VEC_block_remove (vinsn_t, *vinsn_vec, 0, len);
}
@@ -3942,7 +3942,7 @@ fill_vec_av_set (av_set_t av, blist_t bnds, fence_t fence,
sel_print ("Total ready exprs: %d, stalled: %d\n",
VEC_length (expr_t, vec_av_set), stalled);
sel_print ("Sorted av set (%d): ", VEC_length (expr_t, vec_av_set));
- for (n = 0; VEC_iterate (expr_t, vec_av_set, n, expr); n++)
+ FOR_EACH_VEC_ELT (expr_t, vec_av_set, n, expr)
dump_expr (expr);
sel_print ("\n");
}
@@ -3971,7 +3971,7 @@ convert_vec_av_set_to_ready (void)
sched_extend_ready_list (ready.n_ready);
}
- for (n = 0; VEC_iterate (expr_t, vec_av_set, n, expr); n++)
+ FOR_EACH_VEC_ELT (expr_t, vec_av_set, n, expr)
{
vinsn_t vi = EXPR_VINSN (expr);
insn_t insn = VINSN_INSN_RTX (vi);
@@ -4951,7 +4951,7 @@ remove_temp_moveop_nops (bool full_tidying)
int i;
insn_t insn;
- for (i = 0; VEC_iterate (insn_t, vec_temp_moveop_nops, i, insn); i++)
+ FOR_EACH_VEC_ELT (insn_t, vec_temp_moveop_nops, i, insn)
{
gcc_assert (INSN_NOP_P (insn));
return_nop_to_pool (insn, full_tidying);
diff --git a/gcc/sese.c b/gcc/sese.c
index 651b8fbc9da..ffcb51c1737 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -181,7 +181,7 @@ build_sese_loop_nests (sese region)
/* Make sure that the loops in the SESE_LOOP_NEST are ordered. It
can be the case that an inner loop is inserted before an outer
loop. To avoid this, semi-sort once. */
- for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop0); i++)
+ FOR_EACH_VEC_ELT (loop_p, SESE_LOOP_NEST (region), i, loop0)
{
if (VEC_length (loop_p, SESE_LOOP_NEST (region)) == i + 1)
break;
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index d4b266282c7..09bb594eb2b 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -258,7 +258,7 @@ self_referential_size (tree size)
/* Build the parameter and argument lists in parallel; also
substitute the former for the latter in the expression. */
args = VEC_alloc (tree, gc, VEC_length (tree, self_refs));
- for (i = 0; VEC_iterate (tree, self_refs, i, ref); i++)
+ FOR_EACH_VEC_ELT (tree, self_refs, i, ref)
{
tree subst, param_name, param_type, param_decl;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 34f982d8878..dfe6d8f0920 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -6213,7 +6213,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
{
eh_region region = NULL;
- for (i = 0; VEC_iterate (basic_block, bbs, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
region = find_outermost_region_in_block (saved_cfun, bb, region);
init_eh_for_function ();
@@ -6242,7 +6242,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
d.eh_map = eh_map;
d.remap_decls_p = true;
- for (i = 0; VEC_iterate (basic_block, bbs, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
{
/* No need to update edge counts on the last block. It has
already been updated earlier when we detached the region from
@@ -6307,7 +6307,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
}
set_immediate_dominator (CDI_DOMINATORS, bb, dom_entry);
- for (i = 0; VEC_iterate (basic_block, dom_bbs, i, abb); i++)
+ FOR_EACH_VEC_ELT (basic_block, dom_bbs, i, abb)
set_immediate_dominator (CDI_DOMINATORS, abb, bb);
VEC_free (basic_block, heap, dom_bbs);
@@ -6917,7 +6917,7 @@ remove_edge_and_dominated_blocks (edge e)
else
{
bbs_to_remove = get_all_dominated_blocks (CDI_DOMINATORS, e->dest);
- for (i = 0; VEC_iterate (basic_block, bbs_to_remove, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs_to_remove, i, bb)
{
FOR_EACH_EDGE (f, ei, bb->succs)
{
@@ -6925,7 +6925,7 @@ remove_edge_and_dominated_blocks (edge e)
bitmap_set_bit (df, f->dest->index);
}
}
- for (i = 0; VEC_iterate (basic_block, bbs_to_remove, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, bbs_to_remove, i, bb)
bitmap_clear_bit (df, bb->index);
EXECUTE_IF_SET_IN_BITMAP (df, 0, i, bi)
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index f798b2f50ed..3c1ca2d2195 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -901,7 +901,7 @@ remove_forwarder_block_with_phi (basic_block bb)
redirection, replace it with the PHI argument that used
to be on E. */
head = redirect_edge_var_map_vector (e);
- for (i = 0; VEC_iterate (edge_var_map, head, i, vm); ++i)
+ FOR_EACH_VEC_ELT (edge_var_map, head, i, vm)
{
tree old_arg = redirect_edge_var_map_result (vm);
tree new_arg = redirect_edge_var_map_def (vm);
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 92f8de9f0eb..72955108c7b 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -659,7 +659,7 @@ chrec_apply_map (tree chrec, VEC (tree, heap) *iv_map)
int i;
tree expr;
- for (i = 0; VEC_iterate (tree, iv_map, i, expr); i++)
+ FOR_EACH_VEC_ELT (tree, iv_map, i, expr)
if (expr)
chrec = chrec_apply (i, chrec, expr);
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 265635039a6..025368d54cd 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -152,7 +152,7 @@ dump_data_references (FILE *file, VEC (data_reference_p, heap) *datarefs)
unsigned int i;
struct data_reference *dr;
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
dump_data_reference (file, dr);
}
@@ -181,7 +181,7 @@ dump_data_dependence_relations (FILE *file,
unsigned int i;
struct data_dependence_relation *ddr;
- for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, ddrs, i, ddr)
dump_data_dependence_relation (file, ddr);
}
@@ -342,7 +342,7 @@ print_dir_vectors (FILE *outf, VEC (lambda_vector, heap) *dir_vects,
unsigned j;
lambda_vector v;
- for (j = 0; VEC_iterate (lambda_vector, dir_vects, j, v); j++)
+ FOR_EACH_VEC_ELT (lambda_vector, dir_vects, j, v)
print_direction_vector (outf, v, length);
}
@@ -355,7 +355,7 @@ print_dist_vectors (FILE *outf, VEC (lambda_vector, heap) *dist_vects,
unsigned j;
lambda_vector v;
- for (j = 0; VEC_iterate (lambda_vector, dist_vects, j, v); j++)
+ FOR_EACH_VEC_ELT (lambda_vector, dist_vects, j, v)
print_lambda_vector (outf, v, length);
}
@@ -420,7 +420,7 @@ dump_data_dependence_relation (FILE *outf,
fprintf (outf, " inner loop index: %d\n", DDR_INNER_LOOP (ddr));
fprintf (outf, " loop nest: (");
- for (i = 0; VEC_iterate (loop_p, DDR_LOOP_NEST (ddr), i, loopi); i++)
+ FOR_EACH_VEC_ELT (loop_p, DDR_LOOP_NEST (ddr), i, loopi)
fprintf (outf, "%d ", loopi->num);
fprintf (outf, ")\n");
@@ -495,17 +495,17 @@ dump_dist_dir_vectors (FILE *file, VEC (ddr_p, heap) *ddrs)
struct data_dependence_relation *ddr;
lambda_vector v;
- for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, ddrs, i, ddr)
if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_AFFINE_P (ddr))
{
- for (j = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), j, v); j++)
+ FOR_EACH_VEC_ELT (lambda_vector, DDR_DIST_VECTS (ddr), j, v)
{
fprintf (file, "DISTANCE_V (");
print_lambda_vector (file, v, DDR_NB_LOOPS (ddr));
fprintf (file, ")\n");
}
- for (j = 0; VEC_iterate (lambda_vector, DDR_DIR_VECTS (ddr), j, v); j++)
+ FOR_EACH_VEC_ELT (lambda_vector, DDR_DIR_VECTS (ddr), j, v)
{
fprintf (file, "DIRECTION_V (");
print_direction_vector (file, v, DDR_NB_LOOPS (ddr));
@@ -524,7 +524,7 @@ dump_ddrs (FILE *file, VEC (ddr_p, heap) *ddrs)
unsigned int i;
struct data_dependence_relation *ddr;
- for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, ddrs, i, ddr)
dump_data_dependence_relation (file, ddr);
fprintf (file, "\n\n");
@@ -923,7 +923,7 @@ dr_address_invariant_p (struct data_reference *dr)
unsigned i;
tree idx;
- for (i = 0; VEC_iterate (tree, DR_ACCESS_FNS (dr), i, idx); i++)
+ FOR_EACH_VEC_ELT (tree, DR_ACCESS_FNS (dr), i, idx)
if (tree_contains_chrecs (idx, NULL))
return false;
@@ -1506,7 +1506,7 @@ free_subscripts (VEC (subscript_p, heap) *subscripts)
unsigned i;
subscript_p s;
- for (i = 0; VEC_iterate (subscript_p, subscripts, i, s); i++)
+ FOR_EACH_VEC_ELT (subscript_p, subscripts, i, s)
{
free_conflict_function (s->conflicting_iterations_in_a);
free_conflict_function (s->conflicting_iterations_in_b);
@@ -2841,7 +2841,7 @@ save_dist_v (struct data_dependence_relation *ddr, lambda_vector dist_v)
unsigned i;
lambda_vector v;
- for (i = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), i, v); i++)
+ FOR_EACH_VEC_ELT (lambda_vector, DDR_DIST_VECTS (ddr), i, v)
if (lambda_vector_equal (v, dist_v, DDR_NB_LOOPS (ddr)))
return;
@@ -2856,7 +2856,7 @@ save_dir_v (struct data_dependence_relation *ddr, lambda_vector dir_v)
unsigned i;
lambda_vector v;
- for (i = 0; VEC_iterate (lambda_vector, DDR_DIR_VECTS (ddr), i, v); i++)
+ FOR_EACH_VEC_ELT (lambda_vector, DDR_DIR_VECTS (ddr), i, v)
if (lambda_vector_equal (v, dir_v, DDR_NB_LOOPS (ddr)))
return;
@@ -3319,7 +3319,7 @@ build_classic_dir_vector (struct data_dependence_relation *ddr)
unsigned i, j;
lambda_vector dist_v;
- for (i = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), i, dist_v); i++)
+ FOR_EACH_VEC_ELT (lambda_vector, DDR_DIST_VECTS (ddr), i, dist_v)
{
lambda_vector dir_v = lambda_vector_new (DDR_NB_LOOPS (ddr));
@@ -3421,7 +3421,7 @@ access_functions_are_affine_or_constant_p (const struct data_reference *a,
VEC(tree,heap) *fns = DR_ACCESS_FNS (a);
tree t;
- for (i = 0; VEC_iterate (tree, fns, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, fns, i, t)
if (!evolution_function_is_invariant_p (t, loop_nest->num)
&& !evolution_function_is_affine_multivariate_p (t, loop_nest->num))
return false;
@@ -3883,7 +3883,7 @@ ddr_consistent_p (FILE *file,
DDR_NUM_DIST_VECTS (ddr));
fprintf (file, "Banerjee dist vectors:\n");
- for (i = 0; VEC_iterate (lambda_vector, dist_vects, i, b_dist_v); i++)
+ FOR_EACH_VEC_ELT (lambda_vector, dist_vects, i, b_dist_v)
print_lambda_vector (file, b_dist_v, DDR_NB_LOOPS (ddr));
fprintf (file, "Omega dist vectors:\n");
@@ -3912,7 +3912,7 @@ ddr_consistent_p (FILE *file,
/* Distance vectors are not ordered in the same way in the DDR
and in the DIST_VECTS: search for a matching vector. */
- for (j = 0; VEC_iterate (lambda_vector, dist_vects, j, a_dist_v); j++)
+ FOR_EACH_VEC_ELT (lambda_vector, dist_vects, j, a_dist_v)
if (lambda_vector_equal (a_dist_v, b_dist_v, DDR_NB_LOOPS (ddr)))
break;
@@ -3935,7 +3935,7 @@ ddr_consistent_p (FILE *file,
/* Direction vectors are not ordered in the same way in the DDR
and in the DIR_VECTS: search for a matching vector. */
- for (j = 0; VEC_iterate (lambda_vector, dir_vects, j, a_dir_v); j++)
+ FOR_EACH_VEC_ELT (lambda_vector, dir_vects, j, a_dir_v)
if (lambda_vector_equal (a_dir_v, b_dir_v, DDR_NB_LOOPS (ddr)))
break;
@@ -4105,7 +4105,7 @@ compute_all_dependences (VEC (data_reference_p, heap) *datarefs,
struct data_reference *a, *b;
unsigned int i, j;
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, a); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, a)
for (j = i + 1; VEC_iterate (data_reference_p, datarefs, j, b); j++)
if (!DR_IS_READ (a) || !DR_IS_READ (b) || compute_self_and_rr)
{
@@ -4116,7 +4116,7 @@ compute_all_dependences (VEC (data_reference_p, heap) *datarefs,
}
if (compute_self_and_rr)
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, a); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, a)
{
ddr = initialize_data_dependence_relation (a, a, loop_nest);
VEC_safe_push (ddr_p, heap, *dependence_relations, ddr);
@@ -4214,7 +4214,7 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt,
return false;
}
- for (i = 0; VEC_iterate (data_ref_loc, references, i, ref); i++)
+ FOR_EACH_VEC_ELT (data_ref_loc, references, i, ref)
{
dr = create_data_ref (nest, *ref->pos, stmt, ref->is_read);
gcc_assert (dr != NULL);
@@ -4257,7 +4257,7 @@ graphite_find_data_references_in_stmt (struct loop *nest, gimple stmt,
return false;
}
- for (i = 0; VEC_iterate (data_ref_loc, references, i, ref); i++)
+ FOR_EACH_VEC_ELT (data_ref_loc, references, i, ref)
{
dr = create_data_ref (nest, *ref->pos, stmt, ref->is_read);
gcc_assert (dr != NULL);
@@ -4526,7 +4526,7 @@ analyze_all_data_dependences (struct loop *loop)
unsigned nb_chrec_relations = 0;
struct data_dependence_relation *ddr;
- for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, dependence_relations, i, ddr)
{
if (chrec_contains_undetermined (DDR_ARE_DEPENDENT (ddr)))
nb_top_relations++;
@@ -4587,7 +4587,7 @@ free_dependence_relations (VEC (ddr_p, heap) *dependence_relations)
struct data_dependence_relation *ddr;
VEC (loop_p, heap) *loop_nest = NULL;
- for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, dependence_relations, i, ddr)
{
if (ddr == NULL)
continue;
@@ -4612,7 +4612,7 @@ free_data_refs (VEC (data_reference_p, heap) *datarefs)
unsigned int i;
struct data_reference *dr;
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
free_data_ref (dr);
VEC_free (data_reference_p, heap, datarefs);
}
@@ -4814,7 +4814,7 @@ create_rdg_edges (struct graph *rdg, VEC (ddr_p, heap) *ddrs)
def_operand_p def_p;
ssa_op_iter iter;
- for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, ddrs, i, ddr)
if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
create_rdg_edge_for_ddr (rdg, ddr);
@@ -4832,7 +4832,7 @@ create_rdg_vertices (struct graph *rdg, VEC (gimple, heap) *stmts)
int i, j;
gimple stmt;
- for (i = 0; VEC_iterate (gimple, stmts, i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, stmts, i, stmt)
{
VEC (data_ref_loc, heap) *references;
data_ref_loc *ref;
@@ -4858,7 +4858,7 @@ create_rdg_vertices (struct graph *rdg, VEC (gimple, heap) *stmts)
continue;
get_references_in_stmt (stmt, &references);
- for (j = 0; VEC_iterate (data_ref_loc, references, j, ref); j++)
+ FOR_EACH_VEC_ELT (data_ref_loc, references, j, ref)
if (!ref->is_read)
RDG_MEM_WRITE_STMT (rdg, i) = true;
else
@@ -4908,7 +4908,7 @@ known_dependences_p (VEC (ddr_p, heap) *dependence_relations)
ddr_p ddr;
unsigned int i;
- for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, dependence_relations, i, ddr)
if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
return false;
@@ -5142,12 +5142,12 @@ have_similar_memory_accesses (gimple s1, gimple s2)
get_references_in_stmt (s1, &refs1);
get_references_in_stmt (s2, &refs2);
- for (i = 0; VEC_iterate (data_ref_loc, refs1, i, ref1); i++)
+ FOR_EACH_VEC_ELT (data_ref_loc, refs1, i, ref1)
{
tree base1 = ref_base_address (s1, ref1);
if (base1)
- for (j = 0; VEC_iterate (data_ref_loc, refs2, j, ref2); j++)
+ FOR_EACH_VEC_ELT (data_ref_loc, refs2, j, ref2)
if (base1 == ref_base_address (s2, ref2))
{
res = true;
@@ -5183,7 +5183,7 @@ ref_base_address_1 (const void *s)
get_references_in_stmt (stmt, &refs);
- for (i = 0; VEC_iterate (data_ref_loc, refs, i, ref); i++)
+ FOR_EACH_VEC_ELT (data_ref_loc, refs, i, ref)
if (!ref->is_read)
{
res = htab_hash_pointer (ref_base_address (stmt, ref));
@@ -5233,7 +5233,7 @@ access_matrix_get_index_for_parameter (tree parameter,
VEC (tree,heap) *lambda_parameters = AM_PARAMETERS (access_matrix);
tree lambda_parameter;
- for (i = 0; VEC_iterate (tree, lambda_parameters, i, lambda_parameter); i++)
+ FOR_EACH_VEC_ELT (tree, lambda_parameters, i, lambda_parameter)
if (lambda_parameter == parameter)
return i + AM_NB_INDUCTION_VARS (access_matrix);
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 17f97be1104..ec4e0ada0b3 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -714,7 +714,7 @@ ipa_lower_emutls (void)
VEC_safe_grow (tree, heap, access_vars, n_tls);
/* Create the control variables for each TLS variable. */
- for (i = 0; VEC_iterate (varpool_node_ptr, tls_vars->nodes, i, var); ++i)
+ FOR_EACH_VEC_ELT (varpool_node_ptr, tls_vars->nodes, i, var)
{
tree cdecl;
struct varpool_node *cvar;
@@ -750,7 +750,7 @@ ipa_lower_emutls (void)
if (any_aliases)
{
alias_pair *p;
- for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); ++i)
+ FOR_EACH_VEC_ELT (alias_pair, alias_pairs, i, p)
if (DECL_THREAD_LOCAL_P (p->decl))
{
p->decl = emutls_decl (p->decl);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a4785d800ff..3784bc507d9 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2370,7 +2370,7 @@ copy_debug_stmts (copy_body_data *id)
if (!id->debug_stmts)
return;
- for (i = 0; VEC_iterate (gimple, id->debug_stmts, i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, id->debug_stmts, i, stmt)
copy_debug_stmt (stmt, id);
VEC_free (gimple, heap, id->debug_stmts);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 948398ca1c8..cbd629c7fe5 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -1992,7 +1992,7 @@ rewrite_update_phi_arguments (basic_block bb)
continue;
phis = VEC_index (gimple_vec, phis_to_rewrite, e->dest->index);
- for (i = 0; VEC_iterate (gimple, phis, i, phi); i++)
+ FOR_EACH_VEC_ELT (gimple, phis, i, phi)
{
tree arg, lhs_sym, reaching_def = NULL;
use_operand_p arg_p;
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 88c77a48fdf..63f717807d4 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -517,7 +517,7 @@ mark_nodes_having_upstream_mem_writes (struct graph *rdg)
graphds_dfs (rdg, &v, 1, &nodes, false, NULL);
- for (i = 0; VEC_iterate (int, nodes, i, x); i++)
+ FOR_EACH_VEC_ELT (int, nodes, i, x)
{
if (!bitmap_set_bit (seen, x))
continue;
@@ -672,7 +672,7 @@ rdg_flag_vertex_and_dependent (struct graph *rdg, int v, bitmap partition,
graphds_dfs (rdg, &v, 1, &nodes, false, remaining_stmts);
rdg_flag_vertex (rdg, v, partition, loops, part_has_writes);
- for (i = 0; VEC_iterate (int, nodes, i, x); i++)
+ FOR_EACH_VEC_ELT (int, nodes, i, x)
if (!already_processed_vertex_p (processed, x))
rdg_flag_vertex_and_dependent (rdg, x, partition, loops, processed,
part_has_writes);
@@ -690,7 +690,7 @@ collect_condition_stmts (struct loop *loop, VEC (gimple, heap) **conds)
edge e;
VEC (edge, heap) *exits = get_loop_exit_edges (loop);
- for (i = 0; VEC_iterate (edge, exits, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, e)
{
gimple cond = last_stmt (e->src);
@@ -771,7 +771,7 @@ rdg_flag_similar_memory_accesses (struct graph *rdg, bitmap partition,
/* Remove from OTHER_STORES the vertex that we flagged. */
if (RDG_MEM_WRITE_STMT (rdg, j))
- for (k = 0; VEC_iterate (int, *other_stores, k, kk); k++)
+ FOR_EACH_VEC_ELT (int, *other_stores, k, kk)
if (kk == j)
{
VEC_unordered_remove (int, *other_stores, k);
@@ -802,7 +802,7 @@ build_rdg_partition_for_component (struct graph *rdg, rdgc c,
bitmap loops = BITMAP_ALLOC (NULL);
bitmap processed = BITMAP_ALLOC (NULL);
- for (i = 0; VEC_iterate (int, c->vertices, i, v); i++)
+ FOR_EACH_VEC_ELT (int, c->vertices, i, v)
if (!already_processed_vertex_p (processed, v))
rdg_flag_vertex_and_dependent (rdg, v, partition, loops, processed,
part_has_writes);
@@ -829,7 +829,7 @@ free_rdg_components (VEC (rdgc, heap) *components)
int i;
rdgc x;
- for (i = 0; VEC_iterate (rdgc, components, i, x); i++)
+ FOR_EACH_VEC_ELT (rdgc, components, i, x)
{
VEC_free (int, heap, x->vertices);
free (x);
@@ -854,7 +854,7 @@ rdg_build_components (struct graph *rdg, VEC (int, heap) *starting_vertices,
for (i = 0; i < rdg->n_vertices; i++)
VEC_safe_push (int, heap, all_components[rdg->vertices[i].component], i);
- for (i = 0; VEC_iterate (int, starting_vertices, i, v); i++)
+ FOR_EACH_VEC_ELT (int, starting_vertices, i, v)
{
int c = rdg->vertices[v].component;
@@ -889,7 +889,7 @@ rdg_build_partitions (struct graph *rdg, VEC (rdgc, heap) *components,
rdgc x;
bitmap partition = BITMAP_ALLOC (NULL);
- for (i = 0; VEC_iterate (rdgc, components, i, x); i++)
+ FOR_EACH_VEC_ELT (rdgc, components, i, x)
{
bitmap np;
bool part_has_writes = false;
@@ -955,7 +955,7 @@ dump_rdg_partitions (FILE *file, VEC (bitmap, heap) *partitions)
int i;
bitmap partition;
- for (i = 0; VEC_iterate (bitmap, partitions, i, partition); i++)
+ FOR_EACH_VEC_ELT (bitmap, partitions, i, partition)
debug_bitmap_file (file, partition);
}
@@ -1019,7 +1019,7 @@ partition_contains_all_rw (struct graph *rdg, VEC (bitmap, heap) *partitions)
bitmap partition;
int nrw = number_of_rw_in_rdg (rdg);
- for (i = 0; VEC_iterate (bitmap, partitions, i, partition); i++)
+ FOR_EACH_VEC_ELT (bitmap, partitions, i, partition)
if (nrw == number_of_rw_in_partition (rdg, partition))
return true;
@@ -1054,7 +1054,7 @@ ldist_gen (struct loop *loop, struct graph *rdg,
unsigned j;
bool found = false;
- for (j = 0; VEC_iterate (int, starting_vertices, j, v); j++)
+ FOR_EACH_VEC_ELT (int, starting_vertices, j, v)
if (i == v)
{
found = true;
@@ -1080,7 +1080,7 @@ ldist_gen (struct loop *loop, struct graph *rdg,
if (dump_file && (dump_flags & TDF_DETAILS))
dump_rdg_partitions (dump_file, partitions);
- for (i = 0; VEC_iterate (bitmap, partitions, i, partition); i++)
+ FOR_EACH_VEC_ELT (bitmap, partitions, i, partition)
if (!generate_code_for_partition (loop, partition, i < nbp - 1))
goto ldist_done;
@@ -1092,7 +1092,7 @@ ldist_gen (struct loop *loop, struct graph *rdg,
BITMAP_FREE (remaining_stmts);
BITMAP_FREE (upstream_mem_writes);
- for (i = 0; VEC_iterate (bitmap, partitions, i, partition); i++)
+ FOR_EACH_VEC_ELT (bitmap, partitions, i, partition)
BITMAP_FREE (partition);
VEC_free (int, heap, other_stores);
@@ -1143,7 +1143,7 @@ distribute_loop (struct loop *loop, VEC (gimple, heap) *stmts)
if (dump_file && (dump_flags & TDF_DETAILS))
dump_rdg (dump_file, rdg);
- for (i = 0; VEC_iterate (gimple, stmts, i, s); i++)
+ FOR_EACH_VEC_ELT (gimple, stmts, i, s)
{
int v = rdg_vertex_for_stmt (rdg, s);
diff --git a/gcc/tree-loop-linear.c b/gcc/tree-loop-linear.c
index 03759dec967..a411c25c91c 100644
--- a/gcc/tree-loop-linear.c
+++ b/gcc/tree-loop-linear.c
@@ -99,7 +99,7 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations ATTRIBUTE_UNUS
*nb_deps_not_carried_by_loop = 0;
*access_strides = double_int_zero;
- for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, dependence_relations, i, ddr)
{
/* If we don't know anything about this dependence, or the distance
vector is NULL, or there is no dependence, then there is no reuse of
@@ -125,7 +125,7 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations ATTRIBUTE_UNUS
}
/* Compute the access strides. */
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
unsigned int it;
tree ref = DR_REF (dr);
@@ -414,7 +414,7 @@ linear_transform_loops (void)
VEC_free (loop_p, heap, nest);
}
- for (i = 0; VEC_iterate (gimple, remove_ivs, i, oldiv_stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, remove_ivs, i, oldiv_stmt)
remove_iv (oldiv_stmt);
VEC_free (tree, heap, oldivs);
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 99c5bce1726..f65d1dab562 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -1327,7 +1327,7 @@ mudflap_finish_file (void)
{
size_t i;
tree obj;
- for (i = 0; VEC_iterate (tree, deferred_static_decls, i, obj); i++)
+ FOR_EACH_VEC_ELT (tree, deferred_static_decls, i, obj)
{
gcc_assert (DECL_P (obj));
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index e5a35f40550..87ccb214167 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -403,7 +403,7 @@ elim_graph_add_node (elim_graph g, int node)
int x;
int t;
- for (x = 0; VEC_iterate (int, g->nodes, x, t); x++)
+ FOR_EACH_VEC_ELT (int, g->nodes, x, t)
if (t == node)
return;
VEC_safe_push (int, heap, g->nodes, node);
@@ -678,7 +678,7 @@ eliminate_phi (edge e, elim_graph g)
sbitmap_zero (g->visited);
VEC_truncate (int, g->stack, 0);
- for (x = 0; VEC_iterate (int, g->nodes, x, part); x++)
+ FOR_EACH_VEC_ELT (int, g->nodes, x, part)
{
if (!TEST_BIT (g->visited, part))
elim_forward (g, part);
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index af2708667d2..4fc67a3adc9 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -549,7 +549,7 @@ eliminate_local_variables (edge entry, edge exit)
gather_blocks_in_sese_region (entry_bb, exit_bb, &body);
- for (i = 0; VEC_iterate (basic_block, body, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, body, i, bb)
if (bb != entry_bb && bb != exit_bb)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
eliminate_local_variables_stmt (entry, gsi_stmt (gsi),
@@ -1087,7 +1087,7 @@ separate_decls_in_region (edge entry, edge exit, htab_t reduction_list,
entry = single_succ_edge (entry_bb);
gather_blocks_in_sese_region (entry_bb, exit_bb, &body);
- for (i = 0; VEC_iterate (basic_block, body, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, body, i, bb)
{
if (bb != entry_bb && bb != exit_bb)
{
@@ -1115,7 +1115,7 @@ separate_decls_in_region (edge entry, edge exit, htab_t reduction_list,
and discard those for which we know there's nothing we can
do. */
if (has_debug_stmt)
- for (i = 0; VEC_iterate (basic_block, body, i, bb); i++)
+ FOR_EACH_VEC_ELT (basic_block, body, i, bb)
if (bb != entry_bb && bb != exit_bb)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 49683d5093b..712cc68740d 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -420,7 +420,7 @@ dump_chain (FILE *file, chain_p chain)
if (chain->vars)
{
fprintf (file, " vars");
- for (i = 0; VEC_iterate (tree, chain->vars, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, chain->vars, i, var)
{
fprintf (file, " ");
print_generic_expr (file, var, TDF_SLIM);
@@ -431,7 +431,7 @@ dump_chain (FILE *file, chain_p chain)
if (chain->inits)
{
fprintf (file, " inits");
- for (i = 0; VEC_iterate (tree, chain->inits, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, chain->inits, i, var)
{
fprintf (file, " ");
print_generic_expr (file, var, TDF_SLIM);
@@ -440,7 +440,7 @@ dump_chain (FILE *file, chain_p chain)
}
fprintf (file, " references:\n");
- for (i = 0; VEC_iterate (dref, chain->refs, i, a); i++)
+ FOR_EACH_VEC_ELT (dref, chain->refs, i, a)
dump_dref (file, a);
fprintf (file, "\n");
@@ -455,7 +455,7 @@ dump_chains (FILE *file, VEC (chain_p, heap) *chains)
chain_p chain;
unsigned i;
- for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
+ FOR_EACH_VEC_ELT (chain_p, chains, i, chain)
dump_chain (file, chain);
}
@@ -470,7 +470,7 @@ dump_component (FILE *file, struct component *comp)
fprintf (file, "Component%s:\n",
comp->comp_step == RS_INVARIANT ? " (invariant)" : "");
- for (i = 0; VEC_iterate (dref, comp->refs, i, a); i++)
+ FOR_EACH_VEC_ELT (dref, comp->refs, i, a)
dump_dref (file, a);
fprintf (file, "\n");
}
@@ -498,7 +498,7 @@ release_chain (chain_p chain)
if (chain == NULL)
return;
- for (i = 0; VEC_iterate (dref, chain->refs, i, ref); i++)
+ FOR_EACH_VEC_ELT (dref, chain->refs, i, ref)
free (ref);
VEC_free (dref, heap, chain->refs);
@@ -516,7 +516,7 @@ release_chains (VEC (chain_p, heap) *chains)
unsigned i;
chain_p chain;
- for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
+ FOR_EACH_VEC_ELT (chain_p, chains, i, chain)
release_chain (chain);
VEC_free (chain_p, heap, chains);
}
@@ -682,7 +682,7 @@ last_always_executed_block (struct loop *loop)
edge ex;
basic_block last = loop->latch;
- for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, ex)
last = nearest_common_dominator (CDI_DOMINATORS, last, ex->src);
VEC_free (edge, heap, exits);
@@ -707,7 +707,7 @@ split_data_refs_to_components (struct loop *loop,
dref dataref;
basic_block last_always_executed = last_always_executed_block (loop);
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
if (!DR_REF (dr))
{
@@ -724,7 +724,7 @@ split_data_refs_to_components (struct loop *loop,
comp_father[n] = n;
comp_size[n] = 1;
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
enum ref_step_type dummy;
@@ -735,7 +735,7 @@ split_data_refs_to_components (struct loop *loop,
}
}
- for (i = 0; VEC_iterate (ddr_p, depends, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, depends, i, ddr)
{
double_int dummy_off;
@@ -762,7 +762,7 @@ split_data_refs_to_components (struct loop *loop,
comps = XCNEWVEC (struct component *, n);
bad = component_of (comp_father, n);
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
ia = (unsigned) (size_t) dr->aux;
ca = component_of (comp_father, ia);
@@ -819,7 +819,7 @@ suitable_component_p (struct loop *loop, struct component *comp)
basic_block ba, bp = loop->header;
bool ok, has_write = false;
- for (i = 0; VEC_iterate (dref, comp->refs, i, a); i++)
+ FOR_EACH_VEC_ELT (dref, comp->refs, i, a)
{
ba = gimple_bb (a->stmt);
@@ -883,7 +883,7 @@ filter_suitable_components (struct loop *loop, struct component *comps)
unsigned i;
*comp = act->next;
- for (i = 0; VEC_iterate (dref, act->refs, i, ref); i++)
+ FOR_EACH_VEC_ELT (dref, act->refs, i, ref)
free (ref);
release_component (act);
}
@@ -963,7 +963,7 @@ make_invariant_chain (struct component *comp)
chain->all_always_accessed = true;
- for (i = 0; VEC_iterate (dref, comp->refs, i, ref); i++)
+ FOR_EACH_VEC_ELT (dref, comp->refs, i, ref)
{
VEC_safe_push (dref, heap, chain->refs, ref);
chain->all_always_accessed &= ref->always_accessed;
@@ -1135,7 +1135,7 @@ insert_looparound_copy (chain_p chain, dref ref, gimple phi)
nw->distance = ref->distance + 1;
nw->always_accessed = 1;
- for (i = 0; VEC_iterate (dref, chain->refs, i, aref); i++)
+ FOR_EACH_VEC_ELT (dref, chain->refs, i, aref)
if (aref->distance >= nw->distance)
break;
VEC_safe_insert (dref, heap, chain->refs, i, nw);
@@ -1159,7 +1159,7 @@ add_looparound_copies (struct loop *loop, chain_p chain)
dref ref, root = get_chain_root (chain);
gimple phi;
- for (i = 0; VEC_iterate (dref, chain->refs, i, ref); i++)
+ FOR_EACH_VEC_ELT (dref, chain->refs, i, ref)
{
phi = find_looparound_phi (loop, ref, root);
if (!phi)
@@ -1195,7 +1195,7 @@ determine_roots_comp (struct loop *loop,
qsort (VEC_address (dref, comp->refs), VEC_length (dref, comp->refs),
sizeof (dref), order_drefs);
- for (i = 0; VEC_iterate (dref, comp->refs, i, a); i++)
+ FOR_EACH_VEC_ELT (dref, comp->refs, i, a)
{
if (!chain || !DR_IS_READ (a->ref)
|| double_int_ucmp (uhwi_to_double_int (MAX_DISTANCE),
@@ -1506,7 +1506,7 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
if (reuse_first)
VEC_quick_push (tree, chain->vars, VEC_index (tree, chain->vars, 0));
- for (i = 0; VEC_iterate (tree, chain->vars, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, chain->vars, i, var)
VEC_replace (tree, chain->vars, i, make_ssa_name (var, NULL));
for (i = 0; i < n; i++)
@@ -1571,7 +1571,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
if (written)
VEC_quick_push (tree, *vars, VEC_index (tree, *vars, 0));
- for (i = 0; VEC_iterate (tree, *vars, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, *vars, i, var)
VEC_replace (tree, *vars, i, make_ssa_name (var, NULL));
var = VEC_index (tree, *vars, 0);
@@ -1610,7 +1610,7 @@ execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
gcc_assert (chain->type == CT_INVARIANT);
gcc_assert (!chain->combined);
- for (i = 0; VEC_iterate (dref, chain->refs, i, a); i++)
+ FOR_EACH_VEC_ELT (dref, chain->refs, i, a)
if (!DR_IS_READ (a->ref))
n_writes++;
@@ -1622,7 +1622,7 @@ execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
&vars, chain->inits, tmp_vars);
ridx = 0;
- for (i = 0; VEC_iterate (dref, chain->refs, i, a); i++)
+ FOR_EACH_VEC_ELT (dref, chain->refs, i, a)
{
bool is_read = DR_IS_READ (a->ref);
mark_virtual_ops_for_renaming (a->stmt);
@@ -1777,7 +1777,7 @@ determine_unroll_factor (VEC (chain_p, heap) *chains)
unsigned factor = 1, af, nfactor, i;
unsigned max = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES);
- for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
+ FOR_EACH_VEC_ELT (chain_p, chains, i, chain)
{
if (chain->type == CT_INVARIANT || chain->combined)
continue;
@@ -1806,7 +1806,7 @@ execute_pred_commoning (struct loop *loop, VEC (chain_p, heap) *chains,
chain_p chain;
unsigned i;
- for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
+ FOR_EACH_VEC_ELT (chain_p, chains, i, chain)
{
if (chain->type == CT_INVARIANT)
execute_load_motion (loop, chain, tmp_vars);
@@ -1827,8 +1827,8 @@ replace_phis_by_defined_names (VEC (chain_p, heap) *chains)
dref a;
unsigned i, j;
- for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
- for (j = 0; VEC_iterate (dref, chain->refs, j, a); j++)
+ FOR_EACH_VEC_ELT (chain_p, chains, i, chain)
+ FOR_EACH_VEC_ELT (dref, chain->refs, j, a)
{
if (gimple_code (a->stmt) == GIMPLE_PHI)
{
@@ -1848,8 +1848,8 @@ replace_names_by_phis (VEC (chain_p, heap) *chains)
dref a;
unsigned i, j;
- for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
- for (j = 0; VEC_iterate (dref, chain->refs, j, a); j++)
+ FOR_EACH_VEC_ELT (chain_p, chains, i, chain)
+ FOR_EACH_VEC_ELT (dref, chain->refs, j, a)
if (a->stmt == NULL)
{
a->stmt = SSA_NAME_DEF_STMT (a->name_defined_by_phi);
@@ -2338,7 +2338,7 @@ try_combine_chains (VEC (chain_p, heap) **chains)
chain_p ch1, ch2, cch;
VEC (chain_p, heap) *worklist = NULL;
- for (i = 0; VEC_iterate (chain_p, *chains, i, ch1); i++)
+ FOR_EACH_VEC_ELT (chain_p, *chains, i, ch1)
if (chain_can_be_combined_p (ch1))
VEC_safe_push (chain_p, heap, worklist, ch1);
@@ -2348,7 +2348,7 @@ try_combine_chains (VEC (chain_p, heap) **chains)
if (!chain_can_be_combined_p (ch1))
continue;
- for (j = 0; VEC_iterate (chain_p, *chains, j, ch2); j++)
+ FOR_EACH_VEC_ELT (chain_p, *chains, j, ch2)
{
if (!chain_can_be_combined_p (ch2))
continue;
@@ -2385,7 +2385,7 @@ prepare_initializers_chain (struct loop *loop, chain_p chain)
/* If we have replaced some looparound phi nodes, use their initializers
instead of creating our own. */
- for (i = 0; VEC_iterate (dref, chain->refs, i, laref); i++)
+ FOR_EACH_VEC_ELT (dref, chain->refs, i, laref)
{
if (gimple_code (laref->stmt) != GIMPLE_PHI)
continue;
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 1dc612151bb..2182fef6d1e 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -538,7 +538,7 @@ dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
VEC(tree,gc) *nlv = BLOCK_NONLOCALIZED_VARS (block);
pp_string (buffer, "NONLOCALIZED_VARS: ");
- for (i = 0; VEC_iterate (tree, nlv, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, nlv, i, t)
{
dump_generic_node (buffer, t, 0, flags, false);
pp_string (buffer, " ");
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index edf8b3ef658..c7f45f229d1 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -2809,7 +2809,7 @@ number_of_iterations_for_all_loops (VEC(gimple,heap) **exit_conditions)
unsigned nb_static_loops = 0;
gimple cond;
- for (i = 0; VEC_iterate (gimple, *exit_conditions, i, cond); i++)
+ FOR_EACH_VEC_ELT (gimple, *exit_conditions, i, cond)
{
tree res = number_of_latch_executions (loop_containing_stmt (cond));
if (chrec_contains_undetermined (res))
@@ -2963,7 +2963,7 @@ analyze_scalar_evolution_for_all_loop_phi_nodes (VEC(gimple,heap) **exit_conditi
reset_chrecs_counters (&stats);
- for (i = 0; VEC_iterate (gimple, *exit_conditions, i, cond); i++)
+ FOR_EACH_VEC_ELT (gimple, *exit_conditions, i, cond)
{
struct loop *loop;
basic_block bb;
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index fb99e16cf59..1eb68221495 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1272,7 +1272,7 @@ dump_enumerated_decls (FILE *file, int flags)
fprintf (file, "Declarations used by %s, sorted by DECL_UID:\n",
current_function_name ());
- for (ix = 0; VEC_iterate (numbered_tree, decl_list, ix, ntp); ix++)
+ FOR_EACH_VEC_ELT (numbered_tree, decl_list, ix, ntp)
{
if (ntp->t == last)
continue;
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 2e65d10db9a..477c4d2b260 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1442,7 +1442,7 @@ free_mem_ref_locs (mem_ref_locs_p accs)
if (!accs)
return;
- for (i = 0; VEC_iterate (mem_ref_loc_p, accs->locs, i, loc); i++)
+ FOR_EACH_VEC_ELT (mem_ref_loc_p, accs->locs, i, loc)
free (loc);
VEC_free (mem_ref_loc_p, heap, accs->locs);
free (accs);
@@ -1463,7 +1463,7 @@ memref_free (void *obj)
BITMAP_FREE (mem->indep_ref);
BITMAP_FREE (mem->dep_ref);
- for (i = 0; VEC_iterate (mem_ref_locs_p, mem->accesses_in_loop, i, accs); i++)
+ FOR_EACH_VEC_ELT (mem_ref_locs_p, mem->accesses_in_loop, i, accs)
free_mem_ref_locs (accs);
VEC_free (mem_ref_locs_p, heap, mem->accesses_in_loop);
@@ -1929,7 +1929,7 @@ get_all_locs_in_loop (struct loop *loop, mem_ref_p ref,
accs = VEC_index (mem_ref_locs_p, ref->accesses_in_loop, loop->num);
if (accs)
{
- for (i = 0; VEC_iterate (mem_ref_loc_p, accs->locs, i, loc); i++)
+ FOR_EACH_VEC_ELT (mem_ref_loc_p, accs->locs, i, loc)
VEC_safe_push (mem_ref_loc_p, heap, *locs, loc);
}
}
@@ -1948,7 +1948,7 @@ rewrite_mem_refs (struct loop *loop, mem_ref_p ref, tree tmp_var)
VEC (mem_ref_loc_p, heap) *locs = NULL;
get_all_locs_in_loop (loop, ref, &locs);
- for (i = 0; VEC_iterate (mem_ref_loc_p, locs, i, loc); i++)
+ FOR_EACH_VEC_ELT (mem_ref_loc_p, locs, i, loc)
rewrite_mem_ref_loc (loc, tmp_var);
VEC_free (mem_ref_loc_p, heap, locs);
}
@@ -2113,7 +2113,7 @@ execute_sm (struct loop *loop, VEC (edge, heap) *exits, mem_ref_p ref)
all dependencies. */
gsi_insert_on_edge (loop_latch_edge (loop), load);
- for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, ex)
{
store = gimple_build_assign (unshare_expr (ref->mem), tmp_var);
gsi_insert_on_edge (ex, store);
@@ -2157,7 +2157,7 @@ ref_always_accessed_p (struct loop *loop, mem_ref_p ref, bool stored_p)
base = TREE_OPERAND (base, 0);
get_all_locs_in_loop (loop, ref, &locs);
- for (i = 0; VEC_iterate (mem_ref_loc_p, locs, i, loc); i++)
+ FOR_EACH_VEC_ELT (mem_ref_loc_p, locs, i, loc)
{
if (!get_lim_data (loc->stmt))
continue;
@@ -2378,7 +2378,7 @@ loop_suitable_for_sm (struct loop *loop ATTRIBUTE_UNUSED,
unsigned i;
edge ex;
- for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, ex)
if (ex->flags & EDGE_ABNORMAL)
return false;
@@ -2545,19 +2545,19 @@ tree_ssa_lim_finalize (void)
VEC_free (mem_ref_p, heap, memory_accesses.refs_list);
htab_delete (memory_accesses.refs);
- for (i = 0; VEC_iterate (bitmap, memory_accesses.refs_in_loop, i, b); i++)
+ FOR_EACH_VEC_ELT (bitmap, memory_accesses.refs_in_loop, i, b)
BITMAP_FREE (b);
VEC_free (bitmap, heap, memory_accesses.refs_in_loop);
- for (i = 0; VEC_iterate (bitmap, memory_accesses.all_refs_in_loop, i, b); i++)
+ FOR_EACH_VEC_ELT (bitmap, memory_accesses.all_refs_in_loop, i, b)
BITMAP_FREE (b);
VEC_free (bitmap, heap, memory_accesses.all_refs_in_loop);
- for (i = 0; VEC_iterate (bitmap, memory_accesses.clobbered_vops, i, b); i++)
+ FOR_EACH_VEC_ELT (bitmap, memory_accesses.clobbered_vops, i, b)
BITMAP_FREE (b);
VEC_free (bitmap, heap, memory_accesses.clobbered_vops);
- for (i = 0; VEC_iterate (htab_t, memory_accesses.vop_ref_map, i, h); i++)
+ FOR_EACH_VEC_ELT (htab_t, memory_accesses.vop_ref_map, i, h)
htab_delete (h);
VEC_free (htab_t, heap, memory_accesses.vop_ref_map);
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 0599a3683ea..b0d45bc4b41 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -403,7 +403,7 @@ try_unroll_loop_completely (struct loop *loop,
return false;
}
- for (i = 0; VEC_iterate (edge, to_remove, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, to_remove, i, e)
{
bool ok = remove_path (e);
gcc_assert (ok);
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index f0c3ca9f6d7..a347c86025a 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -6247,7 +6247,7 @@ free_loop_data (struct ivopts_data *data)
data->max_inv_id = 0;
- for (i = 0; VEC_iterate (tree, decl_rtl_to_reset, i, obj); i++)
+ FOR_EACH_VEC_ELT (tree, decl_rtl_to_reset, i, obj)
SET_DECL_RTL (obj, NULL_RTX);
VEC_truncate (tree, decl_rtl_to_reset, 0);
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index c6dc8ed55ea..dd2d3ceec7d 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -1045,7 +1045,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
free (wont_exit);
gcc_assert (ok);
- for (i = 0; VEC_iterate (edge, to_remove, i, e); i++)
+ FOR_EACH_VEC_ELT (edge, to_remove, i, e)
{
ok = remove_path (e);
gcc_assert (ok);
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 6ec0575990d..2630faf02fa 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -1907,7 +1907,7 @@ find_loop_niter (struct loop *loop, edge *exit)
struct tree_niter_desc desc;
*exit = NULL;
- for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, ex)
{
if (!just_once_each_iteration_p (loop, ex->src))
continue;
@@ -1984,7 +1984,7 @@ finite_loop_p (struct loop *loop)
}
exits = get_loop_exit_edges (loop);
- for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, ex)
{
if (!just_once_each_iteration_p (loop, ex->src))
continue;
@@ -2264,7 +2264,7 @@ find_loop_niter_by_eval (struct loop *loop, edge *exit)
&& VEC_length (edge, exits) > 1)
return chrec_dont_know;
- for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, ex)
{
if (!just_once_each_iteration_p (loop, ex->src))
continue;
@@ -2920,7 +2920,7 @@ estimate_numbers_of_iterations_loop (struct loop *loop)
loop->any_estimate = false;
exits = get_loop_exit_edges (loop);
- for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, ex)
{
if (!number_of_iterations_exit (loop, ex, &niter_desc, false))
continue;
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 4840704be19..9ad6cd2a59e 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -1196,7 +1196,7 @@ emit_mfence_after_loop (struct loop *loop)
gimple_stmt_iterator bsi;
unsigned i;
- for (i = 0; VEC_iterate (edge, exits, i, exit); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, exit)
{
call = gimple_build_call (FENCE_FOLLOWING_MOVNT, 0);
@@ -1233,7 +1233,7 @@ may_use_storent_in_loop_p (struct loop *loop)
unsigned i;
edge exit;
- for (i = 0; VEC_iterate (edge, exits, i, exit); i++)
+ FOR_EACH_VEC_ELT (edge, exits, i, exit)
if ((exit->flags & EDGE_ABNORMAL)
&& exit->dest == EXIT_BLOCK_PTR)
ret = false;
@@ -1452,7 +1452,7 @@ self_reuse_distance (data_reference_p dr, unsigned *loop_sizes, unsigned n,
strides = XCNEWVEC (HOST_WIDE_INT, n);
access_fns = DR_ACCESS_FNS (dr);
- for (i = 0; VEC_iterate (tree, access_fns, i, access_fn); i++)
+ FOR_EACH_VEC_ELT (tree, access_fns, i, access_fn)
{
/* Keep track of the reference corresponding to the subscript, so that we
know its stride. */
@@ -1574,7 +1574,7 @@ determine_loop_nest_reuse (struct loop *loop, struct mem_ref_group *refs,
no_other_refs = false;
}
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
dist = self_reuse_distance (dr, loop_data_size, n, loop);
ref = (struct mem_ref *) dr->aux;
@@ -1587,7 +1587,7 @@ determine_loop_nest_reuse (struct loop *loop, struct mem_ref_group *refs,
compute_all_dependences (datarefs, &dependences, vloops, true);
- for (i = 0; VEC_iterate (ddr_p, dependences, i, dep); i++)
+ FOR_EACH_VEC_ELT (ddr_p, dependences, i, dep)
{
if (DDR_ARE_DEPENDENT (dep) == chrec_known)
continue;
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 84f22b956ed..614546bed12 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -392,7 +392,7 @@ tree_ssa_phiprop (void)
/* Walk the dominator tree in preorder. */
bbs = get_all_dominated_blocks (CDI_DOMINATORS,
single_succ (ENTRY_BLOCK_PTR));
- for (i = 0; VEC_iterate (basic_block, bbs, i, bb); ++i)
+ FOR_EACH_VEC_ELT (basic_block, bbs, i, bb)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
did_something |= propagate_with_phi (bb, gsi_stmt (gsi), phivn, n);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index b00307aff2b..6d481231a87 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1886,7 +1886,7 @@ phi_translate_set (bitmap_set_t dest, bitmap_set_t set, basic_block pred,
}
exprs = sorted_array_from_bitmap_set (set);
- for (i = 0; VEC_iterate (pre_expr, exprs, i, expr); i++)
+ FOR_EACH_VEC_ELT (pre_expr, exprs, i, expr)
{
pre_expr translated;
translated = phi_translate (expr, set, NULL, pred, phiblock);
@@ -2150,7 +2150,7 @@ valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, pre_expr expr,
vn_reference_op_t vro;
unsigned int i;
- for (i = 0; VEC_iterate (vn_reference_op_s, ref->operands, i, vro); i++)
+ FOR_EACH_VEC_ELT (vn_reference_op_s, ref->operands, i, vro)
{
if (!vro_valid_in_sets (set1, set2, vro))
return false;
@@ -2184,7 +2184,7 @@ dependent_clean (bitmap_set_t set1, bitmap_set_t set2, basic_block block)
pre_expr expr;
int i;
- for (i = 0; VEC_iterate (pre_expr, exprs, i, expr); i++)
+ FOR_EACH_VEC_ELT (pre_expr, exprs, i, expr)
{
if (!valid_in_sets (set1, set2, expr, block))
bitmap_remove_from_set (set1, expr);
@@ -2203,7 +2203,7 @@ clean (bitmap_set_t set, basic_block block)
pre_expr expr;
int i;
- for (i = 0; VEC_iterate (pre_expr, exprs, i, expr); i++)
+ FOR_EACH_VEC_ELT (pre_expr, exprs, i, expr)
{
if (!valid_in_sets (set, NULL, expr, block))
bitmap_remove_from_set (set, expr);
@@ -2337,7 +2337,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
else
bitmap_set_copy (ANTIC_OUT, ANTIC_IN (first));
- for (i = 0; VEC_iterate (basic_block, worklist, i, bprime); i++)
+ FOR_EACH_VEC_ELT (basic_block, worklist, i, bprime)
{
if (!gimple_seq_empty_p (phi_nodes (bprime)))
{
@@ -2480,7 +2480,7 @@ compute_partial_antic_aux (basic_block block,
}
if (VEC_length (basic_block, worklist) > 0)
{
- for (i = 0; VEC_iterate (basic_block, worklist, i, bprime); i++)
+ FOR_EACH_VEC_ELT (basic_block, worklist, i, bprime)
{
unsigned int i;
bitmap_iterator bi;
@@ -3259,7 +3259,7 @@ inhibit_phi_insertion (basic_block bb, pre_expr expr)
memory reference is a simple induction variable. In other
cases the vectorizer won't do anything anyway (either it's
loop invariant or a complicated expression). */
- for (i = 0; VEC_iterate (vn_reference_op_s, ops, i, op); ++i)
+ FOR_EACH_VEC_ELT (vn_reference_op_s, ops, i, op)
{
switch (op->opcode)
{
@@ -3546,7 +3546,7 @@ do_regular_insertion (basic_block block, basic_block dom)
pre_expr expr;
int i;
- for (i = 0; VEC_iterate (pre_expr, exprs, i, expr); i++)
+ FOR_EACH_VEC_ELT (pre_expr, exprs, i, expr)
{
if (expr->kind != NAME)
{
@@ -3692,7 +3692,7 @@ do_partial_partial_insertion (basic_block block, basic_block dom)
pre_expr expr;
int i;
- for (i = 0; VEC_iterate (pre_expr, exprs, i, expr); i++)
+ FOR_EACH_VEC_ELT (pre_expr, exprs, i, expr)
{
if (expr->kind != NAME)
{
@@ -4473,7 +4473,7 @@ eliminate (void)
/* We cannot remove stmts during BB walk, especially not release SSA
names there as this confuses the VN machinery. The stmts ending
up in to_remove are either stores or simple copies. */
- for (i = 0; VEC_iterate (gimple, to_remove, i, stmt); ++i)
+ FOR_EACH_VEC_ELT (gimple, to_remove, i, stmt)
{
tree lhs = gimple_assign_lhs (stmt);
tree rhs = gimple_assign_rhs1 (stmt);
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index adc5a8dcf67..fd0a6d803d5 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1016,7 +1016,7 @@ undistribute_ops_list (enum tree_code opcode,
candidates = sbitmap_alloc (length);
sbitmap_zero (candidates);
nr_candidates = 0;
- for (i = 0; VEC_iterate (operand_entry_t, *ops, i, oe1); ++i)
+ FOR_EACH_VEC_ELT (operand_entry_t, *ops, i, oe1)
{
enum tree_code dcode;
gimple oe1def;
@@ -1067,7 +1067,7 @@ undistribute_ops_list (enum tree_code opcode,
linearize_expr_tree (&subops[i], oedef,
associative_tree_code (oecode), false);
- for (j = 0; VEC_iterate (operand_entry_t, subops[i], j, oe1); ++j)
+ FOR_EACH_VEC_ELT (operand_entry_t, subops[i], j, oe1)
{
oecount c;
void **slot;
@@ -1100,7 +1100,7 @@ undistribute_ops_list (enum tree_code opcode,
{
oecount *c;
fprintf (dump_file, "Candidates:\n");
- for (j = 0; VEC_iterate (oecount, cvec, j, c); ++j)
+ FOR_EACH_VEC_ELT (oecount, cvec, j, c)
{
fprintf (dump_file, " %u %s: ", c->cnt,
c->oecode == MULT_EXPR
@@ -1139,7 +1139,7 @@ undistribute_ops_list (enum tree_code opcode,
if (oecode != c->oecode)
continue;
- for (j = 0; VEC_iterate (operand_entry_t, subops[i], j, oe1); ++j)
+ FOR_EACH_VEC_ELT (operand_entry_t, subops[i], j, oe1)
{
if (oe1->op == c->op)
{
@@ -1864,7 +1864,7 @@ repropagate_negates (void)
unsigned int i = 0;
tree negate;
- for (i = 0; VEC_iterate (tree, plus_negates, i, negate); i++)
+ FOR_EACH_VEC_ELT (tree, plus_negates, i, negate)
{
gimple user = get_single_immediate_use (negate);
@@ -2148,7 +2148,7 @@ dump_ops_vector (FILE *file, VEC (operand_entry_t, heap) *ops)
operand_entry_t oe;
unsigned int i;
- for (i = 0; VEC_iterate (operand_entry_t, ops, i, oe); i++)
+ FOR_EACH_VEC_ELT (operand_entry_t, ops, i, oe)
{
fprintf (file, "Op %d -> rank: %d, tree: ", i, oe->rank);
print_generic_expr (file, oe->op, 0);
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 21662d65713..cbf0e25712f 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -432,7 +432,7 @@ vn_reference_compute_hash (const vn_reference_t vr1)
HOST_WIDE_INT off = -1;
bool deref = false;
- for (i = 0; VEC_iterate (vn_reference_op_s, vr1->operands, i, vro); i++)
+ FOR_EACH_VEC_ELT (vn_reference_op_s, vr1->operands, i, vro)
{
if (vro->opcode == MEM_REF)
deref = true;
@@ -769,7 +769,7 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
/* Compute cumulative bit-offset for nested component-refs and array-refs,
and find the ultimate containing object. */
- for (i = 0; VEC_iterate (vn_reference_op_s, ops, i, op); ++i)
+ FOR_EACH_VEC_ELT (vn_reference_op_s, ops, i, op)
{
switch (op->opcode)
{
@@ -1140,7 +1140,7 @@ valueize_refs (VEC (vn_reference_op_s, heap) *orig)
vn_reference_op_t vro;
unsigned int i;
- for (i = 0; VEC_iterate (vn_reference_op_s, orig, i, vro); i++)
+ FOR_EACH_VEC_ELT (vn_reference_op_s, orig, i, vro)
{
if (vro->opcode == SSA_NAME
|| (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME))
@@ -1436,7 +1436,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
else
VEC_truncate (vn_reference_op_s, vr->operands,
i + 1 + VEC_length (vn_reference_op_s, rhs));
- for (j = 0; VEC_iterate (vn_reference_op_s, rhs, j, vro); ++j)
+ FOR_EACH_VEC_ELT (vn_reference_op_s, rhs, j, vro)
VEC_replace (vn_reference_op_s, vr->operands, i + 1 + j, vro);
VEC_free (vn_reference_op_s, heap, rhs);
vr->hashcode = vn_reference_compute_hash (vr);
@@ -1933,7 +1933,7 @@ vn_phi_compute_hash (vn_phi_t vp1)
+ (INTEGRAL_TYPE_P (type)
? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0));
- for (i = 0; VEC_iterate (tree, vp1->phiargs, i, phi1op); i++)
+ FOR_EACH_VEC_ELT (tree, vp1->phiargs, i, phi1op)
{
if (phi1op == VN_TOP)
continue;
@@ -1976,7 +1976,7 @@ vn_phi_eq (const void *p1, const void *p2)
/* Any phi in the same block will have it's arguments in the
same edge order, because of how we store phi nodes. */
- for (i = 0; VEC_iterate (tree, vp1->phiargs, i, phi1op); i++)
+ FOR_EACH_VEC_ELT (tree, vp1->phiargs, i, phi1op)
{
tree phi2op = VEC_index (tree, vp2->phiargs, i);
if (phi1op == VN_TOP || phi2op == VN_TOP)
@@ -2067,7 +2067,7 @@ print_scc (FILE *out, VEC (tree, heap) *scc)
unsigned int i;
fprintf (out, "SCC consists of: ");
- for (i = 0; VEC_iterate (tree, scc, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, scc, i, var)
{
print_generic_expr (out, var, 0);
fprintf (out, " ");
@@ -3131,9 +3131,9 @@ process_scc (VEC (tree, heap) *scc)
gcc_obstack_init (&optimistic_info->nary_obstack);
empty_alloc_pool (optimistic_info->phis_pool);
empty_alloc_pool (optimistic_info->references_pool);
- for (i = 0; VEC_iterate (tree, scc, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, scc, i, var)
VN_INFO (var)->expr = NULL_TREE;
- for (i = 0; VEC_iterate (tree, scc, i, var); i++)
+ FOR_EACH_VEC_ELT (tree, scc, i, var)
changed |= visit_use (var);
}
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 37fc6f83a38..ef09014f0d3 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -814,7 +814,7 @@ dump_constraint_graph (FILE *file)
/* Go over the list of constraints printing the edges in the constraint
graph. */
fprintf (file, "\n // The constraint edges:\n");
- for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
+ FOR_EACH_VEC_ELT (constraint_t, constraints, i, c)
if (c)
dump_constraint_edge (file, c);
@@ -939,7 +939,7 @@ constraint_set_union (VEC(constraint_t,heap) **to,
int i;
constraint_t c;
- for (i = 0; VEC_iterate (constraint_t, *from, i, c); i++)
+ FOR_EACH_VEC_ELT (constraint_t, *from, i, c)
{
if (constraint_vec_find (*to, *c) == NULL)
{
@@ -1096,7 +1096,7 @@ merge_node_constraints (constraint_graph_t graph, unsigned int to,
gcc_assert (find (from) == to);
/* Move all complex constraints from src node into to node */
- for (i = 0; VEC_iterate (constraint_t, graph->complex[from], i, c); i++)
+ FOR_EACH_VEC_ELT (constraint_t, graph->complex[from], i, c)
{
/* In complex constraints for node src, we may have either
a = *src, and *src = a, or an offseted constraint which are
@@ -1280,7 +1280,7 @@ build_pred_graph (void)
for (j = 0; j < VEC_length (varinfo_t, varmap); j++)
graph->indirect_cycles[j] = -1;
- for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
+ FOR_EACH_VEC_ELT (constraint_t, constraints, i, c)
{
struct constraint_expr lhs = c->lhs;
struct constraint_expr rhs = c->rhs;
@@ -1359,7 +1359,7 @@ build_succ_graph (void)
unsigned i, t;
constraint_t c;
- for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
+ FOR_EACH_VEC_ELT (constraint_t, constraints, i, c)
{
struct constraint_expr lhs;
struct constraint_expr rhs;
@@ -2437,7 +2437,7 @@ move_complex_constraints (constraint_graph_t graph)
int i;
constraint_t c;
- for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
+ FOR_EACH_VEC_ELT (constraint_t, constraints, i, c)
{
if (c)
{
@@ -2478,7 +2478,7 @@ rewrite_constraints (constraint_graph_t graph,
for (j = 0; j < graph->size; j++)
gcc_assert (find (j) == j);
- for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
+ FOR_EACH_VEC_ELT (constraint_t, constraints, i, c)
{
struct constraint_expr lhs = c->lhs;
struct constraint_expr rhs = c->rhs;
@@ -2654,7 +2654,7 @@ solve_graph (constraint_graph_t graph)
solution_empty = bitmap_empty_p (solution);
/* Process the complex constraints */
- for (j = 0; VEC_iterate (constraint_t, complex, j, c); j++)
+ FOR_EACH_VEC_ELT (constraint_t, complex, j, c)
{
/* XXX: This is going to unsort the constraints in
some cases, which will occasionally add duplicate
@@ -3239,7 +3239,7 @@ do_deref (VEC (ce_s, heap) **constraints)
struct constraint_expr *c;
unsigned int i = 0;
- for (i = 0; VEC_iterate (ce_s, *constraints, i, c); i++)
+ FOR_EACH_VEC_ELT (ce_s, *constraints, i, c)
{
if (c->type == SCALAR)
c->type = DEREF;
@@ -3270,7 +3270,7 @@ get_constraint_for_address_of (tree t, VEC (ce_s, heap) **results)
get_constraint_for_1 (t, results, true);
- for (i = 0; VEC_iterate (ce_s, *results, i, c); i++)
+ FOR_EACH_VEC_ELT (ce_s, *results, i, c)
{
if (c->type == DEREF)
c->type = SCALAR;
@@ -3383,7 +3383,7 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
struct constraint_expr *rhsp;
unsigned j;
get_constraint_for_1 (val, &tmp, address_p);
- for (j = 0; VEC_iterate (ce_s, tmp, j, rhsp); ++j)
+ FOR_EACH_VEC_ELT (ce_s, tmp, j, rhsp)
VEC_safe_push (ce_s, heap, *results, rhsp);
VEC_truncate (ce_s, tmp, 0);
}
@@ -3435,17 +3435,17 @@ process_all_all_constraints (VEC (ce_s, heap) *lhsc, VEC (ce_s, heap) *rhsc)
if (VEC_length (ce_s, lhsc) <= 1
|| VEC_length (ce_s, rhsc) <= 1)
{
- for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); ++i)
- for (j = 0; VEC_iterate (ce_s, rhsc, j, rhsp); ++j)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, j, rhsp)
process_constraint (new_constraint (*lhsp, *rhsp));
}
else
{
struct constraint_expr tmp;
tmp = new_scalar_tmp_constraint_exp ("allalltmp");
- for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); ++i)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (tmp, *rhsp));
- for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); ++i)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (*lhsp, tmp));
}
}
@@ -3532,7 +3532,7 @@ make_constraint_to (unsigned id, tree op)
includes.type = SCALAR;
get_constraint_for (op, &rhsc);
- for (j = 0; VEC_iterate (ce_s, rhsc, j, c); j++)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, j, c)
process_constraint (new_constraint (includes, *c));
VEC_free (ce_s, heap, rhsc);
}
@@ -3795,7 +3795,7 @@ handle_rhs_call (gimple stmt, VEC(ce_s, heap) **results)
lhsc.var = escaped_id;
lhsc.offset = 0;
lhsc.type = SCALAR;
- for (i = 0; VEC_iterate (ce_s, tmpc, i, c); ++i)
+ FOR_EACH_VEC_ELT (ce_s, tmpc, i, c)
process_constraint (new_constraint (lhsc, *c));
VEC_free(ce_s, heap, tmpc);
}
@@ -3905,7 +3905,7 @@ handle_const_call (gimple stmt, VEC(ce_s, heap) **results)
unsigned i;
struct constraint_expr *argp;
get_constraint_for (arg, &argc);
- for (i = 0; VEC_iterate (ce_s, argc, i, argp); ++i)
+ FOR_EACH_VEC_ELT (ce_s, argc, i, argp)
VEC_safe_push (ce_s, heap, *results, argp);
VEC_free(ce_s, heap, argc);
}
@@ -4040,7 +4040,7 @@ find_func_aliases (gimple origt)
STRIP_NOPS (strippedrhs);
get_constraint_for (gimple_phi_arg_def (t, i), &rhsc);
- for (j = 0; VEC_iterate (ce_s, lhsc, j, c); j++)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, j, c)
{
struct constraint_expr *c2;
while (VEC_length (ce_s, rhsc) > 0)
@@ -4141,7 +4141,7 @@ find_func_aliases (gimple origt)
ac.var = integer_id;
}
ac.offset = 0;
- for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); ++i)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (*lhsp, ac));
VEC_free (ce_s, heap, lhsc);
return;
@@ -4187,7 +4187,7 @@ find_func_aliases (gimple origt)
{
lhs = get_function_part_constraint (nfi, fi_static_chain);
get_constraint_for (frame, &rhsc);
- for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); ++i)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
VEC_free (ce_s, heap, rhsc);
@@ -4239,7 +4239,7 @@ find_func_aliases (gimple origt)
do_deref (&lhsc);
rhs = get_function_part_constraint (fi, ~0);
rhs.type = ADDRESSOF;
- for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); ++i)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (*lhsp, rhs));
VEC_free (ce_s, heap, lhsc);
/* va_list is clobbered. */
@@ -4352,7 +4352,7 @@ find_func_aliases (gimple origt)
rhs = *VEC_index (ce_s, tem, 0);
VEC_free(ce_s, heap, tem);
}
- for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, j, lhsp)
process_constraint (new_constraint (*lhsp, rhs));
}
@@ -4367,7 +4367,7 @@ find_func_aliases (gimple origt)
get_constraint_for_address_of (lhsop, &rhsc);
lhs = get_function_part_constraint (fi, fi_result);
- for (j = 0; VEC_iterate (ce_s, rhsc, j, rhsp); j++)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, j, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
VEC_free (ce_s, heap, rhsc);
}
@@ -4380,7 +4380,7 @@ find_func_aliases (gimple origt)
get_constraint_for (gimple_call_chain (t), &rhsc);
lhs = get_function_part_constraint (fi, fi_static_chain);
- for (j = 0; VEC_iterate (ce_s, rhsc, j, rhsp); j++)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, j, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
}
}
@@ -4469,7 +4469,7 @@ find_func_aliases (gimple origt)
lhs = get_function_part_constraint (fi, fi_result);
get_constraint_for (gimple_return_retval (t), &rhsc);
- for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); i++)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
}
}
@@ -4509,7 +4509,7 @@ find_func_aliases (gimple origt)
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, j, lhsp)
process_constraint (new_constraint (*lhsp, rhsc));
VEC_free (ce_s, heap, lhsc);
}
@@ -4551,7 +4551,7 @@ process_ipa_clobber (varinfo_t fi, tree ptr)
unsigned i;
get_constraint_for (ptr, &ptrc);
lhs = get_function_part_constraint (fi, fi_clobbers);
- for (i = 0; VEC_iterate (ce_s, ptrc, i, c); i++)
+ FOR_EACH_VEC_ELT (ce_s, ptrc, i, c)
process_constraint (new_constraint (lhs, *c));
VEC_free (ce_s, heap, ptrc);
}
@@ -4602,7 +4602,7 @@ find_func_clobbers (gimple origt)
unsigned i;
lhsc = get_function_part_constraint (fi, fi_clobbers);
get_constraint_for_address_of (lhs, &rhsc);
- for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); i++)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhsc, *rhsp));
VEC_free (ce_s, heap, rhsc);
}
@@ -4630,7 +4630,7 @@ find_func_clobbers (gimple origt)
unsigned i;
lhs = get_function_part_constraint (fi, fi_uses);
get_constraint_for_address_of (rhs, &rhsc);
- for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); i++)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
VEC_free (ce_s, heap, rhsc);
}
@@ -4670,12 +4670,12 @@ find_func_clobbers (gimple origt)
struct constraint_expr *rhsp, *lhsp;
get_constraint_for_ptr_offset (dest, NULL_TREE, &lhsc);
lhs = get_function_part_constraint (fi, fi_clobbers);
- for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); i++)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (lhs, *lhsp));
VEC_free (ce_s, heap, lhsc);
get_constraint_for_ptr_offset (src, NULL_TREE, &rhsc);
lhs = get_function_part_constraint (fi, fi_uses);
- for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); i++)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
VEC_free (ce_s, heap, rhsc);
return;
@@ -4689,7 +4689,7 @@ find_func_clobbers (gimple origt)
ce_s *lhsp;
get_constraint_for_ptr_offset (dest, NULL_TREE, &lhsc);
lhs = get_function_part_constraint (fi, fi_clobbers);
- for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); i++)
+ FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (lhs, *lhsp));
VEC_free (ce_s, heap, lhsc);
return;
@@ -4758,7 +4758,7 @@ find_func_clobbers (gimple origt)
continue;
get_constraint_for_address_of (arg, &rhsc);
- for (j = 0; VEC_iterate (ce_s, rhsc, j, rhsp); j++)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, j, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
VEC_free (ce_s, heap, rhsc);
}
@@ -5269,7 +5269,7 @@ check_for_overlaps (VEC (fieldoff_s,heap) *fieldstack)
unsigned int i;
HOST_WIDE_INT lastoffset = -1;
- for (i = 0; VEC_iterate (fieldoff_s, fieldstack, i, fo); i++)
+ FOR_EACH_VEC_ELT (fieldoff_s, fieldstack, i, fo)
{
if (fo->offset == lastoffset)
return true;
@@ -5434,7 +5434,7 @@ create_variable_info_for (tree decl, const char *name)
lhs.var = vi->id;
lhs.offset = 0;
lhs.type = SCALAR;
- for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); ++i)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
/* If this is a variable that escapes from the unit
the initializer escapes as well. */
@@ -5443,7 +5443,7 @@ create_variable_info_for (tree decl, const char *name)
lhs.var = escaped_id;
lhs.offset = 0;
lhs.type = SCALAR;
- for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); ++i)
+ FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
}
VEC_free (ce_s, heap, rhsc);
@@ -6468,7 +6468,7 @@ compute_points_to_sets (void)
cfun->gimple_df->escaped.escaped = 0;
/* Mark escaped HEAP variables as global. */
- for (i = 0; VEC_iterate (varinfo_t, varmap, i, vi); ++i)
+ FOR_EACH_VEC_ELT (varinfo_t, varmap, i, vi)
if (vi->is_heap_var
&& !vi->is_restrict_var
&& !vi->is_global_var)
@@ -6846,7 +6846,7 @@ ipa_pta_execute (void)
fn = DECL_STRUCT_FUNCTION (node->decl);
/* Compute the points-to sets for pointer SSA_NAMEs. */
- for (i = 0; VEC_iterate (tree, fn->gimple_df->ssa_names, i, ptr); ++i)
+ FOR_EACH_VEC_ELT (tree, fn->gimple_df->ssa_names, i, ptr)
{
if (ptr
&& POINTER_TYPE_P (TREE_TYPE (ptr)))
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 687c6393aaa..16f85f5d868 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -2040,7 +2040,7 @@ execute_update_addresses_taken (bool do_optimize)
differences for -g vs. -g0. */
for (var = DECL_ARGUMENTS (cfun->decl); var; var = DECL_CHAIN (var))
update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs);
- for (i = 0; VEC_iterate (tree, cfun->local_decls, i, var); ++i)
+ FOR_EACH_VEC_ELT (tree, cfun->local_decls, i, var)
update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs);
}
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 3f63a7fabad..2408b45535e 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -595,7 +595,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
}
loop_depth = index_in_loop_nest (loop->num, DDR_LOOP_NEST (ddr));
- for (i = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), i, dist_v); i++)
+ FOR_EACH_VEC_ELT (lambda_vector, DDR_DIST_VECTS (ddr), i, dist_v)
{
int dist = dist_v[loop_depth];
@@ -692,7 +692,7 @@ vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo,
else
ddrs = BB_VINFO_DDRS (bb_vinfo);
- for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, ddrs, i, ddr)
if (vect_analyze_data_ref_dependence (ddr, loop_vinfo, max_vf))
return false;
@@ -866,7 +866,7 @@ vect_compute_data_refs_alignment (loop_vec_info loop_vinfo,
else
datarefs = BB_VINFO_DATAREFS (bb_vinfo);
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
if (STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr)))
&& !vect_compute_data_ref_alignment (dr))
{
@@ -915,7 +915,7 @@ vect_update_misalignment_for_peel (struct data_reference *dr,
are aligned in the vector loop. */
same_align_drs
= STMT_VINFO_SAME_ALIGN_REFS (vinfo_for_stmt (DR_STMT (dr_peel)));
- for (i = 0; VEC_iterate (dr_p, same_align_drs, i, current_dr); i++)
+ FOR_EACH_VEC_ELT (dr_p, same_align_drs, i, current_dr)
{
if (current_dr != dr)
continue;
@@ -960,7 +960,7 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
else
datarefs = BB_VINFO_DATAREFS (bb_vinfo);
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
gimple stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -1186,7 +1186,7 @@ vect_peeling_hash_get_lowest_cost (void **slot, void *data)
VEC (data_reference_p, heap) *datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
struct data_reference *dr;
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
stmt = DR_STMT (dr);
stmt_info = vinfo_for_stmt (stmt);
@@ -1397,7 +1397,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
- The cost of peeling (the extra runtime checks, the increase
in code size). */
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
stmt = DR_STMT (dr);
stmt_info = vinfo_for_stmt (stmt);
@@ -1643,7 +1643,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
}
/* Ensure that all data refs can be vectorized after the peel. */
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
int save_misalignment;
@@ -1688,7 +1688,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
by the peeling factor times the element size of DR_i (MOD the
vectorization factor times the size). Otherwise, the
misalignment of DR_i must be set to unknown. */
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
if (dr != dr0)
vect_update_misalignment_for_peel (dr, dr0, npeel);
@@ -1728,7 +1728,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (do_versioning)
{
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
stmt = DR_STMT (dr);
stmt_info = vinfo_for_stmt (stmt);
@@ -1797,7 +1797,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
/* It can now be assumed that the data references in the statements
in LOOP_VINFO_MAY_MISALIGN_STMTS will be aligned in the version
of the loop being vectorized. */
- for (i = 0; VEC_iterate (gimple, may_misalign_stmts, i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, may_misalign_stmts, i, stmt)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
dr = STMT_VINFO_DATA_REF (stmt_info);
@@ -1860,7 +1860,7 @@ vect_find_same_alignment_drs (struct data_dependence_relation *ddr,
return;
loop_depth = index_in_loop_nest (loop->num, DDR_LOOP_NEST (ddr));
- for (i = 0; VEC_iterate (lambda_vector, DDR_DIST_VECTS (ddr), i, dist_v); i++)
+ FOR_EACH_VEC_ELT (lambda_vector, DDR_DIST_VECTS (ddr), i, dist_v)
{
int dist = dist_v[loop_depth];
@@ -1908,7 +1908,7 @@ vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo,
struct data_dependence_relation *ddr;
unsigned int i;
- for (i = 0; VEC_iterate (ddr_p, ddrs, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, ddrs, i, ddr)
vect_find_same_alignment_drs (ddr, loop_vinfo);
}
@@ -2254,7 +2254,7 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
else
datarefs = BB_VINFO_DATAREFS (bb_vinfo);
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
if (STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr)))
&& !vect_analyze_data_ref_access (dr))
{
@@ -2415,7 +2415,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
/* Go through the data-refs, check that the analysis succeeded. Update pointer
from stmt_vec_info struct to DR and vectype. */
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
{
gimple stmt;
stmt_vec_info stmt_info;
@@ -3890,7 +3890,7 @@ vect_transform_strided_load (gimple stmt, VEC(tree,heap) *dr_chain, int size,
corresponds the order of data-refs in RESULT_CHAIN. */
next_stmt = first_stmt;
gap_count = 1;
- for (i = 0; VEC_iterate (tree, result_chain, i, tmp_data_ref); i++)
+ FOR_EACH_VEC_ELT (tree, result_chain, i, tmp_data_ref)
{
if (!next_stmt)
break;
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 82f0a7867ac..5771c51235d 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -2105,7 +2105,7 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters)
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_update_inits_of_dr ===");
- for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
+ FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, dr)
vect_update_init_of_dr (dr, niters);
}
@@ -2229,7 +2229,7 @@ vect_create_cond_for_align_checks (loop_vec_info loop_vinfo,
/* Create expression (mask & (dr_1 || ... || dr_n)) where dr_i is the address
of the first vector of the i'th data reference. */
- for (i = 0; VEC_iterate (gimple, may_misalign_stmts, i, ref_stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, may_misalign_stmts, i, ref_stmt)
{
gimple_seq new_stmt_list = NULL;
tree addr_base;
@@ -2380,7 +2380,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
if (VEC_empty (ddr_p, may_alias_ddrs))
return;
- for (i = 0; VEC_iterate (ddr_p, may_alias_ddrs, i, ddr); i++)
+ FOR_EACH_VEC_ELT (ddr_p, may_alias_ddrs, i, ddr)
{
struct data_reference *dr_a, *dr_b;
gimple dr_group_first_a, dr_group_first_b;
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index fcd4081c410..371d30d72d9 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -840,7 +840,7 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
VEC_free (gimple, heap, LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo));
VEC_free (ddr_p, heap, LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo));
slp_instances = LOOP_VINFO_SLP_INSTANCES (loop_vinfo);
- for (j = 0; VEC_iterate (slp_instance, slp_instances, j, instance); j++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, j, instance)
vect_free_slp_instance (instance);
VEC_free (slp_instance, heap, LOOP_VINFO_SLP_INSTANCES (loop_vinfo));
@@ -2330,7 +2330,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo)
/* Add SLP costs. */
slp_instances = LOOP_VINFO_SLP_INSTANCES (loop_vinfo);
- for (i = 0; VEC_iterate (slp_instance, slp_instances, i, instance); i++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance)
{
vec_outside_cost += SLP_INSTANCE_OUTSIDE_OF_LOOP_COST (instance);
vec_inside_cost += SLP_INSTANCE_INSIDE_OF_LOOP_COST (instance);
@@ -3179,7 +3179,7 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
}
/* Set phi nodes arguments. */
- for (i = 0; VEC_iterate (gimple, reduction_phis, i, phi); i++)
+ FOR_EACH_VEC_ELT (gimple, reduction_phis, i, phi)
{
tree vec_init_def = VEC_index (tree, vec_initial_defs, i);
tree def = VEC_index (tree, vect_defs, i);
@@ -3245,7 +3245,7 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
exit_bb = single_exit (loop)->dest;
prev_phi_info = NULL;
new_phis = VEC_alloc (gimple, heap, VEC_length (tree, vect_defs));
- for (i = 0; VEC_iterate (tree, vect_defs, i, def); i++)
+ FOR_EACH_VEC_ELT (tree, vect_defs, i, def)
{
for (j = 0; j < ncopies; j++)
{
@@ -3424,7 +3424,7 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
fprintf (vect_dump, "Reduce using scalar code. ");
vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
- for (i = 0; VEC_iterate (gimple, new_phis, i, new_phi); i++)
+ FOR_EACH_VEC_ELT (gimple, new_phis, i, new_phi)
{
vec_temp = PHI_RESULT (new_phi);
rhs = build3 (BIT_FIELD_REF, scalar_type, vec_temp, bitsize,
@@ -3647,7 +3647,7 @@ vect_finalize_reduction:
form. */
gcc_assert (!VEC_empty (gimple, phis));
- for (i = 0; VEC_iterate (gimple, phis, i, exit_phi); i++)
+ FOR_EACH_VEC_ELT (gimple, phis, i, exit_phi)
{
if (outer_loop)
{
@@ -3786,7 +3786,7 @@ vect_finalize_reduction:
}
}
- for (i = 0; VEC_iterate (gimple, phis, i, exit_phi); i++)
+ FOR_EACH_VEC_ELT (gimple, phis, i, exit_phi)
{
/* Replace the uses: */
orig_name = PHI_RESULT (exit_phi);
@@ -4346,7 +4346,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
STMT_VINFO_RELATED_STMT (prev_phi_info) = new_phi;
}
- for (i = 0; VEC_iterate (tree, vec_oprnds0, i, def0); i++)
+ FOR_EACH_VEC_ELT (tree, vec_oprnds0, i, def0)
{
if (slp_node)
reduc_def = PHI_RESULT (VEC_index (gimple, phis, i));
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 19df13f63a4..0d5824c9773 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -746,9 +746,7 @@ vect_pattern_recog_1 (
/* Patterns cannot be vectorized using SLP, because they change the order of
computation. */
- for (i = 0; VEC_iterate (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i,
- next);
- i++)
+ FOR_EACH_VEC_ELT (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i, next)
if (next == stmt)
VEC_ordered_remove (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i);
}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 7f219d56d89..135e1cbcaf1 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -337,7 +337,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
gimple first_load, prev_first_load = NULL;
/* For every stmt in NODE find its def stmt/s. */
- for (i = 0; VEC_iterate (gimple, stmts, i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, stmts, i, stmt)
{
if (vect_print_dump_info (REPORT_SLP))
{
@@ -715,7 +715,7 @@ vect_print_slp_tree (slp_tree node)
return;
fprintf (vect_dump, "node ");
- for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
{
fprintf (vect_dump, "\n\tstmt %d ", i);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
@@ -741,7 +741,7 @@ vect_mark_slp_stmts (slp_tree node, enum slp_vect_type mark, int j)
if (!node)
return;
- for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
if (j < 0 || i == j)
STMT_SLP_TYPE (vinfo_for_stmt (stmt)) = mark;
@@ -762,7 +762,7 @@ vect_mark_slp_stmts_relevant (slp_tree node)
if (!node)
return;
- for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
{
stmt_info = vinfo_for_stmt (stmt);
gcc_assert (!STMT_VINFO_RELEVANT (stmt_info)
@@ -857,7 +857,7 @@ vect_slp_rearrange_stmts (slp_tree node, unsigned int group_size,
for (i = 0; i < group_size; i++)
VEC_safe_push (gimple, heap, tmp_stmts, NULL);
- for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
{
index = VEC_index (int, permutation, i);
VEC_replace (gimple, tmp_stmts, index, stmt);
@@ -891,7 +891,7 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
if (vect_print_dump_info (REPORT_SLP))
{
fprintf (vect_dump, "Load permutation ");
- for (i = 0; VEC_iterate (int, load_permutation, i, next); i++)
+ FOR_EACH_VEC_ELT (int, load_permutation, i, next)
fprintf (vect_dump, "%d ", next);
}
@@ -903,9 +903,7 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
permutation). */
/* Check that all the load nodes are of the same size. */
- for (i = 0;
- VEC_iterate (slp_tree, SLP_INSTANCE_LOADS (slp_instn), i, node);
- i++)
+ FOR_EACH_VEC_ELT (slp_tree, SLP_INSTANCE_LOADS (slp_instn), i, node)
{
if (VEC_length (gimple, SLP_TREE_SCALAR_STMTS (node))
!= (unsigned) group_size)
@@ -926,13 +924,9 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
chains are mixed, they match the above pattern. */
if (complex_numbers)
{
- for (i = 0;
- VEC_iterate (slp_tree, SLP_INSTANCE_LOADS (slp_instn), i, node);
- i++)
+ FOR_EACH_VEC_ELT (slp_tree, SLP_INSTANCE_LOADS (slp_instn), i, node)
{
- for (j = 0;
- VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), j, stmt);
- j++)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), j, stmt)
{
if (j == 0)
first = stmt;
@@ -1080,12 +1074,8 @@ vect_find_first_load_in_slp_instance (slp_instance instance)
slp_tree load_node;
gimple first_load = NULL, load;
- for (i = 0;
- VEC_iterate (slp_tree, SLP_INSTANCE_LOADS (instance), i, load_node);
- i++)
- for (j = 0;
- VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (load_node), j, load);
- j++)
+ FOR_EACH_VEC_ELT (slp_tree, SLP_INSTANCE_LOADS (instance), i, load_node)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (load_node), j, load)
first_load = get_earlier_stmt (load, first_load);
return first_load;
@@ -1289,7 +1279,7 @@ vect_analyze_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
strided_stores = BB_VINFO_STRIDED_STORES (bb_vinfo);
/* Find SLP sequences starting from groups of strided stores. */
- for (i = 0; VEC_iterate (gimple, strided_stores, i, store); i++)
+ FOR_EACH_VEC_ELT (gimple, strided_stores, i, store)
if (vect_analyze_slp_instance (loop_vinfo, bb_vinfo, store))
ok = true;
@@ -1325,7 +1315,7 @@ vect_make_slp_decision (loop_vec_info loop_vinfo)
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "=== vect_make_slp_decision ===");
- for (i = 0; VEC_iterate (slp_instance, slp_instances, i, instance); i++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance)
{
/* FORNOW: SLP if you can. */
if (unrolling_factor < SLP_INSTANCE_UNROLLING_FACTOR (instance))
@@ -1361,7 +1351,7 @@ vect_detect_hybrid_slp_stmts (slp_tree node)
if (!node)
return;
- for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
if (PURE_SLP_STMT (vinfo_for_stmt (stmt))
&& TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME)
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, gimple_op (stmt, 0))
@@ -1391,7 +1381,7 @@ vect_detect_hybrid_slp (loop_vec_info loop_vinfo)
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "=== vect_detect_hybrid_slp ===");
- for (i = 0; VEC_iterate (slp_instance, slp_instances, i, instance); i++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance)
vect_detect_hybrid_slp_stmts (SLP_INSTANCE_TREE (instance));
}
@@ -1471,7 +1461,7 @@ vect_slp_analyze_node_operations (bb_vec_info bb_vinfo, slp_tree node)
|| !vect_slp_analyze_node_operations (bb_vinfo, SLP_TREE_RIGHT (node)))
return false;
- for (i = 0; VEC_iterate (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt); i++)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
gcc_assert (stmt_info);
@@ -1532,7 +1522,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo)
int dummy = 0;
/* Calculate vector costs. */
- for (i = 0; VEC_iterate (slp_instance, slp_instances, i, instance); i++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance)
{
vec_outside_cost += SLP_INSTANCE_OUTSIDE_OF_LOOP_COST (instance);
vec_inside_cost += SLP_INSTANCE_INSIDE_OF_LOOP_COST (instance);
@@ -1699,7 +1689,7 @@ vect_slp_analyze_bb (basic_block bb)
/* Mark all the statements that we want to vectorize as pure SLP and
relevant. */
- for (i = 0; VEC_iterate (slp_instance, slp_instances, i, instance); i++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance)
{
vect_mark_slp_stmts (SLP_INSTANCE_TREE (instance), pure_slp, -1);
vect_mark_slp_stmts_relevant (SLP_INSTANCE_TREE (instance));
@@ -1750,7 +1740,7 @@ vect_update_slp_costs_according_to_vf (loop_vec_info loop_vinfo)
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "=== vect_update_slp_costs_according_to_vf ===");
- for (i = 0; VEC_iterate (slp_instance, slp_instances, i, instance); i++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance)
/* We assume that costs are linear in ncopies. */
SLP_INSTANCE_INSIDE_OF_LOOP_COST (instance) *= vf
/ SLP_INSTANCE_UNROLLING_FACTOR (instance);
@@ -1965,9 +1955,7 @@ vect_get_slp_vect_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds)
gcc_assert (SLP_TREE_VEC_STMTS (slp_node));
- for (i = 0;
- VEC_iterate (gimple, SLP_TREE_VEC_STMTS (slp_node), i, vec_def_stmt);
- i++)
+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_VEC_STMTS (slp_node), i, vec_def_stmt)
{
gcc_assert (vec_def_stmt);
vec_oprnd = gimple_get_lhs (vec_def_stmt);
@@ -2281,10 +2269,7 @@ vect_transform_slp_perm_load (gimple stmt, VEC (tree, heap) *dr_chain,
we need the second and the third vectors: {b1,c1,a2,b2} and
{c2,a3,b3,c3}. */
- for (i = 0;
- VEC_iterate (slp_tree, SLP_INSTANCE_LOADS (slp_node_instance),
- i, node);
- i++)
+ FOR_EACH_VEC_ELT (slp_tree, SLP_INSTANCE_LOADS (slp_node_instance), i, node)
{
scalar_index = 0;
index = 0;
@@ -2404,9 +2389,7 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
all the nodes that participate in that permutation. */
if (SLP_INSTANCE_LOAD_PERMUTATION (instance))
{
- for (i = 0;
- VEC_iterate (slp_tree, SLP_INSTANCE_LOADS (instance), i, loads_node);
- i++)
+ FOR_EACH_VEC_ELT (slp_tree, SLP_INSTANCE_LOADS (instance), i, loads_node)
{
if (!SLP_TREE_VEC_STMTS (loads_node))
{
@@ -2461,7 +2444,7 @@ vect_schedule_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
vf = 1;
}
- for (i = 0; VEC_iterate (slp_instance, slp_instances, i, instance); i++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance)
{
/* Schedule the tree of INSTANCE. */
is_store = vect_schedule_slp_instance (SLP_INSTANCE_TREE (instance),
@@ -2471,7 +2454,7 @@ vect_schedule_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
fprintf (vect_dump, "vectorizing stmts using SLP.");
}
- for (i = 0; VEC_iterate (slp_instance, slp_instances, i, instance); i++)
+ FOR_EACH_VEC_ELT (slp_instance, slp_instances, i, instance)
{
slp_tree root = SLP_INSTANCE_TREE (instance);
gimple store;
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index e0ae55904da..433416d555e 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1803,7 +1803,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
builtin_decl =
targetm.vectorize.builtin_conversion (code,
vectype_out, vectype_in);
- for (i = 0; VEC_iterate (tree, vec_oprnds0, i, vop0); i++)
+ FOR_EACH_VEC_ELT (tree, vec_oprnds0, i, vop0)
{
/* Arguments are ready. create the new vector stmt. */
new_stmt = gimple_build_call (builtin_decl, 1, vop0);
@@ -2004,7 +2004,7 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi,
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds, NULL);
/* Arguments are ready. create the new vector stmt. */
- for (i = 0; VEC_iterate (tree, vec_oprnds, i, vop); i++)
+ FOR_EACH_VEC_ELT (tree, vec_oprnds, i, vop)
{
if (CONVERT_EXPR_CODE_P (code))
vop = build1 (VIEW_CONVERT_EXPR, vectype, vop);
@@ -2382,7 +2382,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
vect_get_vec_defs_for_stmt_copy (dt, &vec_oprnds0, &vec_oprnds1);
/* Arguments are ready. Create the new vector stmt. */
- for (i = 0; VEC_iterate (tree, vec_oprnds0, i, vop0); i++)
+ FOR_EACH_VEC_ELT (tree, vec_oprnds0, i, vop0)
{
vop1 = ((op_type == binary_op)
? VEC_index (tree, vec_oprnds1, i) : NULL);
@@ -2722,7 +2722,7 @@ vect_create_vectorized_promotion_stmts (VEC (tree, heap) **vec_oprnds0,
vec_dest = VEC_pop (tree, vec_dsts);
vec_tmp = VEC_alloc (tree, heap, VEC_length (tree, *vec_oprnds0) * 2);
- for (i = 0; VEC_iterate (tree, *vec_oprnds0, i, vop0); i++)
+ FOR_EACH_VEC_ELT (tree, *vec_oprnds0, i, vop0)
{
if (op_type == binary_op)
vop1 = VEC_index (tree, *vec_oprnds1, i);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 35d12b309dd..c5f146831c4 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -7470,7 +7470,7 @@ identify_jump_threads (void)
/* Do not thread across edges we are about to remove. Just marking
them as EDGE_DFS_BACK will do. */
- for (i = 0; VEC_iterate (edge, to_remove_edges, i, e); ++i)
+ FOR_EACH_VEC_ELT (edge, to_remove_edges, i, e)
e->flags |= EDGE_DFS_BACK;
/* Allocate our unwinder stack to unwind any temporary equivalences
@@ -7676,10 +7676,10 @@ execute_vrp (void)
/* Remove dead edges from SWITCH_EXPR optimization. This leaves the
CFG in a broken state and requires a cfg_cleanup run. */
- for (i = 0; VEC_iterate (edge, to_remove_edges, i, e); ++i)
+ FOR_EACH_VEC_ELT (edge, to_remove_edges, i, e)
remove_edge (e);
/* Update SWITCH_EXPR case label vector. */
- for (i = 0; VEC_iterate (switch_update, to_update_switch_stmts, i, su); ++i)
+ FOR_EACH_VEC_ELT (switch_update, to_update_switch_stmts, i, su)
{
size_t j;
size_t n = TREE_VEC_LENGTH (su->vec);
diff --git a/gcc/tree.c b/gcc/tree.c
index c4092ab5dee..4ad2f5b1235 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1371,7 +1371,7 @@ build_constructor (tree type, VEC(constructor_elt,gc) *vals)
TREE_TYPE (c) = type;
CONSTRUCTOR_ELTS (c) = vals;
- for (i = 0; VEC_iterate (constructor_elt, vals, i, elt); i++)
+ FOR_EACH_VEC_ELT (constructor_elt, vals, i, elt)
if (!TREE_CONSTANT (elt->value))
{
constant_p = false;
@@ -1970,7 +1970,7 @@ vec_member (const_tree elem, VEC(tree,gc) *v)
{
unsigned ix;
tree t;
- for (ix = 0; VEC_iterate (tree, v, ix, t); ix++)
+ FOR_EACH_VEC_ELT (tree, v, ix, t)
if (elem == t)
return true;
return false;
@@ -2137,7 +2137,7 @@ build_tree_list_vec_stat (const VEC(tree,gc) *vec MEM_STAT_DECL)
tree *pp = &ret;
unsigned int i;
tree t;
- for (i = 0; VEC_iterate (tree, vec, i, t); ++i)
+ FOR_EACH_VEC_ELT (tree, vec, i, t)
{
*pp = build_tree_list_stat (NULL, t PASS_MEM_STAT);
pp = &TREE_CHAIN (*pp);
@@ -2915,7 +2915,7 @@ push_without_duplicates (tree exp, VEC (tree, heap) **queue)
unsigned int i;
tree iter;
- for (i = 0; VEC_iterate (tree, *queue, i, iter); i++)
+ FOR_EACH_VEC_ELT (tree, *queue, i, iter)
if (simple_cst_equal (iter, exp) == 1)
break;
@@ -3975,7 +3975,7 @@ build_nt_call_vec (tree fn, VEC(tree,gc) *args)
ret = build_vl_exp (CALL_EXPR, VEC_length (tree, args) + 3);
CALL_EXPR_FN (ret) = fn;
CALL_EXPR_STATIC_CHAIN (ret) = NULL_TREE;
- for (ix = 0; VEC_iterate (tree, args, ix, t); ++ix)
+ FOR_EACH_VEC_ELT (tree, args, ix, t)
CALL_EXPR_ARG (ret, ix) = t;
return ret;
}
@@ -4254,7 +4254,7 @@ free_lang_data_in_binfo (tree binfo)
BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE;
BINFO_SUBVTT_INDEX (binfo) = NULL_TREE;
- for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (binfo), i, t); i++)
+ FOR_EACH_VEC_ELT (tree, BINFO_BASE_BINFOS (binfo), i, t)
free_lang_data_in_binfo (t);
}
@@ -5020,7 +5020,7 @@ free_lang_data_in_cgraph (void)
for (n = cgraph_nodes; n; n = n->next)
find_decls_types_in_node (n, &fld);
- for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++)
+ FOR_EACH_VEC_ELT (alias_pair, alias_pairs, i, p)
find_decls_types (p->decl, &fld);
/* Find decls and types in every varpool symbol. */
@@ -5030,15 +5030,15 @@ free_lang_data_in_cgraph (void)
/* Set the assembler name on every decl found. We need to do this
now because free_lang_data_in_decl will invalidate data needed
for mangling. This breaks mangling on interdependent decls. */
- for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, fld.decls, i, t)
assign_assembler_name_if_neeeded (t);
/* Traverse every decl found freeing its language data. */
- for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, fld.decls, i, t)
free_lang_data_in_decl (t);
/* Traverse every type found freeing its language data. */
- for (i = 0; VEC_iterate (tree, fld.types, i, t); i++)
+ FOR_EACH_VEC_ELT (tree, fld.types, i, t)
free_lang_data_in_type (t);
pointer_set_destroy (fld.pset);
@@ -9663,7 +9663,7 @@ build_call_vec (tree return_type, tree fn, VEC(tree,gc) *args)
TREE_TYPE (ret) = return_type;
CALL_EXPR_FN (ret) = fn;
CALL_EXPR_STATIC_CHAIN (ret) = NULL_TREE;
- for (ix = 0; VEC_iterate (tree, args, ix, t); ++ix)
+ FOR_EACH_VEC_ELT (tree, args, ix, t)
CALL_EXPR_ARG (ret, ix) = t;
process_call_operands (ret);
return ret;
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 7b1e70a2de0..84956cdbac5 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1648,7 +1648,7 @@ gimple_find_values_to_profile (histogram_values *values)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
gimple_values_to_profile (gsi_stmt (gsi), values);
- for (i = 0; VEC_iterate (histogram_value, *values, i, hist); i++)
+ FOR_EACH_VEC_ELT (histogram_value, *values, i, hist)
{
switch (hist->type)
{
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 3232fb75fb4..ec402acf487 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -5758,7 +5758,7 @@ compute_bb_dataflow (basic_block bb)
dataflow_set_copy (&old_out, out);
dataflow_set_copy (out, in);
- for (i = 0; VEC_iterate (micro_operation, VTI (bb)->mos, i, mo); i++)
+ FOR_EACH_VEC_ELT (micro_operation, VTI (bb)->mos, i, mo)
{
rtx insn = mo->insn;
@@ -7683,7 +7683,7 @@ emit_notes_in_bb (basic_block bb, dataflow_set *set)
dataflow_set_clear (set);
dataflow_set_copy (set, &VTI (bb)->in);
- for (i = 0; VEC_iterate (micro_operation, VTI (bb)->mos, i, mo); i++)
+ FOR_EACH_VEC_ELT (micro_operation, VTI (bb)->mos, i, mo)
{
rtx insn = mo->insn;
@@ -7978,7 +7978,7 @@ vt_emit_notes (void)
unsigned int i;
rtx val;
- for (i = 0; VEC_iterate (rtx, preserved_values, i, val); i++)
+ FOR_EACH_VEC_ELT (rtx, preserved_values, i, val)
add_cselib_value_chains (dv_from_value (val));
changed_variables_stack = VEC_alloc (variable, heap, 40);
changed_values_stack = VEC_alloc (rtx, heap, 40);
@@ -8008,7 +8008,7 @@ vt_emit_notes (void)
unsigned int i;
rtx val;
- for (i = 0; VEC_iterate (rtx, preserved_values, i, val); i++)
+ FOR_EACH_VEC_ELT (rtx, preserved_values, i, val)
remove_cselib_value_chains (dv_from_value (val));
gcc_assert (htab_elements (value_chains) == 0);
}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 47423041bcd..597bac69d2d 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5437,7 +5437,7 @@ finish_aliases_1 (void)
unsigned i;
alias_pair *p;
- for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++)
+ FOR_EACH_VEC_ELT (alias_pair, alias_pairs, i, p)
{
tree target_decl;
@@ -5470,7 +5470,7 @@ finish_aliases_2 (void)
unsigned i;
alias_pair *p;
- for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++)
+ FOR_EACH_VEC_ELT (alias_pair, alias_pairs, i, p)
do_assemble_alias (p->decl, p->target);
VEC_truncate (alias_pair, alias_pairs, 0);
@@ -6715,12 +6715,12 @@ output_object_block (struct object_block *block)
/* Define the values of all anchors relative to the current section
position. */
- for (i = 0; VEC_iterate (rtx, block->anchors, i, symbol); i++)
+ FOR_EACH_VEC_ELT (rtx, block->anchors, i, symbol)
targetm.asm_out.output_anchor (symbol);
/* Output the objects themselves. */
offset = 0;
- for (i = 0; VEC_iterate (rtx, block->objects, i, symbol); i++)
+ FOR_EACH_VEC_ELT (rtx, block->objects, i, symbol)
{
/* Move to the object's offset, padding with zeros if necessary. */
assemble_zeros (SYMBOL_REF_BLOCK_OFFSET (symbol) - offset);
diff --git a/gcc/vec.h b/gcc/vec.h
index 321b13fc2ce..1d2f067d8d5 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -190,6 +190,11 @@ along with GCC; see the file COPYING3. If not see
#define VEC_iterate(T,V,I,P) (VEC_OP(T,base,iterate)(VEC_BASE(V),I,&(P)))
+/* Convenience macro for forward iteration. */
+
+#define FOR_EACH_VEC_ELT(T, V, I, P) \
+ for (I = 0; VEC_iterate (T, (V), (I), (P)); ++(I))
+
/* Convenience macro for reverse iteration. */
#define FOR_EACH_VEC_ELT_REVERSE(T,V,I,P) \
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index 129ee78cdd3..8ae5f2b6229 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -1589,7 +1589,7 @@ vmsdbgout_finish (const char *main_input_filename ATTRIBUTE_UNUSED)
ASM_OUTPUT_ALIGN (asm_out_file, 0);
totsize = write_modbeg (1);
- for (i = 0; VEC_iterate (unsigned, funcnum_table, i, ifunc); i++)
+ FOR_EACH_VEC_ELT (unsigned, funcnum_table, i, ifunc)
{
totsize += write_rtnbeg (i, 1);
totsize += write_rtnend (i, 1);
@@ -1597,7 +1597,7 @@ vmsdbgout_finish (const char *main_input_filename ATTRIBUTE_UNUSED)
totsize += write_pclines (1);
write_modbeg (0);
- for (i = 0; VEC_iterate (unsigned, funcnum_table, i, ifunc); i++)
+ FOR_EACH_VEC_ELT (unsigned, funcnum_table, i, ifunc)
{
write_rtnbeg (i, 0);
write_rtnend (i, 0);