]> gcc.gnu.org Git - gcc.git/commitdiff
(pop_stack): Define. Pops any register on stack and adjusts the stack.
authorStan Cox <scox@equinox.cygnus.com>
Fri, 20 Mar 1998 08:28:06 +0000 (08:28 +0000)
committerStan Cox <scox@gcc.gnu.org>
Fri, 20 Mar 1998 08:28:06 +0000 (08:28 +0000)
From-SVN: r18723

gcc/ChangeLog
gcc/reg-stack.c

index dd82ed6c0aa797c268973b311ebdb21cc0d46c8d..d745315f29c37a827d8932f56383f0782962468a 100644 (file)
@@ -1,3 +1,9 @@
+Fri Mar 20 11:19:40 1998  Stan Cox  <scox@equinox.cygnus.com>
+
+       * reg-stack.c (pop_stack): Define. Pops any register on the
+       regstack and adjusts regstack.
+       (compare_for_stack_reg): Use pop_stack.
+       
 Thu Mar 19 23:51:01 1998  Jeffrey A Law  (law@cygnus.com)
 
        * configure.in (hppa1.0-hp-hpux10): Handle threads for this
index 79a16cd4c698af0b0472b7f6f28a0f7718a767ed..af94021e9cb0883ca44871ccaa0b400d0a75b697 100644 (file)
@@ -315,6 +315,32 @@ straighten_stack (insn, regstack)
   
   change_stack (insn, regstack, &temp_stack, emit_insn_after);
 }
+
+/* Pop a register from the stack */
+
+static void
+pop_stack (regstack, regno)
+     stack regstack;
+     int   regno;
+{
+  int top = regstack->top;
+
+  CLEAR_HARD_REG_BIT (regstack->reg_set, regno);
+  regstack->top--;
+  /* If regno was not at the top of stack then adjust stack */
+  if (regstack->reg [top] != regno)
+    {
+      int i;
+      for (i = regstack->top; i >= 0; i--)
+       if (regstack->reg [i] == regno)
+         {
+           int j;
+           for (j = i; j < top; j++)
+             regstack->reg [j] = regstack->reg [j + 1];
+           break;
+         }
+    }
+}
 \f
 /* Return non-zero if any stack register is mentioned somewhere within PAT.  */
 
@@ -2067,9 +2093,8 @@ compare_for_stack_reg (insn, regstack, pat)
 
   if (src1_note)
     {
-      CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (XEXP (src1_note, 0)));
+      pop_stack (regstack, REGNO (XEXP (src1_note, 0)));
       replace_reg (&XEXP (src1_note, 0), FIRST_STACK_REG);
-      regstack->top--;
     }
 
   /* If the second operand dies, handle that.  But if the operands are
@@ -2088,9 +2113,8 @@ compare_for_stack_reg (insn, regstack, pat)
       if (get_hard_regnum (regstack, XEXP (src2_note, 0)) == FIRST_STACK_REG
          && src1_note)
        {
-         CLEAR_HARD_REG_BIT (regstack->reg_set, REGNO (XEXP (src2_note, 0)));
+         pop_stack (regstack, REGNO (XEXP (src2_note, 0)));
          replace_reg (&XEXP (src2_note, 0), FIRST_STACK_REG + 1);
-         regstack->top--;
        }
       else
        {
This page took 0.072914 seconds and 5 git commands to generate.