aboutsummaryrefslogtreecommitdiff
path: root/gcc/ira.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2010-05-28 16:19:22 -0600
committerJeff Law <law@gcc.gnu.org>2010-05-28 16:19:22 -0600
commit0896cc668adddc0be62f009679e1e7236ecec0e6 (patch)
tree9dc1cb58dbd6084f4583c0e45cae66cdd60ca456 /gcc/ira.c
parentbdf0eb066733a11e3d1aa6fc34d3c8724b743247 (diff)
downloadgcc-0896cc668adddc0be62f009679e1e7236ecec0e6.zip
gcc-0896cc668adddc0be62f009679e1e7236ecec0e6.tar.gz
gcc-0896cc668adddc0be62f009679e1e7236ecec0e6.tar.bz2
ira.c (ira_bad_reload_regno, [...]): New functions.
* ira.c (ira_bad_reload_regno, ira_build_reload_regno_1): New functions. * ira.h (ira_bad_reload_regno): Declare * reload1.c (allocate_reload_reg): Use ira_bad_reload_regno. From-SVN: r160001
Diffstat (limited to 'gcc/ira.c')
-rw-r--r--gcc/ira.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/ira.c b/gcc/ira.c
index 10be6da..84d7bc1 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1374,6 +1374,46 @@ setup_prohibited_mode_move_regs (void)
+/* Return nonzero if REGNO is a particularly bad choice for reloading X. */
+static bool
+ira_bad_reload_regno_1 (int regno, rtx x)
+{
+ int x_regno;
+ ira_allocno_t a;
+ enum reg_class pref;
+
+ /* We only deal with pseudo regs. */
+ if (! x || GET_CODE (x) != REG)
+ return false;
+
+ x_regno = REGNO (x);
+ if (x_regno < FIRST_PSEUDO_REGISTER)
+ return false;
+
+ /* If the pseudo prefers REGNO explicitly, then do not consider
+ REGNO a bad spill choice. */
+ pref = reg_preferred_class (x_regno);
+ if (reg_class_size[pref] == 1)
+ return !TEST_HARD_REG_BIT (reg_class_contents[pref], regno);
+
+ /* If the pseudo conflicts with REGNO, then we consider REGNO a
+ poor choice for a reload regno. */
+ a = ira_regno_allocno_map[x_regno];
+ if (TEST_HARD_REG_BIT (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a), regno))
+ return true;
+
+ return false;
+}
+
+/* Return nonzero if REGNO is a particularly bad choice for reloading
+ IN or OUT. */
+bool
+ira_bad_reload_regno (int regno, rtx in, rtx out)
+{
+ return (ira_bad_reload_regno_1 (regno, in)
+ || ira_bad_reload_regno_1 (regno, out));
+}
+
/* Function specific hard registers that can not be used for the
register allocation. */
HARD_REG_SET ira_no_alloc_regs;