Commit 1bf14ad7 by Jan Hubicka Committed by Jan Hubicka

loop.c (scan_loop, [...]): Change unroll_p and bct_p parameters to flags.

	* loop.c (scan_loop, strength_reduce, loop_optimize): Change unroll_p
	and bct_p parameters to flags.
	* loop.h (LOOP_UNROLL, LOOP_BCT): New constants.
	* rtl.h (loop_optimize): Update prototype.
	* toplev.c (rest_of_compilation): Update call of loop_optimize.

From-SVN: r33912
parent b8d254e6
Mon May 15 19:01:42 MET DST 2000 Jan Hubicka <jh@suse.cz>
* loop.c (scan_loop, strength_reduce, loop_optimize): Change unroll_p
and bct_p parameters to flags.
* loop.h (LOOP_UNROLL, LOOP_BCT): New constants.
* rtl.h (loop_optimize): Update prototype.
* toplev.c (rest_of_compilation): Update call of loop_optimize.
2000-05-15 Jakub Jelinek <jakub@redhat.com> 2000-05-15 Jakub Jelinek <jakub@redhat.com>
* calls.c (expand_call): Move expand_start_target_temps call after * calls.c (expand_call): Move expand_start_target_temps call after
......
...@@ -246,7 +246,7 @@ static void count_loop_regs_set PARAMS ((rtx, rtx, varray_type, varray_type, ...@@ -246,7 +246,7 @@ static void count_loop_regs_set PARAMS ((rtx, rtx, varray_type, varray_type,
static void note_addr_stored PARAMS ((rtx, rtx, void *)); static void note_addr_stored PARAMS ((rtx, rtx, void *));
static void note_set_pseudo_multiple_uses PARAMS ((rtx, rtx, void *)); static void note_set_pseudo_multiple_uses PARAMS ((rtx, rtx, void *));
static int loop_reg_used_before_p PARAMS ((const struct loop *, rtx, rtx)); static int loop_reg_used_before_p PARAMS ((const struct loop *, rtx, rtx));
static void scan_loop PARAMS ((struct loop*, int, int)); static void scan_loop PARAMS ((struct loop*, int));
#if 0 #if 0
static void replace_call_address PARAMS ((rtx, rtx, rtx)); static void replace_call_address PARAMS ((rtx, rtx, rtx));
#endif #endif
...@@ -261,7 +261,7 @@ static void add_label_notes PARAMS ((rtx, rtx)); ...@@ -261,7 +261,7 @@ static void add_label_notes PARAMS ((rtx, rtx));
static void move_movables PARAMS ((struct loop *loop, struct movable *, static void move_movables PARAMS ((struct loop *loop, struct movable *,
int, int, int)); int, int, int));
static int count_nonfixed_reads PARAMS ((const struct loop *, rtx)); static int count_nonfixed_reads PARAMS ((const struct loop *, rtx));
static void strength_reduce PARAMS ((struct loop *, int, int, int)); static void strength_reduce PARAMS ((struct loop *, int, int));
static void find_single_use_in_loop PARAMS ((rtx, rtx, varray_type)); static void find_single_use_in_loop PARAMS ((rtx, rtx, varray_type));
static int valid_initial_value_p PARAMS ((rtx, rtx, int, rtx)); static int valid_initial_value_p PARAMS ((rtx, rtx, int, rtx));
static void find_mem_givs PARAMS ((const struct loop *, rtx, rtx, int, int)); static void find_mem_givs PARAMS ((const struct loop *, rtx, rtx, int, int));
...@@ -417,11 +417,11 @@ compute_luids (start, end, prev_luid) ...@@ -417,11 +417,11 @@ compute_luids (start, end, prev_luid)
(or 0 if none should be output). */ (or 0 if none should be output). */
void void
loop_optimize (f, dumpfile, unroll_p, bct_p) loop_optimize (f, dumpfile, flags)
/* f is the first instruction of a chain of insns for one function */ /* f is the first instruction of a chain of insns for one function */
rtx f; rtx f;
FILE *dumpfile; FILE *dumpfile;
int unroll_p, bct_p; int flags;
{ {
register rtx insn; register rtx insn;
register int i; register int i;
...@@ -527,7 +527,7 @@ loop_optimize (f, dumpfile, unroll_p, bct_p) ...@@ -527,7 +527,7 @@ loop_optimize (f, dumpfile, unroll_p, bct_p)
struct loop *loop = &loops->array[i]; struct loop *loop = &loops->array[i];
if (! loop->invalid && loop->end) if (! loop->invalid && loop->end)
scan_loop (loop, unroll_p, bct_p); scan_loop (loop, flags);
} }
/* If there were lexical blocks inside the loop, they have been /* If there were lexical blocks inside the loop, they have been
...@@ -586,9 +586,9 @@ next_insn_in_loop (loop, insn) ...@@ -586,9 +586,9 @@ next_insn_in_loop (loop, insn)
write, then we can also mark the memory read as invariant. */ write, then we can also mark the memory read as invariant. */
static void static void
scan_loop (loop, unroll_p, bct_p) scan_loop (loop, flags)
struct loop *loop; struct loop *loop;
int unroll_p, bct_p; int flags;
{ {
register int i; register int i;
rtx loop_start = loop->start; rtx loop_start = loop->start;
...@@ -1140,7 +1140,7 @@ scan_loop (loop, unroll_p, bct_p) ...@@ -1140,7 +1140,7 @@ scan_loop (loop, unroll_p, bct_p)
if (flag_strength_reduce) if (flag_strength_reduce)
{ {
the_movables = movables; the_movables = movables;
strength_reduce (loop, insn_count, unroll_p, bct_p); strength_reduce (loop, insn_count, flags);
reg_scan_update (update_start, update_end, loop_max_reg); reg_scan_update (update_start, update_end, loop_max_reg);
loop_max_reg = max_reg_num (); loop_max_reg = max_reg_num ();
...@@ -3853,10 +3853,10 @@ for_each_insn_in_loop (loop, fncall) ...@@ -3853,10 +3853,10 @@ for_each_insn_in_loop (loop, fncall)
But scan_loop must check regnos to make sure they are in bounds. */ But scan_loop must check regnos to make sure they are in bounds. */
static void static void
strength_reduce (loop, insn_count, unroll_p, bct_p) strength_reduce (loop, insn_count, flags)
struct loop *loop; struct loop *loop;
int insn_count; int insn_count;
int unroll_p, bct_p ATTRIBUTE_UNUSED; int flags;
{ {
rtx p; rtx p;
/* Temporary list pointers for traversing loop_iv_list. */ /* Temporary list pointers for traversing loop_iv_list. */
...@@ -3956,7 +3956,7 @@ strength_reduce (loop, insn_count, unroll_p, bct_p) ...@@ -3956,7 +3956,7 @@ strength_reduce (loop, insn_count, unroll_p, bct_p)
{ {
/* Can still unroll the loop anyways, but indicate that there is no /* Can still unroll the loop anyways, but indicate that there is no
strength reduction info available. */ strength reduction info available. */
if (unroll_p) if (flags & LOOP_UNROLL)
unroll_loop (loop, insn_count, end_insert_before, 0); unroll_loop (loop, insn_count, end_insert_before, 0);
goto egress; goto egress;
...@@ -4633,7 +4633,7 @@ strength_reduce (loop, insn_count, unroll_p, bct_p) ...@@ -4633,7 +4633,7 @@ strength_reduce (loop, insn_count, unroll_p, bct_p)
VARRAY_GROW (reg_iv_type, nregs); VARRAY_GROW (reg_iv_type, nregs);
VARRAY_GROW (reg_iv_info, nregs); VARRAY_GROW (reg_iv_info, nregs);
} }
recombine_givs (loop, bl, unroll_p); recombine_givs (loop, bl, flags & LOOP_UNROLL);
/* Reduce each giv that we decided to reduce. */ /* Reduce each giv that we decided to reduce. */
...@@ -5027,14 +5027,14 @@ strength_reduce (loop, insn_count, unroll_p, bct_p) ...@@ -5027,14 +5027,14 @@ strength_reduce (loop, insn_count, unroll_p, bct_p)
induction variable information that strength_reduce has already induction variable information that strength_reduce has already
collected. Always unroll loops that would be as small or smaller collected. Always unroll loops that would be as small or smaller
unrolled than when rolled. */ unrolled than when rolled. */
if (unroll_p if ((flags & LOOP_UNROLL)
|| (loop_info->n_iterations > 0 || (loop_info->n_iterations > 0
&& unrolled_insn_copies <= insn_count)) && unrolled_insn_copies <= insn_count))
unroll_loop (loop, insn_count, end_insert_before, 1); unroll_loop (loop, insn_count, end_insert_before, 1);
#ifdef HAVE_decrement_and_branch_on_count #ifdef HAVE_decrement_and_branch_on_count
/* Instrument the loop with BCT insn. */ /* Instrument the loop with BCT insn. */
if (HAVE_decrement_and_branch_on_count && bct_p if (HAVE_decrement_and_branch_on_count && (flags & LOOP_BCT)
&& flag_branch_on_count_reg) && flag_branch_on_count_reg)
insert_bct (loop); insert_bct (loop);
#endif /* HAVE_decrement_and_branch_on_count */ #endif /* HAVE_decrement_and_branch_on_count */
......
...@@ -20,6 +20,10 @@ Boston, MA 02111-1307, USA. */ ...@@ -20,6 +20,10 @@ Boston, MA 02111-1307, USA. */
#include "varray.h" #include "varray.h"
#include "basic-block.h" #include "basic-block.h"
/* Flags passed to loop_optimize. */
#define LOOP_UNROLL 1
#define LOOP_BCT 2
/* Get the loop info pointer of a loop. */ /* Get the loop info pointer of a loop. */
#define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux) #define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux)
......
...@@ -1614,7 +1614,7 @@ extern void print_inline_rtx PARAMS ((FILE *, rtx, int)); ...@@ -1614,7 +1614,7 @@ extern void print_inline_rtx PARAMS ((FILE *, rtx, int));
extern void init_loop PARAMS ((void)); extern void init_loop PARAMS ((void));
extern rtx libcall_other_reg PARAMS ((rtx, rtx)); extern rtx libcall_other_reg PARAMS ((rtx, rtx));
#ifdef BUFSIZ #ifdef BUFSIZ
extern void loop_optimize PARAMS ((rtx, FILE *, int, int)); extern void loop_optimize PARAMS ((rtx, FILE *, int));
#endif #endif
extern void record_excess_regs PARAMS ((rtx, rtx, rtx *)); extern void record_excess_regs PARAMS ((rtx, rtx, rtx *));
......
...@@ -2995,7 +2995,7 @@ rest_of_compilation (decl) ...@@ -2995,7 +2995,7 @@ rest_of_compilation (decl)
{ {
/* We only want to perform unrolling once. */ /* We only want to perform unrolling once. */
loop_optimize (insns, rtl_dump_file, 0, 0); loop_optimize (insns, rtl_dump_file, 0);
/* The first call to loop_optimize makes some instructions /* The first call to loop_optimize makes some instructions
trivially dead. We delete those instructions now in the trivially dead. We delete those instructions now in the
...@@ -3007,7 +3007,7 @@ rest_of_compilation (decl) ...@@ -3007,7 +3007,7 @@ rest_of_compilation (decl)
analysis code depends on this information. */ analysis code depends on this information. */
reg_scan (insns, max_reg_num (), 1); reg_scan (insns, max_reg_num (), 1);
} }
loop_optimize (insns, rtl_dump_file, flag_unroll_loops, 1); loop_optimize (insns, rtl_dump_file, (flag_unroll_loops ? LOOP_UNROLL : 0) | LOOP_BCT);
close_dump_file (DFI_loop, print_rtl, insns); close_dump_file (DFI_loop, print_rtl, insns);
timevar_pop (TV_LOOP); timevar_pop (TV_LOOP);
......
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