From bcfc9e7de416d7cf7cf069b4a51df194a05ef12f Mon Sep 17 00:00:00 2001 From: hubicka Date: Mon, 15 May 2000 17:07:13 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33912 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/loop.c | 28 ++++++++++++++-------------- gcc/loop.h | 4 ++++ gcc/rtl.h | 2 +- gcc/toplev.c | 4 ++-- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae88e9c..fe2d0b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Mon May 15 19:01:42 MET DST 2000 Jan Hubicka + + * 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 * calls.c (expand_call): Move expand_start_target_temps call after diff --git a/gcc/loop.c b/gcc/loop.c index 0969678..d31dbeb 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -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_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 @@ -261,7 +261,7 @@ static void add_label_notes PARAMS ((rtx, rtx)); 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)); @@ -417,11 +417,11 @@ compute_luids (start, end, prev_luid) (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; @@ -527,7 +527,7 @@ loop_optimize (f, dumpfile, unroll_p, bct_p) 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 @@ -586,9 +586,9 @@ next_insn_in_loop (loop, insn) 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; @@ -1140,7 +1140,7 @@ scan_loop (loop, unroll_p, bct_p) 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 (); @@ -3853,10 +3853,10 @@ for_each_insn_in_loop (loop, fncall) 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. */ @@ -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 strength reduction info available. */ - if (unroll_p) + if (flags & LOOP_UNROLL) unroll_loop (loop, insn_count, end_insert_before, 0); goto egress; @@ -4633,7 +4633,7 @@ strength_reduce (loop, insn_count, unroll_p, bct_p) 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. */ @@ -5027,14 +5027,14 @@ strength_reduce (loop, insn_count, unroll_p, bct_p) 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 */ diff --git a/gcc/loop.h b/gcc/loop.h index 9c4affb..046196f 100644 --- a/gcc/loop.h +++ b/gcc/loop.h @@ -20,6 +20,10 @@ Boston, MA 02111-1307, USA. */ #include "varray.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. */ #define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux) diff --git a/gcc/rtl.h b/gcc/rtl.h index ccd143e..089d48b 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1614,7 +1614,7 @@ extern void print_inline_rtx PARAMS ((FILE *, rtx, int)); extern void init_loop PARAMS ((void)); extern rtx libcall_other_reg PARAMS ((rtx, rtx)); #ifdef BUFSIZ -extern void loop_optimize PARAMS ((rtx, FILE *, int, int)); +extern void loop_optimize PARAMS ((rtx, FILE *, int)); #endif extern void record_excess_regs PARAMS ((rtx, rtx, rtx *)); diff --git a/gcc/toplev.c b/gcc/toplev.c index 1d89a7c..9017f9e 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2995,7 +2995,7 @@ rest_of_compilation (decl) { /* 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 @@ -3007,7 +3007,7 @@ rest_of_compilation (decl) 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); -- 2.7.4