diff options
author | Bernd Schmidt <bernd.schmidt@analog.com> | 2009-02-13 11:41:22 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2009-02-13 11:41:22 +0000 |
commit | dd2139e7dbe039f0c7c16f10a8d33491c810972b (patch) | |
tree | 8f9adb60f904a59396358046da85f05a71cc4af7 | |
parent | b1c92d54c4f880a15084dfdfa1779d59d9736f81 (diff) | |
download | gcc-dd2139e7dbe039f0c7c16f10a8d33491c810972b.zip gcc-dd2139e7dbe039f0c7c16f10a8d33491c810972b.tar.gz gcc-dd2139e7dbe039f0c7c16f10a8d33491c810972b.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/bfin/bfin.c | 51 |
2 files changed, 37 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53bb0b0..ee937fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 949ceac..dcfbd1f 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -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. */ |