diff options
author | raeburn <raeburn@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-02-01 12:50:53 +0000 |
---|---|---|
committer | raeburn <raeburn@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-02-01 12:50:53 +0000 |
commit | 433c8fce75620744442557fc734fe9f1a37cde44 (patch) | |
tree | 6e36a17f813c9f393e14690ca6a6478095b3fcb0 /gcc/unroll.c | |
parent | c8140ab7fa342591434dcc10856ccfe96c768b81 (diff) | |
download | gcc-433c8fce75620744442557fc734fe9f1a37cde44.tar.gz |
Use varrays for constant-equivalence data:
* varray.h (struct const_equiv_data): New type.
(union varray_data_tag): New element const_equiv.
(VARRAY_CONST_EQUIV_INIT, VARRAY_CONST_EQUIV): New macros.
(VARRAY_SIZE): New macro, returns number of elements.
* integrate.h: Include varray.h.
(struct inline_remap): Replace const_equiv_map, const_age_map and
const_equiv_map_size with a const_equiv_varray element.
(MAYBE_EXTEND_CONST_EQUIV_VARRAY): New macro; grows varray if needed.
(SET_CONST_EQUIV_DATA): New macro; sets rtx and age fields simultaneously,
growing the varray if needed.
* integrate.c (global_const_equiv_map, global_const_equiv_map_size): Deleted,
replaced by....
(global_const_equiv_varray): New variable.
(expand_inline_function): References changed.
* integrate.h: Update declarations.
* integrate.c (process_reg_parm, expand_inline_function,
copy_rtx_and_substitute, try_constants, subst_constants, mark_stores): Use
varray allocation and accessor macros, new integrate.h macros, and
global_const_equiv_varray. Don't conditionalize non-NULL stores on array size;
instead, expand the array as needed.
* unroll.c (unroll_loop): Likewise.
* unroll.c (unroll_loop): Initialize const_equiv_varray element to zero. After
allocating varray, always exit through bottom of function, where it can be
deallocated if needed. Don't explicitly reallocate const_equiv_map storage;
instead, just ensure the varray has been initialized, and update the global
reference.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24956 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/unroll.c')
-rw-r--r-- | gcc/unroll.c | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/gcc/unroll.c b/gcc/unroll.c index b3a7f507fec..0d1787c0e52 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -239,7 +239,6 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, char *local_label; char *local_regno; int maxregnum; - int new_maxregnum; rtx exit_label = 0; rtx start_label; struct iv_class *bl; @@ -684,6 +683,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, map = (struct inline_remap *) alloca (sizeof (struct inline_remap)); map->integrating = 0; + map->const_equiv_varray = 0; /* Allocate the label map. */ @@ -873,12 +873,9 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, map->reg_map = (rtx *) alloca (maxregnum * sizeof (rtx)); - map->const_equiv_map = (rtx *) alloca (maxregnum * sizeof (rtx)); - map->const_age_map = (unsigned *) alloca (maxregnum - * sizeof (unsigned)); - map->const_equiv_map_size = maxregnum; - global_const_equiv_map = map->const_equiv_map; - global_const_equiv_map_size = maxregnum; + VARRAY_CONST_EQUIV_INIT (map->const_equiv_varray, maxregnum, + "unroll_loop"); + global_const_equiv_varray = map->const_equiv_varray; init_reg_map (map, maxregnum); @@ -1045,9 +1042,9 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, PREV_INSN (loop_start)); bzero ((char *) map->insn_map, max_insnno * sizeof (rtx)); - bzero ((char *) map->const_equiv_map, maxregnum * sizeof (rtx)); - bzero ((char *) map->const_age_map, - maxregnum * sizeof (unsigned)); + bzero ((char *) &VARRAY_CONST_EQUIV (map->const_equiv_varray, 0), + (VARRAY_SIZE (map->const_equiv_varray) + * sizeof (struct const_equiv_data))); map->const_age = 0; for (j = 0; j < max_labelno; j++) @@ -1113,7 +1110,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, { if (loop_dump_stream) fprintf (loop_dump_stream, "Unrolling failure: Naive unrolling not being done.\n"); - return; + goto egress; } /* At this point, we are guaranteed to unroll the loop. */ @@ -1149,19 +1146,11 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, init_reg_map (map, maxregnum); - /* Space is needed in some of the map for new registers, so new_maxregnum - is an (over)estimate of how many registers will exist at the end. */ - new_maxregnum = maxregnum + (temp * unroll_number * 2); - - /* Must realloc space for the constant maps, because the number of registers - may have changed. */ - - 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; - global_const_equiv_map_size = new_maxregnum; + if (map->const_equiv_varray == 0) + VARRAY_CONST_EQUIV_INIT (map->const_equiv_varray, + maxregnum + temp * unroll_number * 2, + "unroll_loop"); + global_const_equiv_varray = map->const_equiv_varray; /* Search the list of bivs and givs to find ones which need to be remapped when split, and set their reg_map entry appropriately. */ @@ -1202,8 +1191,8 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, for (i = 0; i < unroll_number; i++) { bzero ((char *) map->insn_map, max_insnno * sizeof (rtx)); - bzero ((char *) map->const_equiv_map, new_maxregnum * sizeof (rtx)); - bzero ((char *) map->const_age_map, new_maxregnum * sizeof (unsigned)); + bzero ((char *) &VARRAY_CONST_EQUIV (map->const_equiv_varray, 0), + VARRAY_SIZE (map->const_equiv_varray) * sizeof (struct const_equiv_data)); map->const_age = 0; for (j = 0; j < max_labelno; j++) @@ -1280,6 +1269,10 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, not taken. */ if (exit_label) emit_label_after (exit_label, loop_end); + + egress: + if (map && map->const_equiv_varray) + VARRAY_FREE (map->const_equiv_varray); } /* Return true if the loop can be safely, and profitably, preconditioned @@ -1949,9 +1942,10 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, { int regno = REGNO (SET_DEST (pattern)); - if (regno < map->const_equiv_map_size - && map->const_age_map[regno] == map->const_age) - map->const_age_map[regno] = -1; + if (regno < VARRAY_SIZE (map->const_equiv_varray) + && (VARRAY_CONST_EQUIV (map->const_equiv_varray, regno).age + == map->const_age)) + VARRAY_CONST_EQUIV (map->const_equiv_varray, regno).age = -1; } break; @@ -2106,7 +2100,7 @@ copy_loop_body (copy_start, copy_end, map, exit_label, last_iteration, /* Be lazy and assume CALL_INSNs clobber all hard registers. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - map->const_equiv_map[i] = 0; + VARRAY_CONST_EQUIV (map->const_equiv_varray, i).rtx = 0; break; case CODE_LABEL: |