summaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-07 18:13:29 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-07 18:13:29 +0000
commitb8c362b7016380ca8b13674847bf9218113d0851 (patch)
tree9966163c9b3bfdf8faa218f12e89e2b2c8b20dd4 /gcc/reg-stack.c
parentab4abc7b40a51cc00d0a11c56dfa92e66d25231b (diff)
downloadgcc-b8c362b7016380ca8b13674847bf9218113d0851.tar.gz
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: svn+ssh://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);