From 9994ad20a13463bf79f22f439a072df3de23f238 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Tue, 16 Sep 2014 05:24:31 +0000 Subject: [PATCH] Clean up useless initialization for IRA if using LRA. gcc/ * ira.c (ira): Don't initialize ira_spilled_reg_stack_slots and ira_spilled_reg_stack_slots_num if using lra. (do_reload): Remove release ira_spilled_reg_stack_slots part. * ira-color.c (ira_sort_regnos_for_alter_reg): Add assertion to make sure not using lra. (ira_reuse_stack_slot): Likewise. (ira_mark_new_stack_slot): Likewise. From-SVN: r215286 --- gcc/ChangeLog | 10 ++++++++++ gcc/ira-color.c | 6 ++++++ gcc/ira.c | 21 ++++++++++----------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8d4f5ba1c37..86544e2e5d1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2014-09-16 Kito Cheng + + * ira.c (ira): Don't initialize ira_spilled_reg_stack_slots and + ira_spilled_reg_stack_slots_num if using lra. + (do_reload): Remove release ira_spilled_reg_stack_slots part. + * ira-color.c (ira_sort_regnos_for_alter_reg): Add assertion to + make sure not using lra. + (ira_reuse_stack_slot): Likewise. + (ira_mark_new_stack_slot): Likewise. + 2014-09-15 Andi Kleen * function.c (allocate_struct_function): Force diff --git a/gcc/ira-color.c b/gcc/ira-color.c index e2ea3596efc..6846567b78f 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -4067,6 +4067,8 @@ ira_sort_regnos_for_alter_reg (int *pseudo_regnos, int n, ira_allocno_iterator ai; ira_allocno_t *spilled_coalesced_allocnos; + ira_assert (! ira_use_lra_p); + /* Set up allocnos can be coalesced. */ coloring_allocno_bitmap = ira_allocate_bitmap (); for (i = 0; i < n; i++) @@ -4416,6 +4418,8 @@ ira_reuse_stack_slot (int regno, unsigned int inherent_size, bitmap_iterator bi; struct ira_spilled_reg_stack_slot *slot = NULL; + ira_assert (! ira_use_lra_p); + ira_assert (inherent_size == PSEUDO_REGNO_BYTES (regno) && inherent_size <= total_size && ALLOCNO_HARD_REGNO (allocno) < 0); @@ -4528,6 +4532,8 @@ ira_mark_new_stack_slot (rtx x, int regno, unsigned int total_size) int slot_num; ira_allocno_t allocno; + ira_assert (! ira_use_lra_p); + ira_assert (PSEUDO_REGNO_BYTES (regno) <= total_size); allocno = ira_regno_allocno_map[regno]; slot_num = -ALLOCNO_HARD_REGNO (allocno) - 2; diff --git a/gcc/ira.c b/gcc/ira.c index dc69a9c4307..f377f7da674 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5260,14 +5260,16 @@ ira (FILE *f) #ifdef ENABLE_IRA_CHECKING print_redundant_copies (); #endif - - ira_spilled_reg_stack_slots_num = 0; - ira_spilled_reg_stack_slots - = ((struct ira_spilled_reg_stack_slot *) - ira_allocate (max_regno - * sizeof (struct ira_spilled_reg_stack_slot))); - memset (ira_spilled_reg_stack_slots, 0, - max_regno * sizeof (struct ira_spilled_reg_stack_slot)); + if (! ira_use_lra_p) + { + ira_spilled_reg_stack_slots_num = 0; + ira_spilled_reg_stack_slots + = ((struct ira_spilled_reg_stack_slot *) + ira_allocate (max_regno + * sizeof (struct ira_spilled_reg_stack_slot))); + memset (ira_spilled_reg_stack_slots, 0, + max_regno * sizeof (struct ira_spilled_reg_stack_slot)); + } } allocate_initial_values (); @@ -5303,9 +5305,6 @@ do_reload (void) FOR_ALL_BB_FN (bb, cfun) bb->loop_father = NULL; current_loops = NULL; - - if (ira_conflicts_p) - ira_free (ira_spilled_reg_stack_slots); ira_destroy (); -- 2.30.2