(pop_stack): Define. Pops any register on stack and adjusts the stack.

From-SVN: r18723
This commit is contained in:
Stan Cox 1998-03-20 08:28:06 +00:00 committed by Stan Cox
parent 3cd730af0b
commit 7aa74e4c2f
2 changed files with 34 additions and 4 deletions

View 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

View 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;
}
}
}
/* 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
{