aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1997-06-30 14:56:46 -0600
committerJeff Law <law@gcc.gnu.org>1997-06-30 14:56:46 -0600
commit07f5b9aa23b577dd5e3de82b71e7d66e148a3888 (patch)
tree208b58dc160635d6aff80f09c0caef15f527bcda /gcc
parent38c1f2d7e6de970a7345b7d7fabe3952f2f7af89 (diff)
downloadgcc-07f5b9aa23b577dd5e3de82b71e7d66e148a3888.zip
gcc-07f5b9aa23b577dd5e3de82b71e7d66e148a3888.tar.gz
gcc-07f5b9aa23b577dd5e3de82b71e7d66e148a3888.tar.bz2
sh.c (sh_expand_epilogue): Emit a blockage insn before cutting back the stack.
* sh.c (sh_expand_epilogue): Emit a blockage insn before cutting back the stack. From-SVN: r14362
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/sh/sh.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index fb723ba5..30406f6 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -2705,15 +2705,24 @@ sh_expand_epilogue ()
if (frame_pointer_needed)
{
- /* We deliberately make the add dependent on the frame_pointer,
- to ensure that instruction scheduling won't move the stack pointer
- adjust before instructions reading from the frame. This can fail
- if there is an interrupt which then writes to the stack. */
output_stack_adjust (get_frame_size (), frame_pointer_rtx, 7);
+
+ /* We must avoid moving the stack pointer adjustment past code
+ which reads from the local frame, else an interrupt could
+ occur after the SP adjustment and clobber data in the local
+ frame. */
+ emit_insn (gen_blockage ());
emit_insn (gen_movsi (stack_pointer_rtx, frame_pointer_rtx));
}
- else
- output_stack_adjust (get_frame_size (), stack_pointer_rtx, 7);
+ else if (get_frame_size ())
+ {
+ /* We must avoid moving the stack pointer adjustment past code
+ which reads from the local frame, else an interrupt could
+ occur after the SP adjustment and clobber data in the local
+ frame. */
+ emit_insn (gen_blockage ());
+ output_stack_adjust (get_frame_size (), stack_pointer_rtx, 7);
+ }
/* Pop all the registers. */