rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine.

* config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine.
	(rs6000_delegitimize_address): New function.

From-SVN: r156289
This commit is contained in:
Jakub Jelinek 2010-01-27 16:14:09 +01:00 committed by Jakub Jelinek
parent e8d8f497d1
commit 9a78eb7197
2 changed files with 42 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2010-01-27 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine.
(rs6000_delegitimize_address): New function.
* config/s390/s390.c (s390_delegitimize_address): Call
delegitimize_mem_from_attrs.

View File

@ -1059,6 +1059,7 @@ static rtx rs6000_legitimize_address (rtx, rtx, enum machine_mode);
static rtx rs6000_debug_legitimize_address (rtx, rtx, enum machine_mode);
static rtx rs6000_legitimize_tls_address (rtx, enum tls_model);
static void rs6000_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
static rtx rs6000_delegitimize_address (rtx);
static rtx rs6000_tls_get_addr (void);
static rtx rs6000_got_sym (void);
static int rs6000_tls_symbol_ref_1 (rtx *, void *);
@ -1326,6 +1327,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
#undef TARGET_CANNOT_FORCE_CONST_MEM
#define TARGET_CANNOT_FORCE_CONST_MEM rs6000_tls_referenced_p
#undef TARGET_DELEGITIMIZE_ADDRESS
#define TARGET_DELEGITIMIZE_ADDRESS rs6000_delegitimize_address
#undef TARGET_ASM_FUNCTION_PROLOGUE
#define TARGET_ASM_FUNCTION_PROLOGUE rs6000_output_function_prologue
#undef TARGET_ASM_FUNCTION_EPILOGUE
@ -5262,6 +5266,41 @@ rs6000_output_dwarf_dtprel (FILE *file, int size, rtx x)
fputs ("@dtprel+0x8000", file);
}
/* In the name of slightly smaller debug output, and to cater to
general assembler lossage, recognize various UNSPEC sequences
and turn them back into a direct symbol reference. */
static rtx
rs6000_delegitimize_address (rtx orig_x)
{
rtx x, y;
orig_x = delegitimize_mem_from_attrs (orig_x);
x = orig_x;
if (MEM_P (x))
x = XEXP (x, 0);
if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x, 1)) == CONST
&& GET_CODE (XEXP (x, 0)) == REG
&& REGNO (XEXP (x, 0)) == TOC_REGISTER)
{
y = XEXP (XEXP (x, 1), 0);
if (GET_CODE (y) == UNSPEC
&& XINT (y, 1) == UNSPEC_TOCREL)
{
y = XVECEXP (y, 0, 0);
if (!MEM_P (orig_x))
return y;
else
return replace_equiv_address_nv (orig_x, y);
}
return orig_x;
}
return orig_x;
}
/* Construct the SYMBOL_REF for the tls_get_addr function. */
static GTY(()) rtx rs6000_tls_symbol;