Commit 546c093e by Richard Henderson Committed by Richard Henderson

cfgrtl.c (purge_dead_edges): Handle abnormal call edges created by non-local gotos.

        * cfgrtl.c (purge_dead_edges): Handle abnormal call edges created
        by non-local gotos.
        * recog.c (peephole2_optimize): Likewise.

From-SVN: r53438
parent bde53486
2002-05-13 Richard Henderson <rth@redhat.com>
* cfgrtl.c (purge_dead_edges): Handle abnormal call edges created
by non-local gotos.
* recog.c (peephole2_optimize): Likewise.
2002-05-13 Andris Pavenis <pavenis@lanet.lv> 2002-05-13 Andris Pavenis <pavenis@lanet.lv>
* cppfiles.c (open_file): Change mode (DJGPP only) of redirected * cppfiles.c (open_file): Change mode (DJGPP only) of redirected
......
...@@ -2131,19 +2131,29 @@ purge_dead_edges (bb) ...@@ -2131,19 +2131,29 @@ purge_dead_edges (bb)
remove_note (insn, note); remove_note (insn, note);
} }
/* Cleanup abnormal edges caused by throwing insns that have been /* Cleanup abnormal edges caused by exceptions or non-local gotos. */
eliminated. */ for (e = bb->succ; e; e = next)
if (! can_throw_internal (bb->end)) {
for (e = bb->succ; e; e = next) next = e->succ_next;
{ if (e->flags & EDGE_EH)
next = e->succ_next; {
if (e->flags & EDGE_EH) if (can_throw_internal (bb->end))
{ continue;
remove_edge (e); }
bb->flags |= BB_DIRTY; else if (e->flags & EDGE_ABNORMAL_CALL)
purged = true; {
} if (GET_CODE (bb->end) == CALL_INSN
} && (! (note = find_reg_note (insn, REG_EH_REGION, NULL))
|| INTVAL (XEXP (note, 0)) >= 0))
continue;
}
else
continue;
remove_edge (e);
bb->flags |= BB_DIRTY;
purged = true;
}
if (GET_CODE (insn) == JUMP_INSN) if (GET_CODE (insn) == JUMP_INSN)
{ {
......
...@@ -3051,6 +3051,7 @@ peephole2_optimize (dump_file) ...@@ -3051,6 +3051,7 @@ peephole2_optimize (dump_file)
rtx try, before_try, x; rtx try, before_try, x;
int match_len; int match_len;
rtx note; rtx note;
bool was_call = false;
/* Record this insn. */ /* Record this insn. */
if (--peep2_current < 0) if (--peep2_current < 0)
...@@ -3077,6 +3078,7 @@ peephole2_optimize (dump_file) ...@@ -3077,6 +3078,7 @@ peephole2_optimize (dump_file)
old_insn = peep2_insn_data[j].insn; old_insn = peep2_insn_data[j].insn;
if (GET_CODE (old_insn) != CALL_INSN) if (GET_CODE (old_insn) != CALL_INSN)
continue; continue;
was_call = true;
new_insn = NULL_RTX; new_insn = NULL_RTX;
if (GET_CODE (try) == SEQUENCE) if (GET_CODE (try) == SEQUENCE)
...@@ -3140,13 +3142,13 @@ peephole2_optimize (dump_file) ...@@ -3140,13 +3142,13 @@ peephole2_optimize (dump_file)
delete_insn_chain (insn, peep2_insn_data[i].insn); delete_insn_chain (insn, peep2_insn_data[i].insn);
/* Re-insert the EH_REGION notes. */ /* Re-insert the EH_REGION notes. */
if (note) if (note || (was_call && nonlocal_goto_handler_labels))
{ {
edge eh_edge; edge eh_edge;
for (eh_edge = bb->succ; eh_edge for (eh_edge = bb->succ; eh_edge
; eh_edge = eh_edge->succ_next) ; eh_edge = eh_edge->succ_next)
if (eh_edge->flags & EDGE_EH) if (eh_edge->flags & (EDGE_EH | EDGE_ABNORMAL_CALL))
break; break;
for (x = try ; x != before_try ; x = PREV_INSN (x)) for (x = try ; x != before_try ; x = PREV_INSN (x))
...@@ -3155,10 +3157,11 @@ peephole2_optimize (dump_file) ...@@ -3155,10 +3157,11 @@ peephole2_optimize (dump_file)
&& may_trap_p (PATTERN (x)) && may_trap_p (PATTERN (x))
&& !find_reg_note (x, REG_EH_REGION, NULL))) && !find_reg_note (x, REG_EH_REGION, NULL)))
{ {
REG_NOTES (x) if (note)
= gen_rtx_EXPR_LIST (REG_EH_REGION, REG_NOTES (x)
XEXP (note, 0), = gen_rtx_EXPR_LIST (REG_EH_REGION,
REG_NOTES (x)); XEXP (note, 0),
REG_NOTES (x));
if (x != bb->end && eh_edge) if (x != bb->end && eh_edge)
{ {
...@@ -3166,7 +3169,8 @@ peephole2_optimize (dump_file) ...@@ -3166,7 +3169,8 @@ peephole2_optimize (dump_file)
int flags; int flags;
nfte = split_block (bb, x); nfte = split_block (bb, x);
flags = EDGE_EH | EDGE_ABNORMAL; flags = (eh_edge->flags
& (EDGE_EH | EDGE_ABNORMAL));
if (GET_CODE (x) == CALL_INSN) if (GET_CODE (x) == CALL_INSN)
flags |= EDGE_ABNORMAL_CALL; flags |= EDGE_ABNORMAL_CALL;
nehe = make_edge (nfte->src, eh_edge->dest, nehe = make_edge (nfte->src, eh_edge->dest,
......
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