aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPat Haugen <pthaugen@us.ibm.com>2007-09-06 13:51:21 +0000
committerPat Haugen <pthaugen@gcc.gnu.org>2007-09-06 13:51:21 +0000
commitbd379f7328b2ff3b17f5845dbe49796f97a79c25 (patch)
tree620790cc14778ca43ae1261ccbee1a3cae2f9cfd
parent200809cbbf0d8e99ce059e82494b8bd3a5c16ca9 (diff)
downloadgcc-bd379f7328b2ff3b17f5845dbe49796f97a79c25.zip
gcc-bd379f7328b2ff3b17f5845dbe49796f97a79c25.tar.gz
gcc-bd379f7328b2ff3b17f5845dbe49796f97a79c25.tar.bz2
reload.c (find_reloads_address_1): Try to preserve original base/index regclass of operands.
ChangeLog: 2007-09-06 Pat Haugen <pthaugen@us.ibm.com> * reload.c (find_reloads_address_1): Try to preserve original base/index regclass of operands. * regrename.c (scan_rtx_address): Likewise. (replace_oldest_value_addr): Likewise. From-SVN: r128183
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/regrename.c34
-rw-r--r--gcc/reload.c20
3 files changed, 33 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 39caec6..87a3763 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-06 Pat Haugen <pthaugen@us.ibm.com>
+
+ * reload.c (find_reloads_address_1): Try to preserve original
+ base/index regclass of operands.
+ * regrename.c (scan_rtx_address): Likewise.
+ (replace_oldest_value_addr): Likewise.
+
2007-09-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/33302
diff --git a/gcc/regrename.c b/gcc/regrename.c
index a15d675..74112c3 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -559,20 +559,19 @@ scan_rtx_address (rtx insn, rtx *loc, enum reg_class cl,
int index_op;
unsigned regno0 = REGNO (op0), regno1 = REGNO (op1);
- if (REGNO_OK_FOR_INDEX_P (regno0)
- && regno_ok_for_base_p (regno1, mode, PLUS, REG))
+ if (REGNO_OK_FOR_INDEX_P (regno1)
+ && regno_ok_for_base_p (regno0, mode, PLUS, REG))
+ index_op = 1;
+ else if (REGNO_OK_FOR_INDEX_P (regno0)
+ && regno_ok_for_base_p (regno1, mode, PLUS, REG))
index_op = 0;
- else if (REGNO_OK_FOR_INDEX_P (regno1)
- && regno_ok_for_base_p (regno0, mode, PLUS, REG))
+ else if (regno_ok_for_base_p (regno0, mode, PLUS, REG)
+ || REGNO_OK_FOR_INDEX_P (regno1))
index_op = 1;
else if (regno_ok_for_base_p (regno1, mode, PLUS, REG))
index_op = 0;
- else if (regno_ok_for_base_p (regno0, mode, PLUS, REG))
- index_op = 1;
- else if (REGNO_OK_FOR_INDEX_P (regno1))
- index_op = 1;
else
- index_op = 0;
+ index_op = 1;
locI = &XEXP (x, index_op);
locB = &XEXP (x, !index_op);
@@ -1476,20 +1475,19 @@ replace_oldest_value_addr (rtx *loc, enum reg_class cl,
int index_op;
unsigned regno0 = REGNO (op0), regno1 = REGNO (op1);
- if (REGNO_OK_FOR_INDEX_P (regno0)
- && regno_ok_for_base_p (regno1, mode, PLUS, REG))
+ if (REGNO_OK_FOR_INDEX_P (regno1)
+ && regno_ok_for_base_p (regno0, mode, PLUS, REG))
+ index_op = 1;
+ else if (REGNO_OK_FOR_INDEX_P (regno0)
+ && regno_ok_for_base_p (regno1, mode, PLUS, REG))
index_op = 0;
- else if (REGNO_OK_FOR_INDEX_P (regno1)
- && regno_ok_for_base_p (regno0, mode, PLUS, REG))
+ else if (regno_ok_for_base_p (regno0, mode, PLUS, REG)
+ || REGNO_OK_FOR_INDEX_P (regno1))
index_op = 1;
else if (regno_ok_for_base_p (regno1, mode, PLUS, REG))
index_op = 0;
- else if (regno_ok_for_base_p (regno0, mode, PLUS, REG))
- index_op = 1;
- else if (REGNO_OK_FOR_INDEX_P (regno1))
- index_op = 1;
else
- index_op = 0;
+ index_op = 1;
locI = &XEXP (x, index_op);
locB = &XEXP (x, !index_op);
diff --git a/gcc/reload.c b/gcc/reload.c
index 60e36ffc..6eb3802 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -5464,16 +5464,12 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
else if (code0 == REG && code1 == REG)
{
- if (REGNO_OK_FOR_INDEX_P (REGNO (op0))
- && regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG))
+ if (REGNO_OK_FOR_INDEX_P (REGNO (op1))
+ && regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG))
return 0;
- else if (REGNO_OK_FOR_INDEX_P (REGNO (op1))
- && regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG))
+ else if (REGNO_OK_FOR_INDEX_P (REGNO (op0))
+ && regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG))
return 0;
- else if (regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG))
- find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH,
- &XEXP (x, 0), opnum, type, ind_levels,
- insn);
else if (regno_ok_for_base_p (REGNO (op0), mode, PLUS, REG))
find_reloads_address_1 (mode, orig_op1, 1, PLUS, SCRATCH,
&XEXP (x, 1), opnum, type, ind_levels,
@@ -5482,16 +5478,20 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
find_reloads_address_1 (mode, orig_op0, 0, PLUS, REG,
&XEXP (x, 0), opnum, type, ind_levels,
insn);
+ else if (regno_ok_for_base_p (REGNO (op1), mode, PLUS, REG))
+ find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH,
+ &XEXP (x, 0), opnum, type, ind_levels,
+ insn);
else if (REGNO_OK_FOR_INDEX_P (REGNO (op0)))
find_reloads_address_1 (mode, orig_op1, 0, PLUS, REG,
&XEXP (x, 1), opnum, type, ind_levels,
insn);
else
{
- find_reloads_address_1 (mode, orig_op0, 1, PLUS, SCRATCH,
+ find_reloads_address_1 (mode, orig_op0, 0, PLUS, REG,
&XEXP (x, 0), opnum, type, ind_levels,
insn);
- find_reloads_address_1 (mode, orig_op1, 0, PLUS, REG,
+ find_reloads_address_1 (mode, orig_op1, 1, PLUS, SCRATCH,
&XEXP (x, 1), opnum, type, ind_levels,
insn);
}