Commit 77472c5a by Tom Wood

(delete_computation): Derived from delete_jump.

(delete_jump): Use delete_computation.

From-SVN: r1944
parent cdd8c058
......@@ -108,6 +108,7 @@ void redirect_tablejump ();
static int delete_labelref_insn ();
static void mark_jump_label ();
void delete_jump ();
void delete_computation ();
static void delete_from_jump_chain ();
static int tension_vector_labels ();
static void find_cross_jump ();
......@@ -2820,13 +2821,12 @@ delete_jump (insn)
rtx insn;
{
register rtx x = PATTERN (insn);
register rtx prev;
if (GET_CODE (x) == SET
&& GET_CODE (SET_DEST (x)) == PC)
{
prev = prev_nonnote_insn (insn);
#ifdef HAVE_cc0
rtx prev = prev_nonnote_insn (insn);
/* We assume that at this stage
CC's are always set explicitly
and always immediately before the jump that
......@@ -2844,25 +2844,37 @@ delete_jump (insn)
REG_NOTES (prev) = gen_rtx (EXPR_LIST, REG_UNUSED,
cc0_rtx, REG_NOTES (prev));
}
#else
{
rtx note;
#endif
/* Now delete the jump insn itself. */
delete_computation (insn);
}
}
/* If we are running before flow.c, we need do nothing since flow.c
will delete the set of the condition code if it is dead. We also
can't know if the register being used as the condition code is
/* Delete INSN and recursively delete insns that compute values used only
by INSN. This uses the REG_DEAD notes computed during flow analysis.
If we are running before flow.c, we need do nothing since flow.c will
delete dead code. We also can't know if the registers being used are
dead or not at this point.
Otherwise, look at all our REG_DEAD notes. If a previous insn
does nothing other than set a register that dies in this jump,
we can delete the insn. */
Otherwise, look at all our REG_DEAD notes. If a previous insn does
nothing other than set a register that dies in this insn, we can delete
that insn as well. */
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
void
delete_computation (insn)
rtx insn;
{
#ifndef HAVE_cc0
rtx note, next;
for (note = REG_NOTES (insn); note; note = next)
{
rtx our_prev;
next = XEXP (note, 1);
if (REG_NOTE_KIND (note) != REG_DEAD
/* Verify that the REG_NOTE has a legal value. */
/* Verify that the REG_NOTE is legitimate. */
|| GET_CODE (XEXP (note, 0)) != REG)
continue;
......@@ -2903,28 +2915,29 @@ delete_jump (insn)
}
if (i == XVECLEN (PATTERN (our_prev), 0))
delete_insn (our_prev);
delete_computation (our_prev);
}
else if (GET_CODE (PATTERN (our_prev)) == SET
&& SET_DEST (PATTERN (our_prev)) == XEXP (note, 0))
delete_insn (our_prev);
delete_computation (our_prev);
break;
}
/* If OUR_PREV references the register that dies here,
it is an additional use. Hence any prior SET isn't
dead. */
/* If OUR_PREV references the register that dies here, it is an
additional use. Hence any prior SET isn't dead. However, this
insn becomes the new place for the REG_DEAD note. */
if (reg_overlap_mentioned_p (XEXP (note, 0),
PATTERN (our_prev)))
{
XEXP (note, 1) = REG_NOTES (our_prev);
REG_NOTES (our_prev) = note;
break;
}
}
}
#endif
/* Now delete the jump insn itself. */
#endif /* Don't HAVE_cc0 */
delete_insn (insn);
}
}
/* Delete insn INSN from the chain of insns and update label ref counts.
......
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