aboutsummaryrefslogtreecommitdiff
path: root/gcc/flow.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>2000-05-16 18:44:03 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-05-16 18:44:03 -0700
commitf5540cd4aacb0a614929b2afa0912d2f28ba00f1 (patch)
treed6bcb2f865cce1fba604f777cacacf150b20230e /gcc/flow.c
parent23568fa021aa71b8bab49c2b9fc0ed58f30b033d (diff)
downloadgcc-f5540cd4aacb0a614929b2afa0912d2f28ba00f1.zip
gcc-f5540cd4aacb0a614929b2afa0912d2f28ba00f1.tar.gz
gcc-f5540cd4aacb0a614929b2afa0912d2f28ba00f1.tar.bz2
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
Diffstat (limited to 'gcc/flow.c')
-rw-r--r--gcc/flow.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/gcc/flow.c b/gcc/flow.c
index a8573e1..e24822e 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -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,37 +1675,38 @@ 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;
+ 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. */
-
- e = bb->succ;
- if (e->dest != EXIT_BLOCK_PTR
- || e->succ_next != NULL
- || (e->flags & EDGE_FALLTHRU) == 0)
- abort ();
- e->flags &= ~EDGE_FALLTHRU;
-
- emit_barrier_after (last);
- }
- else
- abort ();
- }
- }
+ 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. */
+
+ e = bb->succ;
+ if (e->dest != EXIT_BLOCK_PTR
+ || e->succ_next != NULL
+ || (e->flags & EDGE_FALLTHRU) == 0)
+ abort ();
+ e->flags &= ~EDGE_FALLTHRU;
+
+ emit_barrier_after (last);
+ bb->end = last;
+
+ if (before)
+ flow_delete_insn (before);
}
+ 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;