aboutsummaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2007-03-07 18:13:29 +0000
committerRichard Henderson <rth@redhat.com>2007-03-07 18:13:29 +0000
commitfee575e139dbf4de466022ee33569381954f5625 (patch)
tree9966163c9b3bfdf8faa218f12e89e2b2c8b20dd4 /gcc/reg-stack.c
parent172175608b1edd71d424fba21adbf6021f093355 (diff)
PR target/30848
* reg-stack.c (emit_swap_insn): If a malformed asm was seen, silently fix up the stack in the case of a missing register. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@122669 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r--gcc/reg-stack.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index e6802b1e8ef..8413ca3a399 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -815,9 +815,19 @@ emit_swap_insn (rtx insn, stack regstack, rtx reg)
hard_regno = get_hard_regnum (regstack, reg);
- gcc_assert (hard_regno >= FIRST_STACK_REG);
if (hard_regno == FIRST_STACK_REG)
return;
+ if (hard_regno == -1)
+ {
+ /* Something failed if the register wasn't on the stack. If we had
+ malformed asms, we zapped the instruction itself, but that didn't
+ produce the same pattern of register sets as before. To prevent
+ further failure, adjust REGSTACK to include REG at TOP. */
+ gcc_assert (any_malformed_asm);
+ regstack->reg[++regstack->top] = REGNO (reg);
+ return;
+ }
+ gcc_assert (hard_regno >= FIRST_STACK_REG);
other_reg = regstack->top - (hard_regno - FIRST_STACK_REG);