This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: reload bugfix
- To: Bernd Schmidt <bernds at cygnus dot co dot uk>
- Subject: Re: reload bugfix
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 19 Aug 2000 17:44:04 -0300
- Cc: Jeffrey A Law <law at cygnus dot com>, gcc-patches at gcc dot gnu dot org, aldyh at cygnus dot com
- Organization: GCC Team, Red Hat
- References: <Pine.LNX.4.21.0008192104020.30816-100000@balti.cygnus.co.uk>
On Aug 19, 2000, Bernd Schmidt <bernds@cygnus.co.uk> wrote:
> [or we could install my monster patch which gets rid of all the
> RELOAD_FOR_foo cruft :-)]
I can't say I'd mind that. I've just spent a couple of hours fighting
another reload problem for SH.
Basically, I'm trying to fix a SH problem of loading SFmode constants
to pseudo registers that end up on the stack. GCC fails because it
needs r0 as a scratch register with earlyclobber, but reload assigns
the frame-pointer offset to r0 (which is the only index register too),
and it loses. An example:
(insn 23 21 24 (parallel[
(set (subreg:SF (reg/v:DI 87) 0)
(const_double:SF (cc0) 0 [0x0] 0 [0x0] [0]))
(use (reg/v:PSI 48 fpscr))
(clobber (scratch:SI))
] ) 91 {movsf_ie} (nil)
(expr_list:REG_UNUSED (scratch:SI)
(nil)))
reload replaces the subreg with
(mem:SF (plus:SI (reg:SI 14) (const_int 48))), then replaces
(const_int 48) with (reg:SI r0).
But then, when it gets to the scratch register, it needs r0 too,
because the constraint is `&z', and reload aborts.
Ok, so I introduced a new variant, that accepts a mem as the SET_DEST,
a floating-point constant as SET_SRC and any register `&r' as scratch,
then defined a split that copies SET_SRC to the scratch register, then
stores the scratch register in SET_DEST.
But GCC still insisted in allocating both the FP offset and the
scratch register to r0. I seem to have just found a solution. First,
I had to disable the optimization in find_reloads() that used
RELOAD_FOR_INSN for scratch earlyclobber registers that are noted as
unused. Then, I had to add test reload_reg_used_in_op_addr_reload in
reload_reg_free_p(), for a RELOAD_OTHER reload type.
Does this make sense for you?
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me