summaryrefslogtreecommitdiff
path: root/gcc/unroll.c
diff options
context:
space:
mode:
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-10-11 21:02:37 +0000
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1993-10-11 21:02:37 +0000
commita433411e437606f6f1d8a4c4955f2b4884f4912e (patch)
tree2bf2813d3ce41485827a6483efc733a688a61675 /gcc/unroll.c
parentd9d08cdd48acac0be9ab5e21874b868e18744857 (diff)
downloadgcc-a433411e437606f6f1d8a4c4955f2b4884f4912e.tar.gz
(unroll_loop): Set map->const_equiv_map_size to new_maxregnum.
(copy_loop_body): When set const_age_map entry for split dest reg, verify that it is within the bounds of the map. (find_splittable_regs): Count number of biv sets, not number of bivs. Don't pass result to find_splittable_givs. (find_splittable_givs): Delete parameter result. Add local variable result. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@5741 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/unroll.c')
-rw-r--r--gcc/unroll.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/unroll.c b/gcc/unroll.c
index fc8a3f69f19..038c99854ec 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -999,6 +999,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
map->const_equiv_map = (rtx *) alloca (new_maxregnum * sizeof (rtx));
map->const_age_map = (unsigned *) alloca (new_maxregnum * sizeof (unsigned));
+ map->const_equiv_map_size = new_maxregnum;
global_const_equiv_map = map->const_equiv_map;
/* Search the list of bivs and givs to find ones which need to be remapped
@@ -1718,7 +1719,8 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration,
{
int regno = REGNO (SET_DEST (pattern));
- if (map->const_age_map[regno] == map->const_age)
+ if (regno < map->const_equiv_map_size
+ && map->const_age_map[regno] == map->const_age)
map->const_age_map[regno] = -1;
}
break;
@@ -2226,7 +2228,10 @@ approx_final_value (comparison_code, comparison_value, unsigned_p, compare_dir)
It must be set to the initial value of the induction variable here.
Otherwise, splittable_regs will hold the difference between the current
value of the induction variable and the value the induction variable had
- at the top of the loop. It must be set to the value 0 here. */
+ at the top of the loop. It must be set to the value 0 here.
+
+ Returns the total number of instructions that set registers that are
+ splittable. */
/* ?? If the loop is only unrolled twice, then most of the restrictions to
constant values are unnecessary, since we can easily calculate increment
@@ -2335,8 +2340,7 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before,
we can treat the last one specially. */
splittable_regs_updates[bl->regno] = bl->biv_count;
-
- result++;
+ result += bl->biv_count;
if (loop_dump_stream)
fprintf (loop_dump_stream,
@@ -2348,8 +2352,8 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before,
depend on it may be splittable if the biv is live outside the
loop, and the givs aren't. */
- result = find_splittable_givs (bl, unroll_type, loop_start, loop_end,
- increment, unroll_number, result);
+ result += find_splittable_givs (bl, unroll_type, loop_start, loop_end,
+ increment, unroll_number);
/* If final value is non-zero, then must emit an instruction which sets
the value of the biv to the proper value. This is done after
@@ -2393,20 +2397,23 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before,
}
/* For every giv based on the biv BL, check to determine whether it is
- splittable. This is a subroutine to find_splittable_regs (). */
+ splittable. This is a subroutine to find_splittable_regs ().
+
+ Return the number of instructions that set splittable registers. */
static int
find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment,
- unroll_number, result)
+ unroll_number)
struct iv_class *bl;
enum unroll_types unroll_type;
rtx loop_start, loop_end;
rtx increment;
- int unroll_number, result;
+ int unroll_number;
{
struct induction *v;
rtx final_value;
rtx tem;
+ int result = 0;
for (v = bl->giv; v; v = v->next_iv)
{