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
This commit is contained in:
Alan Modra 2011-04-29 08:58:56 +09:30 committed by Alan Modra
parent 85ad2ef57f
commit 5d6358a57d
2 changed files with 18 additions and 2 deletions

View file

@ -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

View file

@ -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);