+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
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. */
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
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
{