This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with reloading in a new backend...
Le vendredi 11 avril 2008 Ã 11:14 -0700, Jim Wilson a Ãcrit :
> Stelian Pop wrote:
> > #define PREFERRED_RELOAD_CLASS(X, CLASS) \
> > ((CONSTANT_P(X)) ? EIGHT_REGS : \
> > (MEM_P(X)) ? EVEN_REGS : CLASS)
> >
> > #define PREFERRED_OUTPUT_RELOAD_CLASS(X, CLASS) \
> > ((CONSTANT_P(X)) ? EIGHT_REGS : \
> > (MEM_P(X)) ? EVEN_REGS : CLASS)
>
> I think most of your trouble is here. Suppose we are trying to reload a
> constant into an even-reg. We call PREFERRED_RELOAD_CLASS, which says
> to use eight_regs instead, and you get a fatal_insn error because you
> didn't get the even-reg that the instruction needed.
>
> PREFERRED_RELOAD_CLASS must always return a class that is a strict
> subset of the class that was passed in.
>
> So define another register class which is the intersection of eight regs
> and even regs, and when we call PREFERRED_RELOAD_CLASS with a constant
> and even regs, then return the eight/even intersection class.
Ah thanks, this does indeed seem to solve a lot of problems I had !
> Likewise in all of the other cases you are trying to handle.
>
> Fix this problem, and you probably don't need most of the other changes
> you have made recently.
I will still have the problems with the fact that my indirect addressing
doesn't allow displacements, no ? (so I would need to implement
LEGITIMIZE_RELOAD_ADDRESS, in which I'll need a special reserved
register to compute the full address by adding the base and the
displacement). Or do you imply that I won't need this anymore ?
Thanks,
--
Stelian Pop <stelian@popies.net>