This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta] don't validate caller-save slot addresses in debug insns
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 03 Jan 2008 04:04:38 -0200
- Subject: [vta] don't validate caller-save slot addresses in debug insns
We don't need (or want) legitimized addresses in debug insns, and we
don't want replacements to fail just because the addresses are not
legitimate. IIRC this fixed target lib compiler crashes on both ppc64
and ia64 (I'm sure it was more than one problem, but I'm not sure
about the affected targets).
I'm checking it in the vta branch.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* caller-save.c (replace_reg_with_saved_mem): Don't validate
addresses.
Index: gcc/caller-save.c
===================================================================
--- gcc/caller-save.c.orig 2007-11-23 18:05:53.000000000 -0200
+++ gcc/caller-save.c 2007-12-30 20:47:05.000000000 -0200
@@ -700,10 +700,25 @@ replace_reg_with_saved_mem (rtx *loc,
mem = copy_rtx (regno_save_mem[regno][nregs]);
if (nregs == (unsigned int) hard_regno_nregs[regno][save_mode[regno]])
- mem = adjust_address (mem, save_mode[regno], 0);
+ mem = adjust_address_nv (mem, save_mode[regno], 0);
if (GET_MODE (mem) != mode)
- mem = rtl_hooks.gen_lowpart_no_emit (mode, mem);
+ {
+ /* This is gen_lowpart_if_possible(), but without validating
+ the newly-formed address. */
+ int offset = 0;
+
+ if (WORDS_BIG_ENDIAN)
+ offset = (MAX (GET_MODE_SIZE (GET_MODE (mem)), UNITS_PER_WORD)
+ - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
+ if (BYTES_BIG_ENDIAN)
+ /* Adjust the address so that the address-after-the-data is
+ unchanged. */
+ offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode))
+ - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (mem))));
+
+ mem = adjust_address_nv (mem, mode, offset);
+ }
}
else
{
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}