This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Loop clean up


On Jan 18, 2000, Franz Sirl <Franz.Sirl-kernel@lauterbach.com> wrote:

> At 07:12 02.12.99 , Michael Hayes wrote:

>> (loop_used_count_register): Delete and replace with entry in
>> loop_info structure.

This is wrong.  There's a single loop_info structure, that's assigned
to each loop as we process it.  But insert_bct wants to set
used_count_register of enclosing loops, but loop_info is not
available for them at that point.

How about moving used_count_register to struct loop?  I haven't
completed a bootstrap of this patch yet (the AIX host is still dog
slow, despite the use of ggc-page); it bootstrapped on GNU/Linux/x86,
but this doesn't mean much more than ``the patch is syntactically
correct.''  Assuming it bootstraps on AIX, is this ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
	
	* loop.h (struct loop_info): Move used_count_register to...
	* basic-block.h (struct loop): ... here.
	* loop.c (insert_bct): Adjust.
	
Index: gcc/loop.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.h,v
retrieving revision 1.23
diff -u -p -r1.23 loop.h
--- gcc/loop.h	2000/01/17 17:16:20	1.23
+++ gcc/loop.h	2000/01/18 16:03:34
@@ -197,7 +197,6 @@ struct loop_info
   unsigned HOST_WIDE_INT n_iterations;
   /* The number of times the loop body was unrolled.  */
   unsigned int unroll_number;
-  int used_count_register;
 };
 
 /* Definitions used by the basic induction variable discovery code.  */
Index: gcc/basic-block.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/basic-block.h,v
retrieving revision 1.46
diff -u -p -r1.46 basic-block.h
--- gcc/basic-block.h	2000/01/15 03:01:49	1.46
+++ gcc/basic-block.h	2000/01/18 16:03:34
@@ -316,6 +316,9 @@ struct loop
   /* The number of LABEL_REFs on exit_labels for this loop and all
      loops nested inside it.  */
   int exit_count;
+
+  /* Set to one if the count register has been used.  */
+  int used_count_register;
 };
 
 
Index: gcc/loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.219
diff -u -p -r1.219 loop.c
--- gcc/loop.c	2000/01/18 00:30:16	1.219
+++ gcc/loop.c	2000/01/18 16:03:40
@@ -9283,7 +9283,7 @@ insert_bct (loop)
     return;
 
   /* Make sure that the count register is not in use.  */
-  if (loop_info->used_count_register)
+  if (loop->used_count_register)
     {
       if (loop_dump_stream)
 	fprintf (loop_dump_stream,
@@ -9358,13 +9358,11 @@ insert_bct (loop)
   if (n_iterations > 0)
     {
       struct loop *outer_loop;
-      struct loop_info *outer_loop_info;
 
       /* Mark all enclosing loops that they cannot use count register.  */
       for (outer_loop = loop; outer_loop; outer_loop = outer_loop->outer)
 	{
-	  outer_loop_info = outer_loop->info;
-	  outer_loop_info->used_count_register = 1;
+	  outer_loop->used_count_register = 1;
 	}
       instrument_loop_bct (loop_start, loop_end, GEN_INT (n_iterations));
       return;

-- 
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]