[fpc-devel] Made improvements for the "extra optimisation information" feature

J. Gareth Moreton gareth at moreton-family.com
Mon Dec 13 21:46:56 CET 2021


Hi everyone,

I made some updates and cleaned things up with the "extra optimisation 
feature" I started to experiment with a while ago. Well, I've managed to 
find a better showcase for the feature (although it might need 
refactoring to speed the compiler up): 
https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/74

Under x86_64, I use the feature to leave 'hints' for the compiler on 
"mov %reg32,%reg32" instructions when a search has determined that the 
source register has its upper 32 bits set to zero.  This permits 
optimisations where the full 64 bits of the destination register are 
used later on because it knows that replacing it with the source 
register won't leave the upper 32 bits undefined.  This has a cascade 
effect and can cause the MOV to be deleted completely.

https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/74

The compiler itself benefits from the feature a lot!  Excluding the 3 
files with source changes, 38 units in the RTL and compiler combined 
show improvements, and as a result, the net growth of the x86_64-win64 
compiler is only 2,048 bytes under -O4.

Gareth aka. Kit


-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the fpc-devel mailing list