[fpc-devel] AArch64 Register efficiency

J. Gareth Moreton gareth at moreton-family.com
Thu Aug 20 19:42:28 CEST 2020

On Thu 20/08/20 15:36 , Florian Klämpfl via fpc-develfpc-devel at lists.freepascal.org sent:
> Am 20.08.20 um 15:09 schrieb J. Gareth Moreton:
> > Oh dear, that's a shame.  Havoc sounds fun
> though!  Part of me wants to try anyway because I'm masochistic like that,
> but I'll do that privately.
> > 
> > As an example, here's something from the classes
> unit - see how many references there are to [sp, #16]. 
> This is not a matter of non-available registers but of the fact that 
> self in a constructor must be always stored in memory else it couldn't 
> be accessed properly in case of an exception. The proper approach to 
> overcome this is imo to do this at the node level:
> - find variables which are read a lot but non-regable
> - replace read access by a regable tempref which is loaded before the reads

Ah yes, I can see how that can be a problem.  I can only see it being truly robust for leaf functions that don't deal with objects at all, e.g. parts of the RTL, but that won't work properly if all you have to go by 
are the .ppu files, which probably won't have that information available.  I'm still curious if it can be done, but I'll stick with conventional optimisation for now, if I can submit a patch that isn't full of bugs 
for once!

Gareth aka. Kit

More information about the fpc-devel mailing list