summaryrefslogtreecommitdiff
path: root/gcc/ira-costs.c
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2011-08-18 17:06:18 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2011-08-18 17:06:18 +0000
commit6277a71071d0af461e0016cee626fa37c01f8e02 (patch)
treeb2e4b129a021cf7a5a10736f3b3c9c543ea3b7f4 /gcc/ira-costs.c
parent079a5ca908d071303b0133eb93d2a7db5ff55330 (diff)
downloadgcc-6277a71071d0af461e0016cee626fa37c01f8e02.tar.gz
re PR rtl-optimization/49890 (IRA spill with plenty of available registers)
2011-08-18 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/49890 * ira-costs.c (setup_regno_cost_classes_by_aclass): Don't exclude subclasses of class which is superset of a pressure class. From-SVN: r177874
Diffstat (limited to 'gcc/ira-costs.c')
-rw-r--r--gcc/ira-costs.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 12d3ed67fa7..dc983fd3a70 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -232,20 +232,42 @@ setup_regno_cost_classes_by_aclass (int regno, enum reg_class aclass)
int i;
PTR *slot;
HARD_REG_SET temp, temp2;
+ bool exclude_p;
if ((classes_ptr = cost_classes_aclass_cache[aclass]) == NULL)
{
COPY_HARD_REG_SET (temp, reg_class_contents[aclass]);
AND_COMPL_HARD_REG_SET (temp, ira_no_alloc_regs);
+ /* We exclude classes from consideration which are subsets of
+ ACLASS only if ACLASS is a pressure class or subset of a
+ pressure class. It means by the definition of pressure classes
+ that cost of moving between susbets of ACLASS is cheaper than
+ load or store. */
+ for (i = 0; i < ira_pressure_classes_num; i++)
+ {
+ cl = ira_pressure_classes[i];
+ if (cl == aclass)
+ break;
+ COPY_HARD_REG_SET (temp2, reg_class_contents[cl]);
+ AND_COMPL_HARD_REG_SET (temp2, ira_no_alloc_regs);
+ if (hard_reg_set_subset_p (temp, temp2))
+ break;
+ }
+ exclude_p = i < ira_pressure_classes_num;
classes.num = 0;
for (i = 0; i < ira_important_classes_num; i++)
{
cl = ira_important_classes[i];
- COPY_HARD_REG_SET (temp2, reg_class_contents[cl]);
- AND_COMPL_HARD_REG_SET (temp2, ira_no_alloc_regs);
- if (! ira_reg_pressure_class_p[cl]
- && hard_reg_set_subset_p (temp2, temp) && cl != aclass)
- continue;
+ if (exclude_p)
+ {
+ /* Exclude no-pressure classes which are subsets of
+ ACLASS. */
+ COPY_HARD_REG_SET (temp2, reg_class_contents[cl]);
+ AND_COMPL_HARD_REG_SET (temp2, ira_no_alloc_regs);
+ if (! ira_reg_pressure_class_p[cl]
+ && hard_reg_set_subset_p (temp2, temp) && cl != aclass)
+ continue;
+ }
classes.classes[classes.num++] = cl;
}
slot = htab_find_slot (cost_classes_htab, &classes, INSERT);