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
This commit is contained in:
Bernd Schmidt 2009-02-13 11:41:22 +00:00 committed by Bernd Schmidt
parent b1c92d54c4
commit dd2139e7db
2 changed files with 37 additions and 18 deletions

View file

@ -3,6 +3,10 @@
* loop-iv.c (implies_p): In the final case, test that operands 0
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>
* configure.ac: Enable LFS.

View file

@ -3554,7 +3554,36 @@ bfin_adjust_cost (rtx insn, rtx link, rtx dep_insn, int 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
current function. */
@ -3932,16 +3961,16 @@ bfin_optimize_loop (loop_info loop)
- Returns (RTS, RTN, etc.) */
bb = loop->tail;
last_insn = PREV_INSN (loop->loop_end);
last_insn = find_prev_insn_start (loop->loop_end);
while (1)
{
for (; last_insn != PREV_INSN (BB_HEAD (bb));
last_insn = PREV_INSN (last_insn))
for (; last_insn != BB_HEAD (bb);
last_insn = find_prev_insn_start (last_insn))
if (INSN_P (last_insn))
break;
if (last_insn != PREV_INSN (BB_HEAD (bb)))
if (last_insn != BB_HEAD (bb))
break;
if (single_pred_p (bb)
@ -4888,20 +4917,6 @@ trapping_loads_p (rtx 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
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. */