This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[4.4/m32c] workarounds for m32c builds
- From: DJ Delorie <dj at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 4 May 2009 19:53:33 -0400
- Subject: [4.4/m32c] workarounds for m32c builds
The need for these workarounds has been discussed previously. While
real solutions are in the works for these, it's unlikely they'll be
backported to 4.4 (and if so, these workarounds can be removed then).
So, to enable the 4.4 branch to build (libgcc+newlib), I'm applying
these workarounds. Testsuite results give results as good as before
the breakage.
* config/m32c/m32c.c (m32c_override_options): Disable -fivopts for
-mcpu=m32c until ivopts supports sizeof(ptr) != sizeof(size_t).
(m32c_legitimize_reload_address): Work around reload bug until
reload supports sizeof(ptr) != sizeof(size_t).
Index: config/m32c/m32c.c
===================================================================
--- config/m32c/m32c.c (revision 147111)
+++ config/m32c/m32c.c (working copy)
@@ -414,12 +414,15 @@ m32c_override_options (void)
{
if (target_memregs < 0 || target_memregs > 16)
error ("invalid target memregs value '%d'", target_memregs);
}
else
target_memregs = 16;
+
+ if (TARGET_A24)
+ flag_ivopts = 0;
}
/* Defining data structures for per-function information */
/* The usual; we set up our machine_function data. */
static struct machine_function *
@@ -2040,12 +2043,37 @@ m32c_legitimize_reload_address (rtx * x,
push_reload (XEXP (*x, 0), NULL_RTX, &XEXP (*x, 0), NULL,
A_REGS, Pmode, VOIDmode, 0, 0, opnum,
type);
return 1;
}
+ /* If we see an RTX like (subreg:PSI (reg:SI ...)) we need to reload
+ the subreg. We need to check for PLUS and non-PLUS cases. */
+
+ if (GET_CODE (*x) == SUBREG
+ && GET_MODE (XEXP (*x, 0)) == SImode)
+ {
+ if (type == RELOAD_OTHER)
+ type = RELOAD_FOR_OTHER_ADDRESS;
+ push_reload (*x, NULL_RTX, x, NULL,
+ A_REGS, Pmode, VOIDmode, 0, 0, opnum,
+ type);
+ return 1;
+ }
+ if (GET_CODE (*x) == PLUS
+ && GET_CODE (XEXP (*x, 0)) == SUBREG
+ && GET_MODE (XEXP (XEXP (*x, 0), 0)) == SImode)
+ {
+ if (type == RELOAD_OTHER)
+ type = RELOAD_FOR_OTHER_ADDRESS;
+ push_reload (XEXP (*x, 0), NULL_RTX, &(XEXP (*x, 0)), NULL,
+ A_REGS, Pmode, VOIDmode, 0, 0, opnum,
+ type);
+ return 1;
+ }
+
return 0;
}
/* Implements LEGITIMATE_CONSTANT_P. We split large constants anyway,
so we can allow anything. */
int