aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2008-09-09 16:52:55 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2008-09-09 16:52:55 +0000
commit496071caa61c457f55f5d4667cac37e058627d36 (patch)
tree2998213a038cd9de815dbf3b6b46d6692b8023b8 /gcc
parent1f57487cf037ee3d06beab4b6dfc6a2dddb9a878 (diff)
downloadgcc-496071caa61c457f55f5d4667cac37e058627d36.zip
gcc-496071caa61c457f55f5d4667cac37e058627d36.tar.gz
gcc-496071caa61c457f55f5d4667cac37e058627d36.tar.bz2
ira-conflicts.c (process_regs_for_copy): Check that the hard regno is in the right range.
2008-09-09 Vladimir Makarov <vmakarov@redhat.com> * ira-conflicts.c (process_regs_for_copy): Check that the hard regno is in the right range. Add comments. From-SVN: r140159
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ira-conflicts.c16
2 files changed, 16 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 66b6584..cfa7b26 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-09 Vladimir Makarov <vmakarov@redhat.com>
+
+ * ira-conflicts.c (process_regs_for_copy): Check that the hard
+ regno is in the right range. Add comments.
+
2008-09-09 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* Makefile.in (mips-tfile.o-warn): Don't error out on mips-tfile.c
diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c
index 8b8c485..e467a7c 100644
--- a/gcc/ira-conflicts.c
+++ b/gcc/ira-conflicts.c
@@ -331,7 +331,7 @@ go_through_subreg (rtx x, int *offset)
static bool
process_regs_for_copy (rtx reg1, rtx reg2, rtx insn, int freq)
{
- int hard_regno, cost, index, offset1, offset2;
+ int allocno_preferenced_hard_regno, cost, index, offset1, offset2;
bool only_regs_p;
ira_allocno_t a;
enum reg_class rclass, cover_class;
@@ -342,16 +342,18 @@ process_regs_for_copy (rtx reg1, rtx reg2, rtx insn, int freq)
only_regs_p = REG_P (reg1) && REG_P (reg2);
reg1 = go_through_subreg (reg1, &offset1);
reg2 = go_through_subreg (reg2, &offset2);
+ /* Set up hard regno preferenced by allocno. If allocno gets the
+ hard regno the copy (or potential move) insn will be removed. */
if (HARD_REGISTER_P (reg1))
{
if (HARD_REGISTER_P (reg2))
return false;
- hard_regno = REGNO (reg1) + offset1 - offset2;
+ allocno_preferenced_hard_regno = REGNO (reg1) + offset1 - offset2;
a = ira_curr_regno_allocno_map[REGNO (reg2)];
}
else if (HARD_REGISTER_P (reg2))
{
- hard_regno = REGNO (reg2) + offset2 - offset1;
+ allocno_preferenced_hard_regno = REGNO (reg2) + offset2 - offset1;
a = ira_curr_regno_allocno_map[REGNO (reg1)];
}
else if (!CONFLICT_ALLOCNO_P (ira_curr_regno_allocno_map[REGNO (reg1)],
@@ -366,7 +368,10 @@ process_regs_for_copy (rtx reg1, rtx reg2, rtx insn, int freq)
}
else
return false;
- rclass = REGNO_REG_CLASS (hard_regno);
+ if (! IN_RANGE (allocno_preferenced_hard_regno, 0, FIRST_PSEUDO_REGISTER - 1))
+ /* Can not be tied. */
+ return false;
+ rclass = REGNO_REG_CLASS (allocno_preferenced_hard_regno);
mode = ALLOCNO_MODE (a);
cover_class = ALLOCNO_COVER_CLASS (a);
if (! ira_class_subset_p[rclass][cover_class])
@@ -375,8 +380,9 @@ process_regs_for_copy (rtx reg1, rtx reg2, rtx insn, int freq)
&& reg_class_size[rclass] <= (unsigned) CLASS_MAX_NREGS (rclass, mode))
/* It is already taken into account in ira-costs.c. */
return false;
- index = ira_class_hard_reg_index[cover_class][hard_regno];
+ index = ira_class_hard_reg_index[cover_class][allocno_preferenced_hard_regno];
if (index < 0)
+ /* Can not be tied. It is not in the cover class. */
return false;
if (HARD_REGISTER_P (reg1))
cost = ira_register_move_cost[mode][cover_class][rclass] * freq;