[fpc-devel] ARM/AARCH64 work

J. Gareth Moreton gareth at moreton-family.com
Wed Aug 5 18:33:03 CEST 2020

Hi everyone,

So I have been asked to do some work in improving optimisation for AARCH64, and ARM by logical 
extension since some parts are shared.  I've had a look around the code for the Peephole Optimizer 
for these platforms, and while I've found some potential improvements to generated code, my first 
desire is to break up the monolithic optimisation functions (e.g. "PeepHoleOptPass1Cpu"), since some 
of them are well over 1,000 lines long and incredibly unwieldy.  

The plan for this is simple... each opcode or set of similar opcodes will get its own function 
similar to how it is done on x86 platforms (e.g. "OptPass1STR" for STR optimisations).  This will 
make the code much more compartmentalised and easier to maintain.  There are some exceptions to this 
rule but I'm managing them easily enough.

Additionally, at a later stage, I want each platform to be able to share the DebugMsg method and the 
SPeepholeOptimization string, since currently a lot of platforms redeclare DebugMsg but without 
actually changing anything in the implementation.

Obviously I'll submit the changes as patches so they can be properly reviewed and tested, but does 
this sound like a good idea?

Gareth aka. Kit

P.S. While I haven't been asked to improve aarch64-linux specifically, if I'm understanding things 
correctly, there should be very few differences with the actual target platform in regards to 
calling conventions, for example.

More information about the fpc-devel mailing list