static void note_addr_stored 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 void scan_loop PARAMS ((struct loop*, int, int));
+static void scan_loop PARAMS ((struct loop*, int));
#if 0
static void replace_call_address PARAMS ((rtx, rtx, rtx));
#endif
static void move_movables PARAMS ((struct loop *loop, struct movable *,
int, int, int));
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 int valid_initial_value_p PARAMS ((rtx, rtx, int, rtx));
static void find_mem_givs PARAMS ((const struct loop *, rtx, rtx, int, int));
(or 0 if none should be output). */
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 */
rtx f;
FILE *dumpfile;
- int unroll_p, bct_p;
+ int flags;
{
register rtx insn;
register int i;
struct loop *loop = &loops->array[i];
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
write, then we can also mark the memory read as invariant. */
static void
-scan_loop (loop, unroll_p, bct_p)
+scan_loop (loop, flags)
struct loop *loop;
- int unroll_p, bct_p;
+ int flags;
{
register int i;
rtx loop_start = loop->start;
if (flag_strength_reduce)
{
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);
loop_max_reg = max_reg_num ();
But scan_loop must check regnos to make sure they are in bounds. */
static void
-strength_reduce (loop, insn_count, unroll_p, bct_p)
+strength_reduce (loop, insn_count, flags)
struct loop *loop;
int insn_count;
- int unroll_p, bct_p ATTRIBUTE_UNUSED;
+ int flags;
{
rtx p;
/* Temporary list pointers for traversing loop_iv_list. */
{
/* Can still unroll the loop anyways, but indicate that there is no
strength reduction info available. */
- if (unroll_p)
+ if (flags & LOOP_UNROLL)
unroll_loop (loop, insn_count, end_insert_before, 0);
goto egress;
VARRAY_GROW (reg_iv_type, 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. */
induction variable information that strength_reduce has already
collected. Always unroll loops that would be as small or smaller
unrolled than when rolled. */
- if (unroll_p
+ if ((flags & LOOP_UNROLL)
|| (loop_info->n_iterations > 0
&& unrolled_insn_copies <= insn_count))
unroll_loop (loop, insn_count, end_insert_before, 1);
#ifdef HAVE_decrement_and_branch_on_count
/* 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)
insert_bct (loop);
#endif /* HAVE_decrement_and_branch_on_count */
{
/* 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
trivially dead. We delete those instructions now in the
analysis code depends on this information. */
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);
timevar_pop (TV_LOOP);