Commit a78bdb38 by Jim Wilson

(thread_prologue_and_epilogue_insns): For the

epilogue, put USE insns immediately before the return insn.

From-SVN: r5142
parent 46aea932
...@@ -4846,26 +4846,48 @@ thread_prologue_and_epilogue_insns (f) ...@@ -4846,26 +4846,48 @@ thread_prologue_and_epilogue_insns (f)
/* If we end with a BARRIER, we don't need an epilogue. */ /* If we end with a BARRIER, we don't need an epilogue. */
if (! (prev && GET_CODE (prev) == BARRIER)) 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 last basic block ends with a NOTE_INSN_EPILOGUE_BEG, the
the epilogue insns (this must include the jump insn that epilogue insns, the USE insns at the end of a function,
returns), USE insns ad the end of a function, and a BARRIER. */ the jump insn that returns, and then a BARRIER. */
emit_barrier_after (insn); /* Move the USE insns at the end of a function onto a list. */
/* Place the epilogue before the USE insns at the end of a
function. */
while (prev while (prev
&& GET_CODE (prev) == INSN && GET_CODE (prev) == INSN
&& GET_CODE (PATTERN (prev)) == USE) && GET_CODE (PATTERN (prev)) == USE)
{ {
insn = PREV_INSN (prev); tem = prev;
prev = prev_nonnote_insn (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 (); seq = gen_epilogue ();
tail = emit_jump_insn_after (seq, insn); 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); emit_note_after (NOTE_INSN_EPILOGUE_BEG, insn);
/* Include the new epilogue insns in the last block. Ignore /* Include the new epilogue insns in the last block. Ignore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment