Patchwork introduce FOR_EACH_VEC_ELT and use it

login
register
mail settings
Submitter Nathan Froyd
Date Aug. 20, 2010, 11:53 a.m.
Message ID <20100820115331.GO25394@codesourcery.com>
Download mbox | patch
Permalink /patch/62266/
State New
Headers show

Comments

Nathan Froyd - Aug. 20, 2010, 11:53 a.m.
On Fri, Aug 20, 2010 at 12:13:27AM -0400, Diego Novillo wrote:
> On Thu, Aug 19, 2010 at 23:56, Nathan Froyd <froydnj@codesourcery.com> wrote:
> 
> [humongous ChangeLog]
> 
> OK.

I missed a couple of candidates in config/{bfin,rs6000}.  Are these OK
too?  (I'll roll them into the big patch if so.)

-Nathan

	* config/bfin/bfin.c: Use FOR_EACH_VEC_ELT.
	* config/rs6000/rs6000.c: Likewise.
Diego Novillo - Aug. 20, 2010, 12:27 p.m.
On 10-08-20 07:53 , Nathan Froyd wrote:
> On Fri, Aug 20, 2010 at 12:13:27AM -0400, Diego Novillo wrote:
>> On Thu, Aug 19, 2010 at 23:56, Nathan Froyd<froydnj@codesourcery.com>  wrote:
>>
>> [humongous ChangeLog]
>>
>> OK.
>
> I missed a couple of candidates in config/{bfin,rs6000}.  Are these OK
> too?  (I'll roll them into the big patch if so.)

Sure.


Diego.

Patch

Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c	(revision 163399)
+++ gcc/config/bfin/bfin.c	(working copy)
@@ -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,
   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, basi
   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;
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 163399)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -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;