summaryrefslogtreecommitdiff
path: root/gcc/ira.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-28 22:19:22 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-28 22:19:22 +0000
commit732f3fd856cc1c94fc0f28b75f08d7b5fadc27dc (patch)
tree9dc1cb58dbd6084f4583c0e45cae66cdd60ca456 /gcc/ira.c
parent0570b029190acc7fbffc0930534f6320660229b3 (diff)
downloadgcc-732f3fd856cc1c94fc0f28b75f08d7b5fadc27dc.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160001 138bc75d-0d04-0410-961f-82ee72b054a4
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 10be6da4054..84d7bc1643b 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;