[Bug target/27117] [4.2 Regression] gcc fails to build on sh64-elf targets

amylaar at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Apr 12 13:46:00 GMT 2006



------- Comment #3 from amylaar at gcc dot gnu dot org  2006-04-12 13:46 -------
sh64 has indexed addressing, but the addition is always done as 64 bit,
and there are currently no implemenmtations that allow the 64 bit logical
address space to be re-mapped into a 32 physical address space - instead
they trap on any access to an address that does not fit into a 32 bit
address space.

This makes using indexed addressing with Pmode for -m5-32media (where Pmode
is SImode) unsafe, since some optimizations can fold additions into indexed
addressing and thus cause out-of-range addresses.  Therefore, INDEX_REG_CLASS
is NO_REGS for -m5-32media.

The division code produces an address with a DImode plus of two registers -
this is safe, since we exactly describe what the hardware does.
However, find_reloads_address_1 sees a plus and recurses with CONTEXT set to 1,
and then uses INDEX_REG_CLASS; it does not take into account that the mode
is not Pmode.

I think the best solution is to have an INDEX_REG_CLASS_FOR_MODE macro,
which defaults to INDEX_REG_CLASS.  Then this macro can be defined for the
SH to return GENERAL_REGS for DImode when compiling SHmedia code.

A kludgy solution would be to make reload reload the sum into a base register
(to cover the general case), and make the SH LEGITIMIZE_RELOAD_ADDRESS
recognize a sum with a non-pmode PLUS, and only reload pseudos inside into
GENERAL_REGS.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27117



More information about the Gcc-bugs mailing list