Commit 6c2511d3 by Richard Sandiford Committed by Richard Sandiford

rtl.h (skip_consecutive_labels): Declare.

	* rtl.h (skip_consecutive_labels): Declare.
	* emit-rtl.c (skip_consecutive_labels): New function.
	* reorg.c (relax_delay_slots, dbr_schedule): Use it.
	* jump.c (follow_jumps): Say what null return values mean.

From-SVN: r82357
parent 4fbf3498
2004-05-28 Richard Sandiford <rsandifo@redhat.com>
* rtl.h (skip_consecutive_labels): Declare.
* emit-rtl.c (skip_consecutive_labels): New function.
* reorg.c (relax_delay_slots, dbr_schedule): Use it.
* jump.c (follow_jumps): Say what null return values mean.
2004-05-28 Kaz Kojima <kkojima@gcc.gnu.org> 2004-05-28 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/13250 PR target/13250
......
...@@ -3110,6 +3110,21 @@ prev_label (rtx insn) ...@@ -3110,6 +3110,21 @@ prev_label (rtx insn)
return insn; return insn;
} }
/* Return the last label to mark the same position as LABEL. Return null
if LABEL itself is null. */
rtx
skip_consecutive_labels (rtx label)
{
rtx insn;
for (insn = label; insn != 0 && !INSN_P (insn); insn = NEXT_INSN (insn))
if (LABEL_P (insn))
label = insn;
return label;
}
#ifdef HAVE_cc0 #ifdef HAVE_cc0
/* INSN uses CC0 and is being moved into a delay slot. Set up REG_CC_SETTER /* INSN uses CC0 and is being moved into a delay slot. Set up REG_CC_SETTER
and REG_CC_USER notes so we can find it. */ and REG_CC_USER notes so we can find it. */
......
...@@ -999,6 +999,7 @@ sets_cc0_p (rtx x) ...@@ -999,6 +999,7 @@ sets_cc0_p (rtx x)
/* Follow any unconditional jump at LABEL; /* Follow any unconditional jump at LABEL;
return the ultimate label reached by any such chain of jumps. return the ultimate label reached by any such chain of jumps.
Return null if the chain ultimately leads to a return instruction.
If LABEL is not followed by a jump, return LABEL. If LABEL is not followed by a jump, return LABEL.
If the chain loops or we can't find end, return LABEL, If the chain loops or we can't find end, return LABEL,
since that tells caller to avoid changing the insn. since that tells caller to avoid changing the insn.
......
...@@ -3079,11 +3079,7 @@ relax_delay_slots (rtx first) ...@@ -3079,11 +3079,7 @@ relax_delay_slots (rtx first)
&& (condjump_p (insn) || condjump_in_parallel_p (insn)) && (condjump_p (insn) || condjump_in_parallel_p (insn))
&& (target_label = JUMP_LABEL (insn)) != 0) && (target_label = JUMP_LABEL (insn)) != 0)
{ {
target_label = follow_jumps (target_label); target_label = skip_consecutive_labels (follow_jumps (target_label));
/* See comment further down why we must use next_real_insn here,
instead of next_active_insn. */
target_label = prev_label (next_real_insn (target_label));
if (target_label == 0) if (target_label == 0)
target_label = find_end_label (); target_label = find_end_label ();
...@@ -3231,14 +3227,8 @@ relax_delay_slots (rtx first) ...@@ -3231,14 +3227,8 @@ relax_delay_slots (rtx first)
{ {
/* If this jump goes to another unconditional jump, thread it, but /* If this jump goes to another unconditional jump, thread it, but
don't convert a jump into a RETURN here. */ don't convert a jump into a RETURN here. */
trial = follow_jumps (target_label); trial = skip_consecutive_labels (follow_jumps (target_label));
/* We use next_real_insn instead of next_active_insn, so that if (trial == 0)
the special USE insns emitted by reorg won't be ignored.
If they are ignored, then they will get deleted if target_label
is now unreachable, and that would cause mark_target_live_regs
to fail. */
trial = prev_label (next_real_insn (trial));
if (trial == 0 && target_label != 0)
trial = find_end_label (); trial = find_end_label ();
if (trial != target_label if (trial != target_label
...@@ -3621,7 +3611,7 @@ dbr_schedule (rtx first, FILE *file) ...@@ -3621,7 +3611,7 @@ dbr_schedule (rtx first, FILE *file)
if (GET_CODE (insn) == JUMP_INSN if (GET_CODE (insn) == JUMP_INSN
&& (condjump_p (insn) || condjump_in_parallel_p (insn)) && (condjump_p (insn) || condjump_in_parallel_p (insn))
&& JUMP_LABEL (insn) != 0 && JUMP_LABEL (insn) != 0
&& ((target = prev_label (next_active_insn (JUMP_LABEL (insn)))) && ((target = skip_consecutive_labels (JUMP_LABEL (insn)))
!= JUMP_LABEL (insn))) != JUMP_LABEL (insn)))
redirect_jump (insn, target, 1); redirect_jump (insn, target, 1);
} }
......
...@@ -1695,6 +1695,7 @@ extern rtx next_active_insn (rtx); ...@@ -1695,6 +1695,7 @@ extern rtx next_active_insn (rtx);
extern int active_insn_p (rtx); extern int active_insn_p (rtx);
extern rtx prev_label (rtx); extern rtx prev_label (rtx);
extern rtx next_label (rtx); extern rtx next_label (rtx);
extern rtx skip_consecutive_labels (rtx);
extern rtx next_cc0_user (rtx); extern rtx next_cc0_user (rtx);
extern rtx prev_cc0_setter (rtx); extern rtx prev_cc0_setter (rtx);
......
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