From 5d6358a57d44dbb7f07455124f463fcb8fab28fc Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 29 Apr 2011 08:58:56 +0930 Subject: [PATCH] rs6000.c (rs6000_delegitimize_address): Handle unspec plus offset. * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle unspec plus offset. Tidy macho code. From-SVN: r173141 --- gcc/ChangeLog | 5 +++++ gcc/config/rs6000/rs6000.c | 15 +++++++++++++-- 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 + + * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle + unspec plus offset. Tidy macho code. + 2011-04-29 Martin Jambor * 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); -- 2.30.2