Commit 411e138a by Richard Sandiford Committed by Richard Sandiford

i386.c: Include cselib.h.

gcc/
	* config/i386/i386.c: Include cselib.h.
	(ix86_pic_register_p): New function.
	(ix86_delegitimize_address): Use it to check for the PIC register.

From-SVN: r140611
parent a9e6fc5a
2008-09-23 Richard Sandiford <rdsandiford@googlemail.com> 2008-09-23 Richard Sandiford <rdsandiford@googlemail.com>
* config/i386/i386.c: Include cselib.h.
(ix86_pic_register_p): New function.
(ix86_delegitimize_address): Use it to check for the PIC register.
2008-09-23 Richard Sandiford <rdsandiford@googlemail.com>
* doc/tm.texi (FIND_BASE_TERM): Expand documentation. * doc/tm.texi (FIND_BASE_TERM): Expand documentation.
* config/i386/i386.c (ix86_find_base_term): Don't check for * config/i386/i386.c (ix86_find_base_term): Don't check for
SYMBOL_REF and LABEL_REF. SYMBOL_REF and LABEL_REF.
......
...@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see
#include "df.h" #include "df.h"
#include "tm-constrs.h" #include "tm-constrs.h"
#include "params.h" #include "params.h"
#include "cselib.h"
static int x86_builtin_vectorization_cost (bool); static int x86_builtin_vectorization_cost (bool);
static rtx legitimize_dllimport_symbol (rtx, bool); static rtx legitimize_dllimport_symbol (rtx, bool);
...@@ -9966,6 +9967,20 @@ i386_output_dwarf_dtprel (FILE *file, int size, rtx x) ...@@ -9966,6 +9967,20 @@ i386_output_dwarf_dtprel (FILE *file, int size, rtx x)
} }
} }
/* Return true if X is a representation of the PIC register. This copes
with calls from ix86_find_base_term, where the register might have
been replaced by a cselib value. */
static bool
ix86_pic_register_p (rtx x)
{
if (GET_CODE (x) == VALUE)
return (pic_offset_table_rtx
&& rtx_equal_for_cselib_p (x, pic_offset_table_rtx));
else
return REG_P (x) && REGNO (x) == PIC_OFFSET_TABLE_REGNUM;
}
/* In the name of slightly smaller debug output, and to cater to /* In the name of slightly smaller debug output, and to cater to
general assembler lossage, recognize PIC+GOTOFF and turn it back general assembler lossage, recognize PIC+GOTOFF and turn it back
into a direct symbol reference. into a direct symbol reference.
...@@ -10004,19 +10019,16 @@ ix86_delegitimize_address (rtx orig_x) ...@@ -10004,19 +10019,16 @@ ix86_delegitimize_address (rtx orig_x)
|| GET_CODE (XEXP (x, 1)) != CONST) || GET_CODE (XEXP (x, 1)) != CONST)
return orig_x; return orig_x;
if (REG_P (XEXP (x, 0)) if (ix86_pic_register_p (XEXP (x, 0)))
&& REGNO (XEXP (x, 0)) == PIC_OFFSET_TABLE_REGNUM)
/* %ebx + GOT/GOTOFF */ /* %ebx + GOT/GOTOFF */
; ;
else if (GET_CODE (XEXP (x, 0)) == PLUS) else if (GET_CODE (XEXP (x, 0)) == PLUS)
{ {
/* %ebx + %reg * scale + GOT/GOTOFF */ /* %ebx + %reg * scale + GOT/GOTOFF */
reg_addend = XEXP (x, 0); reg_addend = XEXP (x, 0);
if (REG_P (XEXP (reg_addend, 0)) if (ix86_pic_register_p (XEXP (reg_addend, 0)))
&& REGNO (XEXP (reg_addend, 0)) == PIC_OFFSET_TABLE_REGNUM)
reg_addend = XEXP (reg_addend, 1); reg_addend = XEXP (reg_addend, 1);
else if (REG_P (XEXP (reg_addend, 1)) else if (ix86_pic_register_p (XEXP (reg_addend, 1)))
&& REGNO (XEXP (reg_addend, 1)) == PIC_OFFSET_TABLE_REGNUM)
reg_addend = XEXP (reg_addend, 0); reg_addend = XEXP (reg_addend, 0);
else else
return orig_x; return orig_x;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment