flow.c (commit_one_edge_insertion): Be prepared for a return insn to be inserted on the edge with a normal jump.

* flow.c (commit_one_edge_insertion): Be prepared for a return
        insn to be inserted on the edge with a normal jump.
        * jump.c (jump_optimize_1): Don't look to create return isns.

        * flow.c (flow_delete_insn): Don't adjust reference count of notes.
        * jump.c (jump_optimize_1): Likewise.
        (returnjump_p): Verify the argument is a JUMP_INSN.
        * rtl.def (NOTE): Add 5th element for NOTE_INSN_DELETED_LABEL.

From-SVN: r33950
This commit is contained in:
Richard Henderson 2000-05-16 18:44:03 -07:00
parent 23568fa021
commit f5540cd4aa
4 changed files with 92 additions and 79 deletions

View File

@ -1,3 +1,14 @@
2000-05-16 Richard Henderson <rth@cygnus.com>
* flow.c (commit_one_edge_insertion): Be prepared for a return
insn to be inserted on the edge with a normal jump.
* jump.c (jump_optimize_1): Don't look to create return isns.
* flow.c (flow_delete_insn): Don't adjust reference count of notes.
* jump.c (jump_optimize_1): Likewise.
(returnjump_p): Verify the argument is a JUMP_INSN.
* rtl.def (NOTE): Add 5th element for NOTE_INSN_DELETED_LABEL.
2000-05-16 Nick Clifton <nickc@cygnus.com>
* config/m32r/m32r.c (small_insn_p): Use INSN_P() to replace

View File

@ -1598,7 +1598,7 @@ static void
commit_one_edge_insertion (e)
edge e;
{
rtx before = NULL_RTX, after = NULL_RTX, insns, tmp;
rtx before = NULL_RTX, after = NULL_RTX, insns, tmp, last;
basic_block bb;
/* Pull the insns off the edge now since the edge might go away. */
@ -1675,22 +1675,22 @@ commit_one_edge_insertion (e)
emit_insns_before (insns, before);
if (before == bb->head)
bb->head = insns;
last = prev_nonnote_insn (before);
}
else
{
rtx last = emit_insns_after (insns, after);
last = emit_insns_after (insns, after);
if (after == bb->end)
{
bb->end = last;
}
if (GET_CODE (last) == JUMP_INSN)
{
if (returnjump_p (last))
{
/* ??? Remove all outgoing edges from BB and add one
for EXIT. This is not currently a problem because
this only happens for the (single) epilogue, which
already has a fallthru edge to EXIT. */
/* ??? Remove all outgoing edges from BB and add one for EXIT.
This is not currently a problem because this only happens
for the (single) epilogue, which already has a fallthru edge
to EXIT. */
e = bb->succ;
if (e->dest != EXIT_BLOCK_PTR
@ -1700,13 +1700,14 @@ commit_one_edge_insertion (e)
e->flags &= ~EDGE_FALLTHRU;
emit_barrier_after (last);
bb->end = last;
if (before)
flow_delete_insn (before);
}
else
else if (GET_CODE (last) == JUMP_INSN)
abort ();
}
}
}
}
/* Update the CFG for all queued instructions. */
@ -2027,11 +2028,14 @@ flow_delete_insn (insn)
/* If deleting a jump, decrement the use count of the label. Deleting
the label itself should happen in the normal course of block merging. */
if (GET_CODE (insn) == JUMP_INSN && JUMP_LABEL (insn))
if (GET_CODE (insn) == JUMP_INSN
&& JUMP_LABEL (insn)
&& GET_CODE (JUMP_LABEL (insn)) == CODE_LABEL)
LABEL_NUSES (JUMP_LABEL (insn))--;
/* Also if deleting an insn that references a label. */
else if ((note = find_reg_note (insn, REG_LABEL, NULL_RTX)) != NULL_RTX)
else if ((note = find_reg_note (insn, REG_LABEL, NULL_RTX)) != NULL_RTX
&& GET_CODE (XEXP (note, 0)) == CODE_LABEL)
LABEL_NUSES (XEXP (note, 0))--;
return next;

View File

@ -231,10 +231,12 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan,
mark_all_labels (f, cross_jump);
/* Keep track of labels used from static data;
they cannot ever be deleted. */
/* Keep track of labels used from static data; we don't track them
closely enough to delete them here, so make sure their reference
count doesn't drop to zero. */
for (insn = forced_labels; insn; insn = XEXP (insn, 1))
if (GET_CODE (XEXP (insn, 0)) == CODE_LABEL)
LABEL_NUSES (XEXP (insn, 0))++;
check_exception_handler_labels ();
@ -381,14 +383,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan,
}
}
/* If a jump references the end of the function, try to turn
it into a RETURN insn, possibly a conditional one. */
if (JUMP_LABEL (insn) != 0
&& (next_active_insn (JUMP_LABEL (insn)) == 0
|| GET_CODE (PATTERN (next_active_insn (JUMP_LABEL (insn))))
== RETURN))
changed |= redirect_jump (insn, NULL_RTX);
reallabelprev = prev_active_insn (JUMP_LABEL (insn));
/* Detect jump to following insn. */
@ -2261,6 +2255,8 @@ int
returnjump_p (insn)
rtx insn;
{
if (GET_CODE (insn) != JUMP_INSN)
return 0;
return for_each_rtx (&PATTERN (insn), returnjump_p_1, NULL);
}

View File

@ -421,9 +421,11 @@ DEF_RTL_EXPR(BARRIER, "barrier", "iuu", 'x')
DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuu00iss", 'x')
/* Say where in the code a source line starts, for symbol table's sake.
Contains a filename and a line number. Line numbers <= 0 are special;
See enum note_insn in rtl.h. */
DEF_RTL_EXPR(NOTE, "note", "iuu0n", 'x')
Operand:
3: filename, if line number > 0, note-specific data otherwise.
4: line number if > 0, enum note_insn otherwise.
5: unique number if line number == note_insn_deleted_label. */
DEF_RTL_EXPR(NOTE, "note", "iuu0ni", 'x')
/* ----------------------------------------------------------------------
Top level constituents of INSN, JUMP_INSN and CALL_INSN.