aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1993-08-12 10:45:57 -0700
committerJim Wilson <wilson@gcc.gnu.org>1993-08-12 10:45:57 -0700
commita78bdb3850ecf3e7df69c293d2827bbf8097967b (patch)
treec3c451471105dd449514406c6ef9b466199ceb17 /gcc
parent46aea93218b08e77f247b597c3dc779e294b77cb (diff)
downloadgcc-a78bdb3850ecf3e7df69c293d2827bbf8097967b.zip
gcc-a78bdb3850ecf3e7df69c293d2827bbf8097967b.tar.gz
gcc-a78bdb3850ecf3e7df69c293d2827bbf8097967b.tar.bz2
(thread_prologue_and_epilogue_insns): For the
epilogue, put USE insns immediately before the return insn. From-SVN: r5142
Diffstat (limited to 'gcc')
-rw-r--r--gcc/function.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 93fce64..21d58f0 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4846,26 +4846,48 @@ thread_prologue_and_epilogue_insns (f)
/* If we end with a BARRIER, we don't need an epilogue. */
if (! (prev && GET_CODE (prev) == BARRIER))
{
- rtx tail, seq;
+ rtx tail, seq, tem;
+ rtx first_use = 0;
+ rtx last_use = 0;
- /* The last basic block ends with a NOTE_INSN_EPILOGUE_BEG,
- the epilogue insns (this must include the jump insn that
- returns), USE insns ad the end of a function, and a BARRIER. */
+ /* The last basic block ends with a NOTE_INSN_EPILOGUE_BEG, the
+ epilogue insns, the USE insns at the end of a function,
+ the jump insn that returns, and then a BARRIER. */
- emit_barrier_after (insn);
-
- /* Place the epilogue before the USE insns at the end of a
- function. */
+ /* Move the USE insns at the end of a function onto a list. */
while (prev
&& GET_CODE (prev) == INSN
&& GET_CODE (PATTERN (prev)) == USE)
{
- insn = PREV_INSN (prev);
+ tem = prev;
prev = prev_nonnote_insn (prev);
+
+ NEXT_INSN (PREV_INSN (tem)) = NEXT_INSN (tem);
+ PREV_INSN (NEXT_INSN (tem)) = PREV_INSN (tem);
+ if (! first_use)
+ first_use = tem;
+ if (last_use)
+ NEXT_INSN (last_use) = tem;
+ else
+ last_use = tem;
}
+ emit_barrier_after (insn);
+
seq = gen_epilogue ();
tail = emit_jump_insn_after (seq, insn);
+
+ /* Insert the USE insns immediately before the return insn, which
+ must be the first instruction before the final barrier. */
+ if (first_use)
+ {
+ tem = prev_nonnote_insn (get_last_insn ());
+ NEXT_INSN (PREV_INSN (tem)) = first_use;
+ PREV_INSN (first_use) = PREV_INSN (tem);
+ PREV_INSN (tem) = last_use;
+ NEXT_INSN (last_use) = tem;
+ }
+
emit_note_after (NOTE_INSN_EPILOGUE_BEG, insn);
/* Include the new epilogue insns in the last block. Ignore