aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-doloop.c
diff options
context:
space:
mode:
authorAdrian Straetling <straetling@de.ibm.com>2005-05-25 11:52:13 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2005-05-25 11:52:13 +0000
commitec0171a642eb63e4985b3293688d50eb7bbe78e8 (patch)
treef896023adb7eb858c67b994bbe4eac93db8874ba /gcc/loop-doloop.c
parenta1eae476a8e379d59f9afa6fca99171e51e10696 (diff)
2005-05-25 Adrian Straetling <straetling@de.ibm.com>
* loop-doloop.c: Include "target.h". (doloop_valid_p): Move tests to function in targhooks.c. * target.h (struct gcc_target): New target hook "insn_valid_within_doloop". * target-def.h: Define default value for "insn_valid_within_doloop". (TARGET_INITIALIZER): Insert new target hook into initializer. * targhooks.c (default_insn_valid_within_doloop): New function. * targhooks.h (default_insn_valid_within_doloop): Declare. * hooks.c (hook_bool_rtx_true): New function. * hooks.h (hook_bool_rtx_true): Declare. * doc/tm.texi: Add documentation for new target hook. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@100143 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-doloop.c')
-rw-r--r--gcc/loop-doloop.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index c6ef37e84d6..4a2bb8774ee 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -33,6 +33,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "cfgloop.h"
#include "output.h"
#include "params.h"
+#include "target.h"
/* This module is used to modify loops with a determinable number of
iterations to use special low-overhead looping instructions.
@@ -187,27 +188,14 @@ doloop_valid_p (struct loop *loop, struct niter_desc *desc)
insn != NEXT_INSN (BB_END (bb));
insn = NEXT_INSN (insn))
{
- /* A called function may clobber any special registers required for
- low-overhead looping. */
- if (CALL_P (insn))
- {
- if (dump_file)
- fprintf (dump_file, "Doloop: Function call in loop.\n");
+ /* Different targets have different necessities for low-overhead
+ looping. Call the back end for each instruction within the loop
+ to let it decide whether the insn is valid. */
+ if (!targetm.insn_valid_within_doloop (insn))
+ {
result = false;
goto cleanup;
- }
-
- /* Some targets (eg, PPC) use the count register for branch on table
- instructions. ??? This should be a target specific check. */
- if (JUMP_P (insn)
- && (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
- || GET_CODE (PATTERN (insn)) == ADDR_VEC))
- {
- if (dump_file)
- fprintf (dump_file, "Doloop: Computed branch in the loop.\n");
- result = false;
- goto cleanup;
- }
+ }
}
}
result = true;