https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95674

--- Comment #5 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to rsand...@gcc.gnu.org from comment #4)
> (In reply to Vladimir Makarov from comment #3)
> > I looked at this problem.
> > 
> > All assignments are done in IRA (LRA does not change them).  We can not make
> > a better assignment because scratches do not permit to store any preferences
> > from instruction constraints (pseudo-registers permits to do this). So
> > storing and getting this info for scratches is the first step to solving the
> > problem.
> > 
> > LRA changes scratches to pseudo-registers to generate the correct code
> > satisfying the insn constraints and turn them back to scratches when the
> > corresponding pseudo-registers do not get hard registers.  Moving change of
> > scratches to pseudo-regs from LRA to IRA could help but it is a big work.
> Yeah, sounds useful!  Could it be done as a prepass before IRA proper?

Currently scratches are removed at the beginning of LRA and some of them (which
did not get hard registers) restored at the LRA end.  So to deal with the
scratches in IRA, they should be removed in IRA and some of them should be
restored at the end of LRA.

> (Maybe not -- haven't really thought about it much.)
> 
> > Another solution is to not use scratches in machine-descriptions and use
> > pseudo-registers instead.
> Although it would be possible to use pseudos instead, I'm not sure
> the end result would be better than what we have now:
> - Each pass would need to cope with recog creating new registers
> - We'd need some way of deferring the creation of pseudo registers
>   for successful but speculative recogs that might later be rejected
>   for cost reasons, or at least have some kind of recycling scheme.
> - Even then, we'll have more pseudos before RA, and so most of the
>   DF datastructures will be larger and perhaps sparser.

Yes, there are some disadvantages to removing scratches.  The biggest one is a
lot of work for target maintainers which are interested in better RA.

Of course it is better to solve this problem in one place.  So I'll investigate
removing scratches in IRA more.  May be it is not that big work.  Thank you for
expressing your opinion, Richard.

Reply via email to