summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-28 23:28:56 +0000
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-28 23:28:56 +0000
commitbcfc04dbaf770966e62a7f0ed01286c511c6b32d (patch)
treeb327feacc699769b8c5ea296878a30467649e828 /gcc
parentcc91b414bddfd55cd273ff2a07316fbe0b51fe9c (diff)
downloadgcc-bcfc04dbaf770966e62a7f0ed01286c511c6b32d.tar.gz
* config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle
unspec plus offset. Tidy macho code. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173141 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/rs6000/rs6000.c15
2 files changed, 18 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 204cd0b2037..794c496a796 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-29 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle
+ unspec plus offset. Tidy macho code.
+
2011-04-29 Martin Jambor <mjambor@suse.cz>
* cgraphunit.c (cgraph_preserve_function_body_p): Accept a cgraph
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 41259630bf4..899699f8aa1 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -6380,7 +6380,16 @@ rs6000_delegitimize_address (rtx orig_x)
if (GET_CODE (x) == (TARGET_CMODEL != CMODEL_SMALL ? LO_SUM : PLUS)
&& GET_CODE (XEXP (x, 1)) == CONST)
{
+ rtx offset = NULL_RTX;
+
y = XEXP (XEXP (x, 1), 0);
+ if (GET_CODE (y) == PLUS
+ && GET_MODE (y) == Pmode
+ && CONST_INT_P (XEXP (y, 1)))
+ {
+ offset = XEXP (y, 1);
+ y = XEXP (y, 0);
+ }
if (GET_CODE (y) == UNSPEC
&& XINT (y, 1) == UNSPEC_TOCREL
&& ((GET_CODE (XEXP (x, 0)) == REG
@@ -6396,6 +6405,8 @@ rs6000_delegitimize_address (rtx orig_x)
XEXP (XEXP (XEXP (x, 0), 1), 0)))))
{
y = XVECEXP (y, 0, 0);
+ if (offset != NULL_RTX)
+ y = gen_rtx_PLUS (Pmode, y, offset);
if (!MEM_P (orig_x))
return y;
else
@@ -6405,9 +6416,9 @@ rs6000_delegitimize_address (rtx orig_x)
if (TARGET_MACHO
&& GET_CODE (orig_x) == LO_SUM
- && GET_CODE (XEXP (x, 1)) == CONST)
+ && GET_CODE (XEXP (orig_x, 1)) == CONST)
{
- y = XEXP (XEXP (x, 1), 0);
+ y = XEXP (XEXP (orig_x, 1), 0);
if (GET_CODE (y) == UNSPEC
&& XINT (y, 1) == UNSPEC_MACHOPIC_OFFSET)
return XVECEXP (y, 0, 0);