check for this separately here. We will delete such an
insn below.
- Tablejump insns contain a USE of the table, so simply replacing
- the operand with the constant won't match. This is simply an
- unconditional branch, however, and is therefore valid. Just
- insert the substitution here and we will delete and re-emit
- the insn later. */
-
+ For other cases such as a table jump or conditional jump
+ where we know the ultimate target, go ahead and replace the
+ operand. While that may not make a valid insn, we will
+ reemit the jump below (and also insert any necessary
+ barriers). */
if (n_sets == 1 && dest == pc_rtx
&& (trial == pc_rtx
|| (GET_CODE (trial) == LABEL_REF
&& ! condjump_p (insn))))
{
- if (trial == pc_rtx)
- {
- SET_SRC (sets[i].rtl) = trial;
- cse_jumps_altered = 1;
- break;
- }
-
- PATTERN (insn) = gen_jump (XEXP (trial, 0));
- INSN_CODE (insn) = -1;
-
- if (NEXT_INSN (insn) != 0
- && GET_CODE (NEXT_INSN (insn)) != BARRIER)
- emit_barrier_after (insn);
-
+ SET_SRC (sets[i].rtl) = trial;
cse_jumps_altered = 1;
break;
}
}
/* If this SET is now setting PC to a label, we know it used to
- be a conditional or computed branch. So we see if we can follow
- it. If it was a computed branch, delete it and re-emit. */
+ be a conditional or computed branch. */
else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF)
{
- /* If this is not in the format for a simple branch and
- we are the only SET in it, re-emit it. */
- if (! simplejump_p (insn) && n_sets == 1)
+ /* We reemit the jump in as many cases as possible just in
+ case the form of an unconditional jump is significantly
+ different than a computed jump or conditional jump.
+
+ If this insn has multiple sets, then reemitting the
+ jump is nontrivial. So instead we just force rerecognition
+ and hope for the best. */
+ if (n_sets == 1)
{
rtx new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn);
JUMP_LABEL (new) = XEXP (src, 0);
insn = new;
}
else
- /* Otherwise, force rerecognition, since it probably had
- a different pattern before.
- This shouldn't really be necessary, since whatever
- changed the source value above should have done this.
- Until the right place is found, might as well do this here. */
INSN_CODE (insn) = -1;
never_reached_warning (insn);