aboutsummaryrefslogtreecommitdiff
path: root/gcc/haifa-sched.c
diff options
context:
space:
mode:
authorAndrey Belevantsev <abel@ispras.ru>2014-02-18 09:41:29 +0400
committerAndrey Belevantsev <abel@gcc.gnu.org>2014-02-18 09:41:29 +0400
commitc4cd7435e4ace8e90561b659b810dd5a5841f77a (patch)
tree1bed52a7e0c474f02696375301f02d1025258742 /gcc/haifa-sched.c
parent877ae087f4ec1ca3505b0008f26ca92e2ef906e8 (diff)
downloadgcc-c4cd7435e4ace8e90561b659b810dd5a5841f77a.zip
gcc-c4cd7435e4ace8e90561b659b810dd5a5841f77a.tar.gz
gcc-c4cd7435e4ace8e90561b659b810dd5a5841f77a.tar.bz2
re PR rtl-optimization/58960 (ICE in bmp_iter_set_init)
PR rtl-optimization/58960 * haifa-sched.c (alloc_global_sched_pressure_data): New, factored out from ... (sched_init): ... here. (free_global_sched_pressure_data): New, factored out from ... (sched_finish): ... here. * sched-int.h (free_global_sched_pressure_data): Declare. * sched-rgn.c (nr_regions_initial): New static global. (haifa_find_rgns): Initialize it. (schedule_region): Disable sched-pressure for the newly generated regions. From-SVN: r207832
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r--gcc/haifa-sched.c85
1 files changed, 50 insertions, 35 deletions
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 4d51984..e0d4674 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -6553,6 +6553,54 @@ setup_sched_dump (void)
? stderr : dump_file);
}
+/* Allocate data for register pressure sensitive scheduling. */
+static void
+alloc_global_sched_pressure_data (void)
+{
+ if (sched_pressure != SCHED_PRESSURE_NONE)
+ {
+ int i, max_regno = max_reg_num ();
+
+ if (sched_dump != NULL)
+ /* We need info about pseudos for rtl dumps about pseudo
+ classes and costs. */
+ regstat_init_n_sets_and_refs ();
+ ira_set_pseudo_classes (true, sched_verbose ? sched_dump : NULL);
+ sched_regno_pressure_class
+ = (enum reg_class *) xmalloc (max_regno * sizeof (enum reg_class));
+ for (i = 0; i < max_regno; i++)
+ sched_regno_pressure_class[i]
+ = (i < FIRST_PSEUDO_REGISTER
+ ? ira_pressure_class_translate[REGNO_REG_CLASS (i)]
+ : ira_pressure_class_translate[reg_allocno_class (i)]);
+ curr_reg_live = BITMAP_ALLOC (NULL);
+ if (sched_pressure == SCHED_PRESSURE_WEIGHTED)
+ {
+ saved_reg_live = BITMAP_ALLOC (NULL);
+ region_ref_regs = BITMAP_ALLOC (NULL);
+ }
+ }
+}
+
+/* Free data for register pressure sensitive scheduling. Also called
+ from schedule_region when stopping sched-pressure early. */
+void
+free_global_sched_pressure_data (void)
+{
+ if (sched_pressure != SCHED_PRESSURE_NONE)
+ {
+ if (regstat_n_sets_and_refs != NULL)
+ regstat_free_n_sets_and_refs ();
+ if (sched_pressure == SCHED_PRESSURE_WEIGHTED)
+ {
+ BITMAP_FREE (region_ref_regs);
+ BITMAP_FREE (saved_reg_live);
+ }
+ BITMAP_FREE (curr_reg_live);
+ free (sched_regno_pressure_class);
+ }
+}
+
/* Initialize some global state for the scheduler. This function works
with the common data shared between all the schedulers. It is called
from the scheduler specific initialization routine. */
@@ -6656,29 +6704,7 @@ sched_init (void)
if (targetm.sched.init_global)
targetm.sched.init_global (sched_dump, sched_verbose, get_max_uid () + 1);
- if (sched_pressure != SCHED_PRESSURE_NONE)
- {
- int i, max_regno = max_reg_num ();
-
- if (sched_dump != NULL)
- /* We need info about pseudos for rtl dumps about pseudo
- classes and costs. */
- regstat_init_n_sets_and_refs ();
- ira_set_pseudo_classes (true, sched_verbose ? sched_dump : NULL);
- sched_regno_pressure_class
- = (enum reg_class *) xmalloc (max_regno * sizeof (enum reg_class));
- for (i = 0; i < max_regno; i++)
- sched_regno_pressure_class[i]
- = (i < FIRST_PSEUDO_REGISTER
- ? ira_pressure_class_translate[REGNO_REG_CLASS (i)]
- : ira_pressure_class_translate[reg_allocno_class (i)]);
- curr_reg_live = BITMAP_ALLOC (NULL);
- if (sched_pressure == SCHED_PRESSURE_WEIGHTED)
- {
- saved_reg_live = BITMAP_ALLOC (NULL);
- region_ref_regs = BITMAP_ALLOC (NULL);
- }
- }
+ alloc_global_sched_pressure_data ();
curr_state = xmalloc (dfa_state_size);
}
@@ -6777,18 +6803,7 @@ void
sched_finish (void)
{
haifa_finish_h_i_d ();
- if (sched_pressure != SCHED_PRESSURE_NONE)
- {
- if (regstat_n_sets_and_refs != NULL)
- regstat_free_n_sets_and_refs ();
- if (sched_pressure == SCHED_PRESSURE_WEIGHTED)
- {
- BITMAP_FREE (region_ref_regs);
- BITMAP_FREE (saved_reg_live);
- }
- BITMAP_FREE (curr_reg_live);
- free (sched_regno_pressure_class);
- }
+ free_global_sched_pressure_data ();
free (curr_state);
if (targetm.sched.finish_global)