Commit dbeee829 by David S. Miller Committed by David S. Miller

Properly limit backwards label scanning in reorg.

	* reorg.c (label_before_next_insn): New function.
	(relax_delay_slots): Use it instead of prev_label.
	* rtl.h (prev_label): Delete declaration.
	* emit-rtl.c (prev_label): Remove.

From-SVN: r180674
parent cc1efdff
2011-10-30 David S. Miller <davem@davemloft.net>
* reorg.c (label_before_next_insn): New function.
(relax_delay_slots): Use it instead of prev_label.
* rtl.h (prev_label): Delete declaration.
* emit-rtl.c (prev_label): Remove.
2011-10-30 Revital Eres <revital.eres@linaro.org> 2011-10-30 Revital Eres <revital.eres@linaro.org>
* modulo-sched.c (generate_prolog_epilog): Mark prolog and epilog * modulo-sched.c (generate_prolog_epilog): Mark prolog and epilog
...@@ -3330,21 +3330,6 @@ next_label (rtx insn) ...@@ -3330,21 +3330,6 @@ next_label (rtx insn)
return insn; return insn;
} }
/* Return the last CODE_LABEL before the insn INSN, or 0 if there is none. */
rtx
prev_label (rtx insn)
{
while (insn)
{
insn = PREV_INSN (insn);
if (insn == 0 || LABEL_P (insn))
break;
}
return insn;
}
/* Return the last label to mark the same position as LABEL. Return LABEL /* Return the last label to mark the same position as LABEL. Return LABEL
itself if it is null or any return rtx. */ itself if it is null or any return rtx. */
......
...@@ -3349,6 +3349,21 @@ delete_jump (rtx insn) ...@@ -3349,6 +3349,21 @@ delete_jump (rtx insn)
delete_computation (insn); delete_computation (insn);
} }
static rtx
label_before_next_insn (rtx x, rtx scan_limit)
{
rtx insn = next_active_insn (x);
while (insn)
{
insn = PREV_INSN (insn);
if (insn == scan_limit || insn == NULL_RTX)
return NULL_RTX;
if (LABEL_P (insn))
break;
}
return insn;
}
/* Once we have tried two ways to fill a delay slot, make a pass over the /* Once we have tried two ways to fill a delay slot, make a pass over the
code to try to improve the results and to do such things as more jump code to try to improve the results and to do such things as more jump
...@@ -3634,7 +3649,7 @@ relax_delay_slots (rtx first) ...@@ -3634,7 +3649,7 @@ relax_delay_slots (rtx first)
identical to the one in its delay slot. In this case, we can just identical to the one in its delay slot. In this case, we can just
delete the branch and the insn in its delay slot. */ delete the branch and the insn in its delay slot. */
if (next && NONJUMP_INSN_P (next) if (next && NONJUMP_INSN_P (next)
&& prev_label (next_active_insn (next)) == target_label && label_before_next_insn (next, insn) == target_label
&& simplejump_p (insn) && simplejump_p (insn)
&& XVECLEN (pat, 0) == 2 && XVECLEN (pat, 0) == 2
&& rtx_equal_p (PATTERN (next), PATTERN (XVECEXP (pat, 0, 1)))) && rtx_equal_p (PATTERN (next), PATTERN (XVECEXP (pat, 0, 1))))
......
...@@ -1812,7 +1812,6 @@ extern rtx next_real_insn (rtx); ...@@ -1812,7 +1812,6 @@ extern rtx next_real_insn (rtx);
extern rtx prev_active_insn (rtx); extern rtx prev_active_insn (rtx);
extern rtx next_active_insn (rtx); extern rtx next_active_insn (rtx);
extern int active_insn_p (const_rtx); extern int active_insn_p (const_rtx);
extern rtx prev_label (rtx);
extern rtx next_label (rtx); extern rtx next_label (rtx);
extern rtx skip_consecutive_labels (rtx); extern rtx skip_consecutive_labels (rtx);
extern rtx next_cc0_user (rtx); extern rtx next_cc0_user (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