Commit bf526252 by Richard Kenner

(reposition_prologue_and_epilogue_notes): Search for the notes without using...

(reposition_prologue_and_epilogue_notes): Search for the notes without
using basic_block_end[0] or basic_block_head[N-1].

From-SVN: r1735
parent 6842690e
...@@ -4379,58 +4379,74 @@ reposition_prologue_and_epilogue_notes (f) ...@@ -4379,58 +4379,74 @@ reposition_prologue_and_epilogue_notes (f)
if (n_basic_blocks) if (n_basic_blocks)
{ {
rtx next, prev; rtx next, prev;
int len;
if (prologue) if (prologue)
{ {
register rtx insn, end_prologue; register rtx insn, note = 0;
/* From the end of the first basic block, search backward for a /* Scan from the beginning until we reach the last prologue insn.
prologue insn. */ We apparently can't depend on basic_block_{head,end} after
for (insn = NEXT_INSN (PREV_INSN (basic_block_end[0])); reorg has run. */
insn; insn = prev_nonnote_insn (insn)) for (len = 0; prologue[len]; len++)
if (contains (insn, prologue)) ;
{
end_prologue = insn;
/* Find the prologue-end note and move it to just after the
last prologue insn. */
for (insn = f; insn; insn = NEXT_INSN (insn)) for (insn = f; insn; insn = NEXT_INSN (insn))
if (GET_CODE (insn) == NOTE if (GET_CODE (insn) == NOTE)
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_PROLOGUE_END) {
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_PROLOGUE_END)
note = insn;
}
else if (contains (insn, prologue) && --len == 0)
{
/* Find the prologue-end note if we haven't already, and
move it to just after the last prologue insn. */
if (note == 0)
for (note = insn; note = NEXT_INSN (note);)
if (GET_CODE (note) == NOTE
&& NOTE_LINE_NUMBER (note) == NOTE_INSN_PROLOGUE_END)
break; break;
next = NEXT_INSN (insn); next = NEXT_INSN (note);
prev = PREV_INSN (insn); prev = PREV_INSN (note);
if (prev) if (prev)
NEXT_INSN (prev) = next; NEXT_INSN (prev) = next;
if (next) if (next)
PREV_INSN (next) = prev; PREV_INSN (next) = prev;
add_insn_after (insn, end_prologue); add_insn_after (note, insn);
break; break;
} }
} }
if (epilogue) if (epilogue)
{ {
register rtx insn, beg_epilogue; register rtx insn, note = 0;
/* From the start of the last basic block, search forward for an /* Scan from the end until we reach the first epilogue insn.
epilogue insn. */ We apparently can't depend on basic_block_{head,end} after
for (insn = PREV_INSN (NEXT_INSN (basic_block_head[n_basic_blocks - 1])); reorg has run. */
insn; insn = next_nonnote_insn (insn)) for (len = 0; epilogue[len]; len++)
if (beg_epilogue = contains (insn, epilogue)) ;
{
/* Find the epilogue-begin note and move it to just before
the first epilogue insn. */
for (insn = get_last_insn (); insn; insn = PREV_INSN (insn)) for (insn = get_last_insn (); insn; insn = PREV_INSN (insn))
if (GET_CODE (insn) == NOTE if (GET_CODE (insn) == NOTE)
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_EPILOGUE_BEG) {
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EPILOGUE_BEG)
note = insn;
}
else if (contains (insn, epilogue) && --len == 0)
{
/* Find the epilogue-begin note if we haven't already, and
move it to just before the first epilogue insn. */
if (note == 0)
for (note = insn; note = PREV_INSN (note);)
if (GET_CODE (note) == NOTE
&& NOTE_LINE_NUMBER (note) == NOTE_INSN_EPILOGUE_BEG)
break; break;
next = NEXT_INSN (insn); next = NEXT_INSN (note);
prev = PREV_INSN (insn); prev = PREV_INSN (note);
if (prev) if (prev)
NEXT_INSN (prev) = next; NEXT_INSN (prev) = next;
if (next) if (next)
PREV_INSN (next) = prev; PREV_INSN (next) = prev;
add_insn_after (insn, PREV_INSN (beg_epilogue)); add_insn_after (note, PREV_INSN (insn));
break; break;
} }
} }
......
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