]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtl.h (loc_mentioned_in_p): Declare.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Thu, 25 May 2000 01:11:22 +0000 (01:11 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Thu, 25 May 2000 01:11:22 +0000 (02:11 +0100)
* rtl.h (loc_mentioned_in_p): Declare.
* reload.c (loc_mentioned_in_p): Moved from here...
* rtlanal.c (loc_mentioned_in_p): to here.  No longer static.
Fix loop increment for 'E' handling.
* loop.c (strength_reduce): When doing biv->giv conversion,
take multi-insn biv increments into account.

From-SVN: r34150

gcc/ChangeLog
gcc/loop.c
gcc/reload.c
gcc/rtl.h
gcc/rtlanal.c

index 0ff533f7d499a1055a4674e9f3f8457cb97ce8d8..a584ccae5cf7e1ecf78c8aaf17ee4a2d16dbcbf9 100644 (file)
@@ -1,3 +1,12 @@
+Thu May 25 02:09:10 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * rtl.h (loc_mentioned_in_p): Declare.
+       * reload.c (loc_mentioned_in_p): Moved from here...
+       * rtlanal.c (loc_mentioned_in_p): to here.  No longer static.
+       Fix loop increment for 'E' handling.
+       * loop.c (strength_reduce): When doing biv->giv conversion,
+       take multi-insn biv increments into account.
+
 2000-05-24  Jason Merrill  <jason@casey.soma.redhat.com>
 
        * stmt.c (expand_end_bindings): Look through NOTEs to find a
index df3ee526a68527eff9313ac6ae8eac1ca95c8215..0c37c34036ee26c33a2582fe9a4827daa0f678f9 100644 (file)
@@ -4228,6 +4228,7 @@ strength_reduce (loop, insn_count, flags)
              HOST_WIDE_INT offset;
              rtx set, add_val, old_reg, dest_reg, last_use_insn, note;
              int old_regno, new_regno;
+             rtx next_loc_insn;
 
              if (! v->always_executed
                  || v->maybe_multiple
@@ -4262,7 +4263,17 @@ strength_reduce (loop, insn_count, flags)
                  VARRAY_GROW (reg_single_usage, nregs);
                }
     
-             if (! validate_change (next->insn, next->location, add_val, 0))
+             /* Some bivs are incremented with a multi-insn sequence.
+                The first insn contains the add.  */
+             next_loc_insn = next->insn;
+             while (! loc_mentioned_in_p (next->location,
+                                          PATTERN (next_loc_insn)))
+               next_loc_insn = PREV_INSN (next_loc_insn);
+
+             if (next_loc_insn == v->insn)
+               abort ();
+
+             if (! validate_change (next_loc_insn, next->location, add_val, 0))
                {
                  vp = &v->next_iv;
                  continue;
@@ -4274,7 +4285,7 @@ strength_reduce (loop, insn_count, flags)
              /* Set last_use_insn so that we can check against it.  */
 
              for (last_use_insn = v->insn, p = NEXT_INSN (v->insn);
-                  p != next->insn;
+                  p != next_loc_insn;
                   p = next_insn_in_loop (loop, p))
                {
                  if (!INSN_P (p))
@@ -4294,7 +4305,7 @@ strength_reduce (loop, insn_count, flags)
                  || ! validate_change (v->insn, &SET_DEST (set), dest_reg, 0))
                {
                  /* Change the increment at NEXT back to what it was.  */
-                 if (! validate_change (next->insn, next->location,
+                 if (! validate_change (next_loc_insn, next->location,
                      next->add_val, 0))
                    abort ();
                  vp = &v->next_iv;
@@ -4353,7 +4364,7 @@ strength_reduce (loop, insn_count, flags)
                 the replaced increment and the next increment, and
                 remember the last insn that needed a replacement.  */
              for (last_use_insn = v->insn, p = NEXT_INSN (v->insn);
-                  p != next->insn;
+                  p != next_loc_insn;
                   p = next_insn_in_loop (loop, p))
                {
                  rtx note;
index e94a3037be4a9c2a538b73ceae5fbebf2edf797a..eb4302d117a542003ec1ace068e0370b9b34d6ce 100644 (file)
@@ -272,7 +272,6 @@ static void find_reloads_address_part PARAMS ((rtx, rtx *, enum reg_class,
 static rtx find_reloads_subreg_address PARAMS ((rtx, int, int, enum reload_type,
                                              int, rtx));
 static int find_inc_amount     PARAMS ((rtx, rtx));
-static int loc_mentioned_in_p  PARAMS ((rtx *, rtx));
 extern void debug_reload_to_stream PARAMS ((FILE *));
 extern void debug_reload PARAMS ((void));
 \f
@@ -1557,32 +1556,6 @@ remove_address_replacements (in_rtx)
     }
   return something_changed;
 }
-
-/* Return non-zero if IN contains a piece of rtl that has the address LOC */
-static int
-loc_mentioned_in_p (loc, in)
-     rtx *loc, in;
-{
-  enum rtx_code code = GET_CODE (in);
-  const char *fmt = GET_RTX_FORMAT (code);
-  int i, j;
-
-  for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
-    {
-      if (loc == &in->fld[i].rtx)
-       return 1;
-      if (fmt[i] == 'e')
-       {
-         if (loc_mentioned_in_p (loc, XEXP (in, i)))
-           return 1;
-       }
-      else if (fmt[i] == 'E')
-       for (j = XVECLEN (in, i) - 1; i >= 0; i--)
-         if (loc_mentioned_in_p (loc, XVECEXP (in, i, j)))
-           return 1;
-    }
-  return 0;
-}
 \f
 /* If there is only one output reload, and it is not for an earlyclobber
    operand, try to combine it with a (logically unrelated) input reload
index 2de4b0ed300613de479bde5bda151b9fb465cc24..79d1bca98f75f4fc4556c8779f04f922812ea950 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1248,6 +1248,7 @@ extern rtx regno_use_in                   PARAMS ((unsigned int, rtx));
 extern int auto_inc_p                  PARAMS ((rtx));
 extern void remove_node_from_expr_list PARAMS ((rtx, rtx *));
 extern int insns_safe_to_move_p         PARAMS ((rtx, rtx, rtx *));
+extern int loc_mentioned_in_p          PARAMS ((rtx *, rtx));
 
 /* flow.c */
 
index e9a98162952c339019a47c895402a2f72ec822c6..8af6c7c1ffe96dd78d7bd9e544393ef09d78e504 100644 (file)
@@ -2358,3 +2358,29 @@ insns_safe_to_move_p (from, to, new_to)
   
   return 0;
 }
+
+/* Return non-zero if IN contains a piece of rtl that has the address LOC */
+int
+loc_mentioned_in_p (loc, in)
+     rtx *loc, in;
+{
+  enum rtx_code code = GET_CODE (in);
+  const char *fmt = GET_RTX_FORMAT (code);
+  int i, j;
+
+  for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+    {
+      if (loc == &in->fld[i].rtx)
+       return 1;
+      if (fmt[i] == 'e')
+       {
+         if (loc_mentioned_in_p (loc, XEXP (in, i)))
+           return 1;
+       }
+      else if (fmt[i] == 'E')
+       for (j = XVECLEN (in, i) - 1; j >= 0; j--)
+         if (loc_mentioned_in_p (loc, XVECEXP (in, i, j)))
+           return 1;
+    }
+  return 0;
+}