Commit dd2139e7 by Bernd Schmidt Committed by Bernd Schmidt

bfin.c (find_prev_insn_start): New function.

	* config/bfin/bfin.c (find_prev_insn_start): New function.
	(bfin_optimize_loop): Use it in some cases instead of PREV_INSN.
	(find_next_insn_start): Move.

From-SVN: r144153
parent b1c92d54
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
* loop-iv.c (implies_p): In the final case, test that operands 0 * loop-iv.c (implies_p): In the final case, test that operands 0
of the two comparisons match. of the two comparisons match.
* config/bfin/bfin.c (find_prev_insn_start): New function.
(bfin_optimize_loop): Use it in some cases instead of PREV_INSN.
(find_next_insn_start): Move.
2009-02-13 Richard Guenther <rguenther@suse.de> 2009-02-13 Richard Guenther <rguenther@suse.de>
* configure.ac: Enable LFS. * configure.ac: Enable LFS.
......
...@@ -3554,7 +3554,36 @@ bfin_adjust_cost (rtx insn, rtx link, rtx dep_insn, int cost) ...@@ -3554,7 +3554,36 @@ bfin_adjust_cost (rtx insn, rtx link, rtx dep_insn, int cost)
return cost; return cost;
} }
/* This function acts like NEXT_INSN, but is aware of three-insn bundles and
skips all subsequent parallel instructions if INSN is the start of such
a group. */
static rtx
find_next_insn_start (rtx insn)
{
if (GET_MODE (insn) == SImode)
{
while (GET_MODE (insn) != QImode)
insn = NEXT_INSN (insn);
}
return NEXT_INSN (insn);
}
/* This function acts like PREV_INSN, but is aware of three-insn bundles and
skips all subsequent parallel instructions if INSN is the start of such
a group. */
static rtx
find_prev_insn_start (rtx insn)
{
insn = PREV_INSN (insn);
gcc_assert (GET_MODE (insn) != SImode);
if (GET_MODE (insn) == QImode)
{
while (GET_MODE (PREV_INSN (insn)) == SImode)
insn = PREV_INSN (insn);
}
return insn;
}
/* Increment the counter for the number of loop instructions in the /* Increment the counter for the number of loop instructions in the
current function. */ current function. */
...@@ -3932,16 +3961,16 @@ bfin_optimize_loop (loop_info loop) ...@@ -3932,16 +3961,16 @@ bfin_optimize_loop (loop_info loop)
- Returns (RTS, RTN, etc.) */ - Returns (RTS, RTN, etc.) */
bb = loop->tail; bb = loop->tail;
last_insn = PREV_INSN (loop->loop_end); last_insn = find_prev_insn_start (loop->loop_end);
while (1) while (1)
{ {
for (; last_insn != PREV_INSN (BB_HEAD (bb)); for (; last_insn != BB_HEAD (bb);
last_insn = PREV_INSN (last_insn)) last_insn = find_prev_insn_start (last_insn))
if (INSN_P (last_insn)) if (INSN_P (last_insn))
break; break;
if (last_insn != PREV_INSN (BB_HEAD (bb))) if (last_insn != BB_HEAD (bb))
break; break;
if (single_pred_p (bb) if (single_pred_p (bb)
...@@ -4888,20 +4917,6 @@ trapping_loads_p (rtx insn) ...@@ -4888,20 +4917,6 @@ trapping_loads_p (rtx insn)
return may_trap_p (SET_SRC (single_set (insn))); return may_trap_p (SET_SRC (single_set (insn)));
} }
/* This function acts like NEXT_INSN, but is aware of three-insn bundles and
skips all subsequent parallel instructions if INSN is the start of such
a group. */
static rtx
find_next_insn_start (rtx insn)
{
if (GET_MODE (insn) == SImode)
{
while (GET_MODE (insn) != QImode)
insn = NEXT_INSN (insn);
}
return NEXT_INSN (insn);
}
/* Return INSN if it is of TYPE_MCLD. Alternatively, if INSN is the start of /* Return INSN if it is of TYPE_MCLD. Alternatively, if INSN is the start of
a three-insn bundle, see if one of them is a load and return that if so. a three-insn bundle, see if one of them is a load and return that if so.
Return NULL_RTX if the insn does not contain loads. */ Return NULL_RTX if the insn does not contain loads. */
......
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