This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] S/390: Don't legitimize addresses like <tls symbol> + x
- From: Andreas Krebbel <krebbel1 at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: uweigand at de dot ibm dot com, anunez at de dot ibm dot com
- Date: Fri, 17 Feb 2006 14:40:10 +0100
- Subject: [PATCH] S/390: Don't legitimize addresses like <tls symbol> + x
Hello,
our legitimize_address back end function breaks addresses
which are PLUS rtxs of a tls symbol ref and something else
by passing them to legitimize_pic_address.
The attached patch fixes this.
I've bootstrapped the patch on s390 and s390x.
No testsuite regressions.
OK for mainline?
Bye,
-Andreas-
2006-02-17 Angel Nunez Mencias <anunez@de.ibm.com>
* gcc/config/s390/s390.c (legitimize_pic_address): Assertions checking
for non tls symbols added.
(legitimize_address): Do nothing for PLUS expressions if one of the
addends is a tls symbol reference.
Index: gcc/config/s390/s390.c
===================================================================
*** gcc/config/s390/s390.c.orig 2006-02-08 08:57:10.000000000 +0100
--- gcc/config/s390/s390.c 2006-02-17 09:44:54.000000000 +0100
*************** legitimize_pic_address (rtx orig, rtx re
*** 2821,2826 ****
--- 2821,2828 ----
rtx new = orig;
rtx base;
+ gcc_assert (!TLS_SYMBOLIC_CONST (addr));
+
if (GET_CODE (addr) == LABEL_REF
|| (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (addr)))
{
*************** legitimize_pic_address (rtx orig, rtx re
*** 2973,2978 ****
--- 2975,2984 ----
if (GET_CODE (addr) == PLUS)
{
rtx op0 = XEXP (addr, 0), op1 = XEXP (addr, 1);
+
+ gcc_assert (!TLS_SYMBOLIC_CONST (op0));
+ gcc_assert (!TLS_SYMBOLIC_CONST (op1));
+
/* Check first to see if this is a constant offset
from a local symbol reference. */
if ((GET_CODE (op0) == LABEL_REF
*************** legitimize_address (rtx x, rtx oldx ATTR
*** 3345,3350 ****
--- 3351,3362 ----
if (legitimate_address_p (mode, x, FALSE))
return x;
}
+ else if (GET_CODE (x) == PLUS
+ && (TLS_SYMBOLIC_CONST (XEXP (x, 0))
+ || TLS_SYMBOLIC_CONST (XEXP (x, 1))))
+ {
+ return x;
+ }
else if (flag_pic)
{
if (SYMBOLIC_CONST (x)