summaryrefslogtreecommitdiff
path: root/gcc/ira-costs.c
diff options
context:
space:
mode:
authorvmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-27 16:24:19 +0000
committervmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-27 16:24:19 +0000
commit1e204c7444fe8a80a1183349ccf75766c144d626 (patch)
tree1730ad833e4ff685d5139cd97e10380194193470 /gcc/ira-costs.c
parente3fe8cc4a45fc1741723768cc784138d89ccf698 (diff)
downloadgcc-1e204c7444fe8a80a1183349ccf75766c144d626.tar.gz
2008-10-27 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/37813 * ira-conflicts.c (process_regs_for_copy): Remove class subset check. * ira-int.h (ira_hard_regno_cover_class): New. * ira-lives.c (mark_reg_live, mark_reg_dead, process_bb_node_lives): Use ira_hard_regno_cover_class. * ira.c (reg_class ira_hard_regno_cover_class): New global variable. (setup_hard_regno_cover_class): New function. (ira_init): Call setup_hard_regno_cover_class. * ira-costs.c (cost_class_nums): Add comment. (find_allocno_class_costs): Initiate cost_class_nums. (setup_allocno_cover_class_and_costs): Check cost_class_nums. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141384 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira-costs.c')
-rw-r--r--gcc/ira-costs.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 64b2e7995d6..82adf5dccb8 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -86,7 +86,7 @@ static enum reg_class *cost_classes;
static int cost_classes_num;
/* Map: cost class -> order number (they start with 0) of the cost
- class. */
+ class. The order number is negative for non-cost classes. */
static int cost_class_nums[N_REG_CLASSES];
/* It is the current size of struct costs. */
@@ -1112,6 +1112,8 @@ find_allocno_class_costs (void)
/* We could use only cover classes. Unfortunately it does not
work well for some targets where some subclass of cover class
is costly and wrong cover class is chosen. */
+ for (i = 0; i < N_REG_CLASSES; i++)
+ cost_class_nums[i] = -1;
for (cost_classes_num = 0;
cost_classes_num < ira_important_classes_num;
cost_classes_num++)
@@ -1392,7 +1394,7 @@ process_bb_node_for_hard_reg_moves (ira_loop_tree_node_t loop_tree_node)
static void
setup_allocno_cover_class_and_costs (void)
{
- int i, j, n, regno;
+ int i, j, n, regno, num;
int *reg_costs;
enum reg_class cover_class, rclass;
enum machine_mode mode;
@@ -1411,9 +1413,10 @@ setup_allocno_cover_class_and_costs (void)
if (cover_class == NO_REGS)
continue;
ALLOCNO_AVAILABLE_REGS_NUM (a) = ira_available_class_regs[cover_class];
+ num = cost_class_nums[allocno_pref[i]];
+ ira_assert (num >= 0);
ALLOCNO_COVER_CLASS_COST (a)
- = (COSTS_OF_ALLOCNO (allocno_costs, i)
- ->cost[cost_class_nums[allocno_pref[i]]]);
+ = COSTS_OF_ALLOCNO (allocno_costs, i)->cost[num];
if (optimize && ALLOCNO_COVER_CLASS (a) != allocno_pref[i])
{
n = ira_class_hard_regs_num[cover_class];
@@ -1423,8 +1426,16 @@ setup_allocno_cover_class_and_costs (void)
{
regno = ira_class_hard_regs[cover_class][j];
rclass = REGNO_REG_CLASS (regno);
- reg_costs[j] = (COSTS_OF_ALLOCNO (allocno_costs, i)
- ->cost[cost_class_nums[rclass]]);
+ num = cost_class_nums[rclass];
+ if (num < 0)
+ {
+ /* The hard register class is not a cover class or a
+ class not fully inside in a cover class -- use
+ the allocno cover class. */
+ ira_assert (ira_hard_regno_cover_class[regno] == cover_class);
+ num = cost_class_nums[cover_class];
+ }
+ reg_costs[j] = COSTS_OF_ALLOCNO (allocno_costs, i)->cost[num];
}
}
}