aboutsummaryrefslogtreecommitdiff
path: root/gcc/reginfo.c
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2009-10-14 16:24:11 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2009-10-14 16:24:11 +0000
commit1833192f30abf95ec0124033882e6bcb64552e6f (patch)
tree793540b6a00bb42653fb0e372d22502ee7bdf535 /gcc/reginfo.c
parent200c8750d65ebebc8a0d6f6f77a7f02b5a4a8ef3 (diff)
downloadgcc-1833192f30abf95ec0124033882e6bcb64552e6f.zip
gcc-1833192f30abf95ec0124033882e6bcb64552e6f.tar.gz
gcc-1833192f30abf95ec0124033882e6bcb64552e6f.tar.bz2
params.def (PARAM_IRA_LOOP_RESERVED_REGS): New.
2009-09-26 Vladimir Makarov <vmakarov@redhat.com> * params.def (PARAM_IRA_LOOP_RESERVED_REGS): New. * params.h (IRA_LOOP_RESERVED_REGS): New * tree-pass.h (pass_subregs_of_mode_init, pass_subregs_of_mode_finish): Remove. * passes.c (pass_subregs_of_mode_init, pass_subregs_of_mode_finish): Remove. (pass_reginfo_init): Move before loop optimizations. * config/i386/i386.h (STACK_REG_COVER_CLASS): Define. * common.opt (fira-loop-pressure): New. * toplev.h (flag_ira_loop_pressure): New. * rtl.h (init_subregs_of_mode, finish_subregs_of_mode): New externals. * reginfo.c (init_subregs_of_mode, finish_subregs_of_mode): Make external and void type functions. (gate_subregs_of_mode_init, pass_subregs_of_mode_init, pass_subregs_of_mode_finish): Remove. * ira-costs.c (init_costs): Call init_subregs_of_mode. * regmove.c: Include ira.h. (regmove_optimize): Call ira_set_pseudo_classes after IRA based register pressure calculation in loops. * loop-invariant.c: Include REGS_H and ira.h. (struct loop_data): New members max_reg_pressure, regs_ref, and regs_live. (struct invariant): New member orig_regno. (curr_loop): New variable. (find_exits): Initialize regs_ref and regs_live. (create_new_invariant): Initialize orig_regno. (get_cover_class_and_nregs): New. (get_inv_cost): Make aregs_needed an array. Use regs_needed as an array. Add code for flag_ira_loop_pressure. (gain_for_invariant): Make new_regs an array. Add code for flag_ira_loop_pressure. (best_gain_for_invariant): Ditto. (set_move_mark): New parameter gain. Use it for debugging output. (find_invariants_to_move): Make regs_needed and new_regs an array. Add code for flag_ira_loop_pressure. (move_invariant_reg): Set up orig_regno. (move_invariants): Set up reg classes for pseudos for flag_ira_loop_pressure. (free_loop_data): Clear regs_ref and regs_live. (curr_regs_live, curr_reg_pressure, regs_set, n_regs_set, get_regno_cover_class, change_pressure, mark_regno_live, mark_regno_death, mark_reg_store, mark_reg_clobber, mark_reg_death, mark_ref_regs, calculate_loop_reg_pressure): New. (move_loop_invariants): Calculate pressure. Initialize curr_loop. * ira.c (ira): Call ira_set_pseudo_classes after IRA based register pressure calculation in loops if new regs were added. Call finish_subregs_of_mode. * opts.c (decode_options): Set up flag_ira_loop_pressure. * Makefile.in (loop-invariant.o): Add ira.h. (regmove.o): Ditto. * doc/invoke.texi (-fira-loop-pressure, ira-loop-reserved-regs): Describe. * doc/tm.texi (STACK_REG_COVER_CLASS): Describe. From-SVN: r152770
Diffstat (limited to 'gcc/reginfo.c')
-rw-r--r--gcc/reginfo.c69
1 files changed, 8 insertions, 61 deletions
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 0f11c91a3..96e9bd9 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -904,6 +904,9 @@ struct reg_pref
run. */
static struct reg_pref *reg_pref;
+/* Current size of reg_info. */
+static int reg_info_size;
+
/* Return the reg_class in which pseudo reg number REGNO is best allocated.
This function is sometimes called before the info has been computed.
When that happens, just return GENERAL_REGS, which is innocuous. */
@@ -937,9 +940,6 @@ reg_cover_class (int regno)
-/* Current size of reg_info. */
-static int reg_info_size;
-
/* Allocate space for reg info. */
static void
allocate_reg_info (void)
@@ -1040,6 +1040,7 @@ setup_reg_classes (int regno,
{
if (reg_pref == NULL)
return;
+ gcc_assert (reg_info_size == max_reg_num ());
reg_pref[regno].prefclass = prefclass;
reg_pref[regno].altclass = altclass;
reg_pref[regno].coverclass = coverclass;
@@ -1321,7 +1322,7 @@ find_subregs_of_mode (rtx x)
}
}
-static unsigned int
+void
init_subregs_of_mode (void)
{
basic_block bb;
@@ -1336,8 +1337,6 @@ init_subregs_of_mode (void)
FOR_BB_INSNS (bb, insn)
if (INSN_P (insn))
find_subregs_of_mode (PATTERN (insn));
-
- return 0;
}
/* Return 1 if REGNO has had an invalid mode change in CLASS from FROM
@@ -1367,74 +1366,22 @@ invalid_mode_change_p (unsigned int regno,
return false;
}
-static unsigned int
+void
finish_subregs_of_mode (void)
{
htab_delete (subregs_of_mode);
subregs_of_mode = 0;
- return 0;
}
#else
-static unsigned int
+void
init_subregs_of_mode (void)
{
- return 0;
}
-static unsigned int
+void
finish_subregs_of_mode (void)
{
- return 0;
}
#endif /* CANNOT_CHANGE_MODE_CLASS */
-static bool
-gate_subregs_of_mode_init (void)
-{
-#ifdef CANNOT_CHANGE_MODE_CLASS
- return true;
-#else
- return false;
-#endif
-}
-
-struct rtl_opt_pass pass_subregs_of_mode_init =
-{
- {
- RTL_PASS,
- "subregs_of_mode_init", /* name */
- gate_subregs_of_mode_init, /* gate */
- init_subregs_of_mode, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_NONE, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0 /* todo_flags_finish */
- }
-};
-
-struct rtl_opt_pass pass_subregs_of_mode_finish =
-{
- {
- RTL_PASS,
- "subregs_of_mode_finish", /* name */
- gate_subregs_of_mode_init, /* gate */
- finish_subregs_of_mode, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_NONE, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0 /* todo_flags_finish */
- }
-};
-
-
#include "gt-reginfo.h"