This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [power7-meissner] Fix spec2006 calculix build error; Move more -mdebug=addr support to separate functions
- From: Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 30 May 2009 01:14:18 -0400
- Subject: Re: [power7-meissner] Fix spec2006 calculix build error; Move more -mdebug=addr support to separate functions
- References: <20090529232132.GA13600@hungry-tiger.westford.ibm.com>
I forgot to allow using the virtual stack/frame pointers with offsets on types
that only allow reg+reg addressing. When the virtual stack/frame pointer is
converted to the normal stack/frame pointer, the offset will be moved to a
register.
2009-05-30 Michael Meissner <meissner@linux.vnet.ibm.com>
* config/rs6000/rs6000.c (virtual_stack_registers_memory_p): New
function, return true if this is memory pointed to by the virtual
stack registers before the stack has been instantiated.
(rs6000_legitimate_offset_address_p): If a mode doesn't allow
reg+offset addressing, still allow references to the virtual stack
pointers, which will be fixed up later.
(rs6000_legitimate_offset_address_p): Ditto.
(rs6000_legitimize_address): Ditto.
(rs6000_legitimate_address_p): Ditto.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 147990)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -806,6 +806,7 @@ static unsigned rs6000_hash_constant (rt
static unsigned toc_hash_function (const void *);
static int toc_hash_eq (const void *, const void *);
static bool reg_offset_addressing_ok_p (enum machine_mode);
+static bool virtual_stack_registers_memory_p (rtx);
static bool constant_pool_expr_p (rtx);
static bool legitimate_small_data_p (enum machine_mode, rtx);
static bool legitimate_lo_sum_address_p (enum machine_mode, rtx, int);
@@ -4384,6 +4385,26 @@ reg_offset_addressing_ok_p (enum machine
}
static bool
+virtual_stack_registers_memory_p (rtx op)
+{
+ int regnum;
+
+ if (GET_CODE (op) == REG)
+ regnum = REGNO (op);
+
+ else if (GET_CODE (op) == PLUS
+ && GET_CODE (XEXP (op, 0)) == REG
+ && GET_CODE (XEXP (op, 1)) == CONST_INT)
+ regnum = REGNO (XEXP (op, 0));
+
+ else
+ return false;
+
+ return (regnum >= FIRST_VIRTUAL_REGISTER
+ && regnum <= LAST_VIRTUAL_REGISTER);
+}
+
+static bool
constant_pool_expr_p (rtx op)
{
rtx base, offset;
@@ -4441,13 +4462,11 @@ rs6000_legitimate_offset_address_p (enum
if (!INT_REG_OK_FOR_BASE_P (XEXP (x, 0), strict))
return false;
if (!reg_offset_addressing_ok_p (mode))
- return false;
+ return virtual_stack_registers_memory_p (x);
if (legitimate_constant_pool_address_p (x))
return true;
if (GET_CODE (XEXP (x, 1)) != CONST_INT)
return false;
- if (!reg_offset_addressing_ok_p (mode))
- return false;
offset = INTVAL (XEXP (x, 1));
extra = 0;
@@ -4631,6 +4650,9 @@ rs6000_legitimize_address (rtx x, rtx ol
{
if (!reg_offset_addressing_ok_p (mode))
{
+ if (virtual_stack_registers_memory_p (x))
+ return x;
+
/* In theory we should not be seeing addresses of the form reg+0,
but just in case it is generated, optimize it away. */
if (GET_CODE (x) == PLUS && XEXP (x, 1) == const0_rtx)
@@ -5336,6 +5358,8 @@ rs6000_legitimate_address_p (enum machin
&& TARGET_UPDATE
&& legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict))
return 1;
+ if (virtual_stack_registers_memory_p (x))
+ return 1;
if (reg_offset_p && legitimate_small_data_p (mode, x))
return 1;
if (reg_offset_p && legitimate_constant_pool_address_p (x))
--
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com