Loop clean up fixes

Michael Hayes m.hayes@elec.canterbury.ac.nz
Fri Jan 21 16:59:00 GMT 2000


Richard Henderson writes:
 > On Fri, Jan 21, 2000 at 10:23:50AM -0200, Alexandre Oliva wrote:
 > >    /* Auxiliary info specific to a pass.  */
 > > -  void *info;
 > > +  struct loop_info *info;
 > 
 > If it really is pass-specific info, I think it ought to be
 > 
 >   void *aux;
 > 
 > just like in basic_block and edge.

Yes, that was my original attention.

Here's a compromise.  OK to commit?

Michael.

2000-01-22  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>

	* loop.c (loops_info): New variable.
	(loop_optimize): Allocate memory for loops_info and assign to
	each loop, replacing alloca.  

Index: loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.221
diff -c -3 -p -r1.221 loop.c
*** loop.c	2000/01/19 20:10:00	1.221
--- loop.c	2000/01/22 00:54:55
*************** loop_optimize (f, dumpfile, unroll_p, bc
*** 419,424 ****
--- 419,425 ----
    register int i;
    struct loops loops_data;
    struct loops *loops = &loops_data;
+   struct loop_info *loops_info;
  
    loop_dump_stream = dumpfile;
  
*************** loop_optimize (f, dumpfile, unroll_p, bc
*** 459,464 ****
--- 460,470 ----
       First, find them, and record them in order of their beginnings.  */
    find_and_verify_loops (f, loops);
  
+   /* Allocate and initialize auxiliary loop information.  */
+   loops_info = xcalloc (loops->num, sizeof (struct loop_info));
+   for (i = 0; i < loops->num; i++)
+     loops->array[i].info = loops_info + i;
+ 
    /* Now find all register lifetimes.  This must be done after
       find_and_verify_loops, because it might reorder the insns in the
       function.  */
*************** loop_optimize (f, dumpfile, unroll_p, bc
*** 510,524 ****
       this prevents low overhead loop instructions from being used.  */
    indirect_jump_in_function = indirect_jump_in_function_p (f);
  
-   /* Allocate and initialize auxiliary loop information.  */
-   for (i = max_loop_num - 1; i >= 0; i--)
-     {
-       struct loop *loop = &loops->array[i];
- 
-       loop->info = (struct loop_info *) alloca (sizeof (struct loop_info));
-       memset (loop->info, 0, sizeof (struct loop_info));
-     }
- 
    /* Now scan the loops, last ones first, since this means inner ones are done
       before outer ones.  */
    for (i = max_loop_num - 1; i >= 0; i--)
--- 516,521 ----
*************** loop_optimize (f, dumpfile, unroll_p, bc
*** 539,544 ****
--- 536,542 ----
    free (moved_once);
    free (uid_luid);
    free (uid_loop);
+   free (loops_info);
  }
  
  /* Returns the next insn, in execution order, after INSN.  START and


More information about the Gcc-patches mailing list