/* This bit is similar to expand_builtin_longjmp except that it
restores $gp as well. */
- mips_emit_move (hard_frame_pointer_rtx, fp);
mips_emit_move (pv, lab);
+ /* Restore the frame pointer and stack pointer and gp. We must use a
+ temporary since the setjmp buffer may be a local. */
+ fp = copy_to_reg (fp);
+ gpv = copy_to_reg (gpv);
emit_stack_restore (SAVE_NONLOCAL, stack);
+
+ /* Ensure the frame pointer move is not optimized. */
+ emit_insn (gen_blockage ());
+ emit_clobber (hard_frame_pointer_rtx);
+ emit_clobber (frame_pointer_rtx);
+ emit_clobber (gp);
+ mips_emit_move (hard_frame_pointer_rtx, fp);
mips_emit_move (gp, gpv);
emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx);