aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2010-05-25 16:29:38 +0000
committerJeff Law <law@gcc.gnu.org>2010-05-25 10:29:38 -0600
commit4ac293e2393f779184f95ad18b17bb3df657fb0b (patch)
treeace36499c6ea271801246917f229ce0e4ae06195
parentbb9862c6d963a989e659b971a47a2f77d8f9677f (diff)
downloadgcc-4ac293e2393f779184f95ad18b17bb3df657fb0b.zip
gcc-4ac293e2393f779184f95ad18b17bb3df657fb0b.tar.gz
gcc-4ac293e2393f779184f95ad18b17bb3df657fb0b.tar.bz2
ira-build.c (update_conflict_hard_reg_costs): New.
* ira-build.c (update_conflict_hard_reg_costs): New. (ira_build): Call update_conflict_hard_reg_costs. From-SVN: r159830
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ira-build.c41
2 files changed, 45 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e109180..c52247a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-25 Vladimir Makarov <vmakarov@redhat.com>
+
+ * ira-build.c (update_conflict_hard_reg_costs): New.
+ (ira_build): Call update_conflict_hard_reg_costs.
+
2010-05-25 Jakub Jelinek <jakub@redhat.com>
PR debug/41371
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index c879efa..3bd98f6 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -1,5 +1,5 @@
/* Building internal representation for IRA.
- Copyright (C) 2006, 2007, 2008, 2009
+ Copyright (C) 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Vladimir Makarov <vmakarov@redhat.com>.
@@ -2757,6 +2757,44 @@ check_allocno_creation (void)
}
#endif
+/* Identify allocnos which prefer a register class with a single hard register.
+ Adjust ALLOCNO_CONFLICT_HARD_REG_COSTS so that conflicting allocnos are
+ less likely to use the preferred singleton register. */
+static void
+update_conflict_hard_reg_costs (void)
+{
+ ira_allocno_t a;
+ ira_allocno_iterator ai;
+ int i, index, min;
+
+ FOR_EACH_ALLOCNO (a, ai)
+ {
+ enum reg_class cover_class = ALLOCNO_COVER_CLASS (a);
+ enum reg_class pref = reg_preferred_class (ALLOCNO_REGNO (a));
+
+ if (reg_class_size[pref] != 1)
+ continue;
+ index = (ira_class_hard_reg_index[cover_class]
+ [ira_class_hard_regs[pref][0]]);
+ if (index < 0)
+ continue;
+ if (ALLOCNO_CONFLICT_HARD_REG_COSTS (a) == NULL
+ || ALLOCNO_HARD_REG_COSTS (a) == NULL)
+ continue;
+ min = INT_MAX;
+ for (i = ira_class_hard_regs_num[cover_class] - 1; i >= 0; i--)
+ if (ALLOCNO_HARD_REG_COSTS (a)[i] > ALLOCNO_COVER_CLASS_COST (a)
+ && min > ALLOCNO_HARD_REG_COSTS (a)[i])
+ min = ALLOCNO_HARD_REG_COSTS (a)[i];
+ if (min == INT_MAX)
+ continue;
+ ira_allocate_and_set_costs (&ALLOCNO_CONFLICT_HARD_REG_COSTS (a),
+ cover_class, 0);
+ ALLOCNO_CONFLICT_HARD_REG_COSTS (a)[index]
+ -= min - ALLOCNO_COVER_CLASS_COST (a);
+ }
+}
+
/* Create a internal representation (IR) for IRA (allocnos, copies,
loop tree nodes). If LOOPS_P is FALSE the nodes corresponding to
the loops (except the root which corresponds the all function) and
@@ -2796,6 +2834,7 @@ ira_build (bool loops_p)
sort_conflict_id_allocno_map ();
setup_min_max_conflict_allocno_ids ();
ira_build_conflicts ();
+ update_conflict_hard_reg_costs ();
if (! ira_conflicts_p)
{
ira_allocno_t a;