[fpc-devel] Peephole Optimizer suggestions
    J. Gareth Moreton 
    gareth at moreton-family.com
       
    Tue Jul 21 10:00:10 CEST 2020
    
    
  
So I'm now running the full test suite, including "make fullcycle" for 
my refactoring of instruction removal (replacing most references of 
"asml.remove(hp1); hp1.free;" etc. with "RemoveInstruction(hp1);".  
Trying to get the optimiser to run before assigning real registers to 
the instructions is actually somewhat difficult.  Besides having to 
avoid certain optimisations like CMOV that don't allow writing to the 
stack (although this is under pass 2, which helps), removal of 
instructions can sometimes result in danglong pointers for the 
"livestart" and "liveend" fields for the register tracking.
I'll submit the 'removal refactor' patch once everything has passed, 
this helps reduce maintenance and avoids dangling pointers (i.e. 
forgetting to call "asml.remove" before freeing an instruction), but 
running pass 1 of the peephole optimizer before assigning registers is 
still very much experimental and may be too complicated.  I'll also have 
to look at the effects on compiler speed and the quality of the binaries 
produced to see if it's truly worthwhile.
Gareth aka. Kit
    
    
More information about the fpc-devel
mailing list