Bernd Schmidt <ber...@codesourcery.com> writes: > This is necessary when adding shrink-wrapping; otherwise dwarf2cfi sees > inconsistent information and aborts. > > Tested on mips64-elf together with the rest of the shrink-wrapping > patches. Ok?
It looks like the current code doesn't handle the RESTORE instruction. Could you also test that somehow? A mipsisa32-elf run with -mips16 ought to work, but some sort of spot-checking of shrink-wrapping + RESTORE would be fine if that's easier. Also, for the frame_pointer_required case, it looks like there's a window between the restoration of the frame pointer and the deallocation of the stack in which the CFA is still defined in terms of the frame pointer register. Is that significant? If not (e.g. because we should never need to unwind at that point) then why do we still update the CFA here: > @@ -10324,12 +10330,26 @@ mips_expand_epilogue (bool sibcall_p) > if (!TARGET_MIPS16) > target = stack_pointer_rtx; > > - emit_insn (gen_add3_insn (target, base, adjust)); > + insn = emit_insn (gen_add3_insn (target, base, adjust)); > + if (!frame_pointer_needed && target == stack_pointer_rtx) > + { > + RTX_FRAME_RELATED_P (insn) = 1; > + add_reg_note (insn, REG_CFA_DEF_CFA, > + plus_constant (stack_pointer_rtx, step2)); > + } and here: > /* Copy TARGET into the stack pointer. */ > if (target != stack_pointer_rtx) > - mips_emit_move (stack_pointer_rtx, target); > + { > + insn = mips_emit_move (stack_pointer_rtx, target); > + if (!frame_pointer_needed) > + { > + add_reg_note (insn, REG_CFA_DEF_CFA, > + plus_constant (stack_pointer_rtx, step2)); > + RTX_FRAME_RELATED_P (insn) = 1; > + } > + } ? If the window is significant, could we avoid it by removing the !frame_pointer_needed checks from the code above? Richard