]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
regmove.c (stack_memref_p): Fix typo, reorg for readability.
authorRichard Henderson <rth@cygnus.com>
Mon, 20 Mar 2000 22:52:04 +0000 (14:52 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 20 Mar 2000 22:52:04 +0000 (14:52 -0800)
        * regmove.c (stack_memref_p): Fix typo, reorg for readability.
        (combine_stack_adjustments_for_block): Don't allow sp references
        in the side of a set we're not fixing up.
        * toplev.c (rest_of_compilation): Run combine_stack_adjustments
        after life_analysis.

From-SVN: r32654

gcc/ChangeLog
gcc/regmove.c
gcc/toplev.c

index dcb99bc0f34ef6141fd57a8b6651db1c6453a243..69a2a70e868ef782d22bf12d1a352f90e9e5ec8f 100644 (file)
@@ -1,3 +1,11 @@
+2000-03-20  Richard Henderson  <rth@cygnus.com>
+
+       * regmove.c (stack_memref_p): Fix typo, reorg for readability.
+       (combine_stack_adjustments_for_block): Don't allow sp references
+       in the side of a set we're not fixing up.
+       * toplev.c (rest_of_compilation): Run combine_stack_adjustments
+       after life_analysis.
+
 2000-03-20  Richard Henderson  <rth@cygnus.com>
 
        * calls.c (expand_call): Don't bother generating tail call
index fa82f8f95e9ccead9f7fb9106b36ef1d6ad79cea..8e59c69ce77b7b451cd9971beefe46f36ed08237 100644 (file)
@@ -2116,14 +2116,21 @@ combine_stack_adjustments ()
 /* Recognize a MEM of the form (sp) or (plus sp const).  */
 
 static int
-stack_memref_p (mem)
-     rtx mem;
+stack_memref_p (x)
+     rtx x;
 {
-  return (GET_CODE (mem) == MEM
-         && (XEXP (mem, 0) == stack_pointer_rtx
-             || (GET_CODE (XEXP (mem, 0)) == PLUS
-                 && XEXP (XEXP (mem, 0), 0) == stack_pointer_rtx
-                 && GET_CODE (XEXP (XEXP (mem, 0), 0)) == CONST_INT)));
+  if (GET_CODE (x) != MEM)
+    return 0;
+  x = XEXP (x, 0);
+
+  if (x == stack_pointer_rtx)
+    return 1;
+  if (GET_CODE (x) == PLUS
+      && XEXP (x, 0) == stack_pointer_rtx
+      && GET_CODE (XEXP (x, 1)) == CONST_INT)
+    return 1;
+
+  return 0;
 }
 
 /* Recognize either normal single_set or the hack in i386.md for
@@ -2330,14 +2337,16 @@ combine_stack_adjustments_for_block (bb)
            }
 
          /* Find loads from stack memory and record them.  */
-         if (last_sp_set && stack_memref_p (src))
+         if (last_sp_set && stack_memref_p (src)
+             && ! reg_mentioned_p (stack_pointer_rtx, dest))
            {
              memlist = record_one_stack_memref (insn, src, memlist);
              goto processed;
            }
 
          /* Find stores to stack memory and record them.  */
-         if (last_sp_set && stack_memref_p (dest))
+         if (last_sp_set && stack_memref_p (dest)
+             && ! reg_mentioned_p (stack_pointer_rtx, src))
            {
              memlist = record_one_stack_memref (insn, dest, memlist);
              goto processed;
@@ -2351,6 +2360,7 @@ combine_stack_adjustments_for_block (bb)
              && GET_CODE (dest) == MEM
              && GET_CODE (XEXP (dest, 0)) == PRE_DEC
              && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx
+             && ! reg_mentioned_p (stack_pointer_rtx, src)
              && validate_change (insn, &SET_DEST (set),
                                  change_address (dest, VOIDmode,
                                                  stack_pointer_rtx), 0))
index f304144b3c8a7b721a67522f60d7c3e6db51c5ad..bf6dce21277a0336e8093737c1fb6c4efe18706f 100644 (file)
@@ -3555,17 +3555,16 @@ rest_of_compilation (decl)
 
   if (optimize)
     {
-      TIMEVAR (flow2_time, { cleanup_cfg (insns); });
+      TIMEVAR (flow2_time,
+              {
+                cleanup_cfg (insns);
+                life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
+              });
 
 #ifndef ACCUMULATE_OUTGOING_ARGS
       TIMEVAR (flow2_time, { combine_stack_adjustments (); });
 #endif
 
-      TIMEVAR (flow2_time, 
-              {
-                life_analysis (insns, max_reg_num (), rtl_dump_file, 1);
-              });
-
       if (ggc_p)
        ggc_collect ();
     }