This is the mail archive of the
mailing list for the GCC project.
Re: Bug in egcs-1.1 (reduced testcase included)(PPC)
- To: David Edelsohn <dje at watson dot ibm dot com>
- Subject: Re: Bug in egcs-1.1 (reduced testcase included)(PPC)
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Sun, 16 Aug 1998 22:03:58 -0600
- cc: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>, egcs-patches at cygnus dot com, Michael Meissner <meissner at cygnus dot com>, Hartmut Koptein <koptein at et-inf dot fho-emden dot de>
- Reply-To: law at cygnus dot com
In message <9808161700.AA29462@marc.watson.ibm.com>you write:
> Instead of having a dedicated zero register like Mips,
> POWER/PowerPC treats r0 differently for some instructions. When used as a
> source operand, most of the time it refers to GPR 0 but sometimes means
> the constant 0. In the case of cal|addi|la used by elf_low (as well as
> cau|addis), r0 is interpreted as the constant 0.
> r0 actually could be used as the destination for elf_high; but,
> because it immediately would be fed into elf_low, that normally would
> require unnecessary shuffling to match elf_low's required constraints.
OK. So basically we're hosed because of the elf_low pattern. ie,
even if we fixed elf_high, we're going to have the same problem with
elf_low since the elf_high typically feeds directly into an elf_low.
> The real problem is reload choosing r0 to restore the symbol_ref.
> "b" are BASE registers to be used for address calculations. r0 is the
> only register that should not be used that way. Instead of all of this
> work to make r0 usable, is there any way to tell reload to avoid r0 for
> these types of fixups of symbol_refs?
Nope. No way I'm aware to directly prevent reload from using r0 for
this one specific case.
Basically reload realizes that it needs to load the value of the
symbol_ref into a register. It will select *any* hard register which
can hold SImode values for the reload register, including r0. There's
no way for the compiler to know that r0 is special at the time where
the reload register is selected.
We could define LIMIT_RELOAD_CLASS to return BASE_REGS when presented
with SImode and GENERAL_REGS as arguments. That would basically prevent
reload from ever using r0 for a SImode reload. I don't know the ppc
port well enough to guess if this might be a suitable solution.
The other approach is to define secondary reloads. To do that
accurately, we need to create the R0_REGS register class, then have
secondary_reload_class return BASE_REGS when presented with a load
of a symbol_ref into R0_REGS.