aboutsummaryrefslogtreecommitdiff
path: root/gcc/ira.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2011-03-30 09:18:30 -0600
committerJeff Law <law@gcc.gnu.org>2011-03-30 09:18:30 -0600
commitf2034d064c29d9620c5562b2b5b517bdc6c7a672 (patch)
treef600906a3414c87afd503872e7330139e7eb57ed /gcc/ira.c
parent159b81b00a8683b5fe7efdbaff73391a8d9e2d96 (diff)
downloadgcc-f2034d064c29d9620c5562b2b5b517bdc6c7a672.zip
gcc-f2034d064c29d9620c5562b2b5b517bdc6c7a672.tar.gz
gcc-f2034d064c29d9620c5562b2b5b517bdc6c7a672.tar.bz2
reload.h (reg_equiv_constant): Move into new structure reg_equivs, define accessor macro.
* reload.h (reg_equiv_constant): Move into new structure reg_equivs, define accessor macro. (reg_equiv_invariant, reg_equiv_memory_loc): Likewise. (reg_equiv_address, reg_equiv_mem, reg_equiv_alt_mem_list): Likewise. (reg_equiv_init): Likewise. (reg_equivs_size): New variable. (reg_equiv_init_size): Remove. (allocate_initial_values): Move prototype to here from.... * integrate.h (allocate_initial_values): Remove prototype. * integrate.c: Include reload.h. (allocate_initial_values): Corresponding changes. * ira.c (find_reg_equiv_invariant_cost): Corresponding changes. (fix_reg_equiv_init, no_equiv): Corresponding changes. (update_equiv_regs): Corresponding changes. (ira): Corresponding changes. * reload.c (push_reg_equiv_alt_mem): Corresponding changes. (push_secondary_reload): Corresponding changes. (push_reload, find_reloads, find_reloads_toplev): Corresponding changes. (make_memloc, find_reloads_address): Corresponding changes. (subst_reg_equivs, subst_indexed_address): Corresponding changes. (find_reloads_address_1): Corresponding changes. (find_reloads_subreg_address, subst_reloads): Corresponding changes. (refers_to_regno_for_reload_p): Corresponding changes. (reg_overlap_mentioned_for_reload_p): Corresponding changes. (refers_to_mem_for_reload_p, find_equiv_reg): Corresponding changes. * reload1.c: Include ggc.h. (grow_reg_equivs): New function. (replace_pseudos_in, reload): Corresponding changes. (calculate_needs_all_insns, alter_regs): Corresponding changes. (eliminate_regs_1, elimination_effects): Corresponding changes. (emit_input_reload_insns, emit_output_reload_insns): Likewise. (delete_output_reload): Likewise. * caller-save.c (mark_referenced_regs): Corresponding changes. * alpha/alpha.c (resolve_reload_operand): Corresponding changes. * frv/predicates.md (frv_load_operand): Corresponding changes. * microblaze/microblaze.c (double_memory_operand): Corresponding changes. * avr/avr.h (LEGITIMIZE_RELOAD_ADDRESS): Corresponding changes. * xtensa/xtensa.c (fixup_subreg_mem): Corresponding changes. * mn10300/mn10300.c (mn10300_secondary_reload): Corresponding changes. * m68k/m68k.c (emit_move_sequence): Corresponding changes. * arm/arm.c (arm_reload_in_hi, arm_reload_out_hi): Corresponding changes. * pa/pa.c (emit_move_sequence): Corresponding changes. * vax/vax.c (nonindexed_address_p): Corresponding changes. From-SVN: r171731
Diffstat (limited to 'gcc/ira.c')
-rw-r--r--gcc/ira.c67
1 files changed, 27 insertions, 40 deletions
diff --git a/gcc/ira.c b/gcc/ira.c
index de7f5b6..0e0d0be 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1836,15 +1836,15 @@ rtx *ira_reg_equiv_const;
static void
find_reg_equiv_invariant_const (void)
{
- int i;
+ unsigned int i;
bool invariant_p;
rtx list, insn, note, constant, x;
- for (i = FIRST_PSEUDO_REGISTER; i < reg_equiv_init_size; i++)
+ for (i = FIRST_PSEUDO_REGISTER; i < VEC_length (reg_equivs_t, reg_equivs); i++)
{
constant = NULL_RTX;
invariant_p = false;
- for (list = reg_equiv_init[i]; list != NULL_RTX; list = XEXP (list, 1))
+ for (list = reg_equiv_init (i); list != NULL_RTX; list = XEXP (list, 1))
{
insn = XEXP (list, 0);
note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
@@ -2104,17 +2104,18 @@ check_allocation (void)
static void
fix_reg_equiv_init (void)
{
- int max_regno = max_reg_num ();
- int i, new_regno;
+ unsigned int max_regno = max_reg_num ();
+ int i, new_regno, max;
rtx x, prev, next, insn, set;
- if (reg_equiv_init_size < max_regno)
+ if (VEC_length (reg_equivs_t, reg_equivs) < max_regno)
{
- reg_equiv_init = GGC_RESIZEVEC (rtx, reg_equiv_init, max_regno);
- while (reg_equiv_init_size < max_regno)
- reg_equiv_init[reg_equiv_init_size++] = NULL_RTX;
- for (i = FIRST_PSEUDO_REGISTER; i < reg_equiv_init_size; i++)
- for (prev = NULL_RTX, x = reg_equiv_init[i]; x != NULL_RTX; x = next)
+ max = VEC_length (reg_equivs_t, reg_equivs);
+ grow_reg_equivs ();
+ for (i = FIRST_PSEUDO_REGISTER; i < max; i++)
+ for (prev = NULL_RTX, x = reg_equiv_init (i);
+ x != NULL_RTX;
+ x = next)
{
next = XEXP (x, 1);
insn = XEXP (x, 0);
@@ -2136,11 +2137,11 @@ fix_reg_equiv_init (void)
else
{
if (prev == NULL_RTX)
- reg_equiv_init[i] = next;
+ reg_equiv_init (i) = next;
else
XEXP (prev, 1) = next;
- XEXP (x, 1) = reg_equiv_init[new_regno];
- reg_equiv_init[new_regno] = x;
+ XEXP (x, 1) = reg_equiv_init (new_regno);
+ reg_equiv_init (new_regno) = x;
}
}
}
@@ -2645,7 +2646,7 @@ no_equiv (rtx reg, const_rtx store ATTRIBUTE_UNUSED,
should keep their initialization insns. */
if (reg_equiv[regno].is_arg_equivalence)
return;
- reg_equiv_init[regno] = NULL_RTX;
+ reg_equiv_init (regno) = NULL_RTX;
for (; list; list = XEXP (list, 1))
{
rtx insn = XEXP (list, 0);
@@ -2697,8 +2698,7 @@ update_equiv_regs (void)
recorded_label_ref = 0;
reg_equiv = XCNEWVEC (struct equivalence, max_regno);
- reg_equiv_init = ggc_alloc_cleared_vec_rtx (max_regno);
- reg_equiv_init_size = max_regno;
+ grow_reg_equivs ();
init_alias_analysis ();
@@ -2763,8 +2763,8 @@ update_equiv_regs (void)
/* Record for reload that this is an equivalencing insn. */
if (rtx_equal_p (src, XEXP (note, 0)))
- reg_equiv_init[regno]
- = gen_rtx_INSN_LIST (VOIDmode, insn, reg_equiv_init[regno]);
+ reg_equiv_init (regno)
+ = gen_rtx_INSN_LIST (VOIDmode, insn, reg_equiv_init (regno));
/* Continue normally in case this is a candidate for
replacements. */
@@ -2864,8 +2864,8 @@ update_equiv_regs (void)
/* If we haven't done so, record for reload that this is an
equivalencing insn. */
if (!reg_equiv[regno].is_arg_equivalence)
- reg_equiv_init[regno]
- = gen_rtx_INSN_LIST (VOIDmode, insn, reg_equiv_init[regno]);
+ reg_equiv_init (regno)
+ = gen_rtx_INSN_LIST (VOIDmode, insn, reg_equiv_init (regno));
/* Record whether or not we created a REG_EQUIV note for a LABEL_REF.
We might end up substituting the LABEL_REF for uses of the
@@ -2965,7 +2965,7 @@ update_equiv_regs (void)
{
/* This insn makes the equivalence, not the one initializing
the register. */
- reg_equiv_init[regno]
+ reg_equiv_init (regno)
= gen_rtx_INSN_LIST (VOIDmode, insn, NULL_RTX);
df_notes_rescan (init_insn);
}
@@ -3068,7 +3068,7 @@ update_equiv_regs (void)
reg_equiv[regno].init_insns
= XEXP (reg_equiv[regno].init_insns, 1);
- reg_equiv_init[regno] = NULL_RTX;
+ reg_equiv_init (regno) = NULL_RTX;
bitmap_set_bit (cleared_regs, regno);
}
/* Move the initialization of the register to just before
@@ -3101,7 +3101,7 @@ update_equiv_regs (void)
if (insn == BB_HEAD (bb))
BB_HEAD (bb) = PREV_INSN (insn);
- reg_equiv_init[regno]
+ reg_equiv_init (regno)
= gen_rtx_INSN_LIST (VOIDmode, new_insn, NULL_RTX);
bitmap_set_bit (cleared_regs, regno);
}
@@ -3481,19 +3481,8 @@ build_insn_chain (void)
if (dump_file)
print_insn_chains (dump_file);
}
-
-/* Allocate memory for reg_equiv_memory_loc. */
-static void
-init_reg_equiv_memory_loc (void)
-{
- max_regno = max_reg_num ();
- /* And the reg_equiv_memory_loc array. */
- VEC_safe_grow (rtx, gc, reg_equiv_memory_loc_vec, max_regno);
- memset (VEC_address (rtx, reg_equiv_memory_loc_vec), 0,
- sizeof (rtx) * max_regno);
- reg_equiv_memory_loc = VEC_address (rtx, reg_equiv_memory_loc_vec);
-}
+
/* All natural loops. */
struct loops ira_loops;
@@ -3599,8 +3588,6 @@ ira (FILE *f)
record_loop_exits ();
current_loops = &ira_loops;
- init_reg_equiv_memory_loc ();
-
if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
fprintf (ira_dump_file, "Building IRA IR\n");
loops_p = ira_build (optimize
@@ -3670,7 +3657,7 @@ ira (FILE *f)
if (delete_trivially_dead_insns (get_insns (), max_reg_num ()))
df_analyze ();
- init_reg_equiv_memory_loc ();
+ grow_reg_equivs ();
if (max_regno != max_regno_before_ira)
{
@@ -3680,7 +3667,7 @@ ira (FILE *f)
regstat_compute_ri ();
}
- allocate_initial_values (reg_equiv_memory_loc);
+ allocate_initial_values (reg_equivs);
overall_cost_before = ira_overall_cost;
if (ira_conflicts_p)