aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1997-09-22 00:49:32 +0000
committerJeff Law <law@gcc.gnu.org>1997-09-21 18:49:32 -0600
commit2a1777af229bc5e9e738fd5bb8285ac0c1e24a7d (patch)
tree18e02cdfa9330785934ec403168033e5f85505e6 /gcc/loop.c
parent37842442c3a0fc8e10d227cd7af112fdd4ef14e7 (diff)
downloadgcc-2a1777af229bc5e9e738fd5bb8285ac0c1e24a7d.zip
gcc-2a1777af229bc5e9e738fd5bb8285ac0c1e24a7d.tar.gz
gcc-2a1777af229bc5e9e738fd5bb8285ac0c1e24a7d.tar.bz2
jump.c (jmp_uses_reg_or_mem): Deleted unused function.
* jump.c (jmp_uses_reg_or_mem): Deleted unused function. (find_basic_blocks): Use computed_jump_p to determine if a particular JUMP_INSN is a computed jump. * reg-stack.c (find_blocks): Use computed_jump_p to determine if a particular JUMP_INSN is a computed jump. * rtlanal.c (jmp_uses_reg_or_mem): New function. (computed_jump_p): Likewise. * rtl.h (computed_jump_p): Declare. * genattrtab.c (pc_rtx): Define and initialize. * loop.c (loop_optimize): Always determine if the current function has a computed jump. (indirect_jump_in_function_p): Use computed_jump_p to determine if a particular JUMP_INSN is a computed jump. General (and haifa) cleanups. From-SVN: r15615
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index d73d339..3bbe741 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -330,13 +330,14 @@ static void insert_bct ();
/* Auxiliary function that inserts the bct pattern into the loop */
static void instrument_loop_bct ();
-/* Indirect_jump_in_function is computed once per function. */
-int indirect_jump_in_function = 0;
-static int indirect_jump_in_function_p ();
int loop_number ();
#endif /* HAIFA */
+/* Indirect_jump_in_function is computed once per function. */
+int indirect_jump_in_function = 0;
+static int indirect_jump_in_function_p ();
+
/* Relative gain of eliminating various kinds of operations. */
int add_cost;
@@ -507,11 +508,9 @@ loop_optimize (f, dumpfile)
if (flag_unroll_loops && write_symbols != NO_DEBUG)
find_loop_tree_blocks ();
-#ifdef HAIFA
- /* determine if the function has indirect jump. If it does,
- we cannot instrument loops in this function with bct */
+ /* Determine if the function has indirect jump. On some systems
+ this prevents low overhead loop instructions from being used. */
indirect_jump_in_function = indirect_jump_in_function_p (f);
-#endif /* HAIFA */
/* Now scan the loops, last ones first, since this means inner ones are done
before outer ones. */
@@ -7592,8 +7591,12 @@ loop_number (loop_start, loop_end)
return loop_num;
}
+#endif /* HAIFA */
+
+/* Scan the function and determine whether it has indirect (computed) jumps.
-/* scan the function and determine whether it has indirect (computed) jump */
+ This is taken mostly from flow.c; similar code exists elsewhere
+ in the compiler. It may be useful to put this into rtlanal.c. */
static int
indirect_jump_in_function_p (start)
rtx start;
@@ -7601,25 +7604,8 @@ indirect_jump_in_function_p (start)
rtx insn;
int is_indirect_jump = 0;
- for (insn = start; insn; insn = NEXT_INSN (insn)) {
- if (GET_CODE (insn) == JUMP_INSN) {
- if (GET_CODE (PATTERN (insn)) == SET) {
- rtx insn_work_code = XEXP (PATTERN (insn), 1);
-
- if (GET_CODE (insn_work_code) == LABEL_REF)
- continue;
- if (GET_CODE (insn_work_code) == IF_THEN_ELSE) {
- rtx jump_target = XEXP (insn_work_code, 1);
-
- if (jump_target == pc_rtx
- || (GET_CODE (jump_target) == (enum rtx_code)LABEL_REF))
- continue;
- }
- }
- is_indirect_jump = 1;
- }
- }
- return is_indirect_jump;
+ for (insn = start; insn; insn = NEXT_INSN (insn))
+ if (computed_jump_p (insn))
+ return 1;
}
-#endif /* HAIFA */
/* END CYGNUS LOCAL haifa */