OSDN Git Service

* regclass.c (loop_depth): Remove
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Dec 1999 10:35:14 +0000 (10:35 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Dec 1999 10:35:14 +0000 (10:35 +0000)
(scan_one_insn): Do not handle LOOP_NOTE insns.
(regclass): Go through basic blocks and set loop_cost

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30976 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/regclass.c

index 03a8ed9..570e307 100644 (file)
@@ -1,3 +1,9 @@
+Thu Dec 16 11:33:57 MET 1999  Jan Hubicka  <hubicka@freesoft.cz>
+
+       * regclass.c (loop_depth): Remove
+       (scan_one_insn): Do not handle LOOP_NOTE insns.
+       (regclass): Go through basic blocks and set loop_cost
+
 Thu Dec 16 02:56:25 1999  Zack Weinberg  <zack@bitmover.com>
 
        * tree.h (DECL_FROM_INLINE): Check DECL_ABSTRACT_ORIGIN too.
index ea131c0..3c28580 100644 (file)
@@ -716,10 +716,6 @@ static struct reg_pref *reg_pref;
 
 static struct reg_pref *reg_pref_buffer;
 
-/* Record the depth of loops that we are in.  */
-
-static int loop_depth;
-
 /* Account for the fact that insns within a loop are executed very commonly,
    but don't keep doing this as loops go too deep.  */
 
@@ -821,26 +817,6 @@ scan_one_insn (insn, pass)
   rtx set, note;
   int i, j;
 
-  /* Show that an insn inside a loop is likely to be executed three
-     times more than insns outside a loop.  This is much more aggressive
-     than the assumptions made elsewhere and is being tried as an
-     experiment.  */
-
-  if (code == NOTE)
-    {
-      if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
-       loop_depth++;
-      else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
-       loop_depth--;
-
-      if (optimize_size)
-       loop_cost = 1;
-      else
-       loop_cost = 1 << (2 * MIN (loop_depth, 5));
-
-      return insn;
-    }
-
   if (GET_RTX_CLASS (code) != 'i')
     return insn;
 
@@ -1085,6 +1061,7 @@ regclass (f, nregs, dump)
 
   for (pass = 0; pass <= flag_expensive_optimizations; pass++)
     {
+      int index;
       /* Zero out our accumulation of the cost of each class for each reg.  */
 
       bzero ((char *) costs, nregs * sizeof (struct costs));
@@ -1093,14 +1070,29 @@ regclass (f, nregs, dump)
       bzero (in_inc_dec, nregs);
 #endif
 
-      loop_depth = 0, loop_cost = 1;
+      loop_cost = 1;
 
       /* Scan the instructions and record each time it would
         save code to put a certain register in a certain class.  */
 
-      for (insn = f; insn; insn = NEXT_INSN (insn))
+      for (index = 0; index < n_basic_blocks; index++)
        {
-         insn = scan_one_insn (insn, pass);
+         basic_block bb = BASIC_BLOCK (index);
+
+         /* Show that an insn inside a loop is likely to be executed three
+            times more than insns outside a loop.  This is much more aggressive
+            than the assumptions made elsewhere and is being tried as an
+            experiment.  */
+         if (optimize_size)
+           loop_cost = 1;
+         else
+           loop_cost = 1 << (2 * MIN (bb->loop_depth - 1, 5));
+         for (insn = bb->head; ; insn = NEXT_INSN (insn))
+           {
+             insn = scan_one_insn (insn, pass);
+             if (insn == bb->end)
+               break;
+           }
        }
       
       /* Now for each register look at how desirable each class is