summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1994-12-29 02:39:10 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1994-12-29 02:39:10 +0000
commit79eb6e98241731e9afc2c338892109a5404a7a47 (patch)
tree5bf32a1048cb73221b4777734b8a0df423a3872a /gcc
parent0f021c7806c4d4b3a95d4423969935a89f8266f6 (diff)
downloadgcc-79eb6e98241731e9afc2c338892109a5404a7a47.tar.gz
(fill_simple_delay_slots): For the epilogue case, set needed
to include frame pointer and stack pointer, don't include all of end_of_function_needs. Reject insn if it sets a previously set resource. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8698 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/reorg.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c
index cd7d6528f24..e4058d7e414 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3146,9 +3146,27 @@ fill_simple_delay_slots (first, non_jumps_p)
return;
slots_filled = 0;
- needed = end_of_function_needs;
CLEAR_RESOURCE (&set);
+ /* The frame pointer and stack pointer are needed at the beginning of
+ the epilogue, so instructions setting them can not be put in the
+ epilogue delay slot. However, everything else needed at function
+ end is safe, so we don't want to use end_of_function_needs here. */
+ CLEAR_RESOURCE (&needed);
+ if (frame_pointer_needed)
+ {
+ SET_HARD_REG_BIT (needed.regs, FRAME_POINTER_REGNUM);
+#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
+ SET_HARD_REG_BIT (needed.regs, HARD_FRAME_POINTER_REGNUM);
+#endif
+#ifdef EXIT_IGNORE_STACK
+ if (! EXIT_IGNORE_STACK)
+#endif
+ SET_HARD_REG_BIT (needed.regs, STACK_POINTER_REGNUM);
+ }
+ else
+ SET_HARD_REG_BIT (needed.regs, STACK_POINTER_REGNUM);
+
for (trial = get_last_insn (); ! stop_search_p (trial, 1);
trial = PREV_INSN (trial))
{
@@ -3160,6 +3178,7 @@ fill_simple_delay_slots (first, non_jumps_p)
if (! insn_references_resource_p (trial, &set, 1)
&& ! insn_sets_resource_p (trial, &needed, 1)
+ && ! insn_sets_resource_p (trial, &set, 1)
#ifdef HAVE_cc0
/* Don't want to mess with cc0 here. */
&& ! reg_mentioned_p (cc0_rtx, pat)