This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: default_secondary_reload: class vs scratch_class


In http://gcc.gnu.org/ml/gcc/2006-05/msg00254.html, Ian Lance Taylor wrote:

That said, while it makes sense to me that SECONDARY_RELOAD_CLASS and
the reload_{in,out} instruction should be in synch--that was one of
the flaws of the old scheme, really--I can't think of anything that
would go wrong if class is a subset of scratch_class.

I'm afraid that this is a case that the old code allowed, but cannot be handled with default_secondary_reload.

In http://gcc.gnu.org/ml/gcc/2006-05/msg00247.html, DJ Delorie wrote:
SECONDARY_RELOAD_CLASS has the option of limiting the reload class.
The mn10300 has a generic SImode reload_in that allows GENERAL_REGS,
but SECONDARY_RELOAD_CLASS specifies a smaller class based on the
registers that need reloading.

The default hook for secondary_reload uses SECONDARY_RELOAD_CLASS but
assumes it's going to return the same class as the pattern (in which
case, why bother defining it?).

When SECONDARY_RELOAD_CLASS is not a subset of the scratch class, you'll get another reload.

Since we're only allowed one reload
pattern per mode, this seems like an artificial limitation.

The class for the temporary register is taken later from the constraint of the scratch register in the pattern, so if you relaxed the sanity check, you'd end up with a GENERAL_REGS reload instead of a DATA_OR_EXTENDED_REGS one. To fix this in generic code we'd have to make a copy of the pattern with a new icode and a patched constraint... Since no one else has complained yet, I think it will be easier to convert the affected ports.

In http://gcc.gnu.org/ml/gcc/2006-05/msg00257.html, DJ Delorie wrote:

In my case, I'm just trying to get the am33 port to function, because
I have some patches I need to test.  I don't currently have the
resources to do that kind of change, and there are a *lot* of ports
that still use the macros.

You you can't use the same class in the reload{in,out}<mode> patterns as in SECONDARY*(_RELOAD_CLASS, this indicates that the old way of doing things already had problems. I think you'll find that this is not generally the case for the ports that still use SECONDARY*_RELOAD_CLASS.

A quick-and-dirty way to do the conversion is to take all the reload
patterns with overloaded scratch register classes, and split them into
patterns for one SECONDARY_RELOAD_CLASS output each
Then you make a copy of default_secondary_reload_class and modify the
bit that sets icode to pick the appropriate pattern.





------------------------------------------------------------------------

* **


Re: default_secondary_reload: class vs scratch_class



You should run any patch past Joern, though.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]