New extra optimisation information feature and showcase
This merge request adds a new feature to the peephole optimizer that allows extra information to be attached to tai objects via a linked list that can be recalled for later use. This will allow the peephole optimizer to leave 'notes' and the like for later use, potentially allowing for much deeper optimisations.
The showcase is adding a reference to the destination label for jumps when the label is not present in the lookup table because it was added as part of an earlier peephole optimisation, using an extra optimisation information object that allows a reference to another tai object.
To accommodate this showcase, some references to "getlabelwithsym" have been replaced with a new method named "GetDestinationLabel", which takes a taicpu object and, if it's a jump to a label, returns the tai_label representing that label. It first simply calls "getlabelwithsym" after acquiring the label symbol, but if it returns nil, it then attempts to fetch the relevant extra information object and return the tai_label object stored there. It does a final check to see if the symbols match (just in case the jump destination was changed but the extra information wasn't updated).
It uses the old "optinfo" field to store the first extra optimisation information object associated with the tai. The objects themselves are stored in a linked list owned by the TAOptObj object in charge of everything, and is released en masse when the object is destroyed.
Everything. Feature implemented for cross-platform jump optimisations and for some x86-specific optimisations.
What is the current bug behavior?
What is the behavior after applying this patch?
Currently, there should be very few, if any, changes to output code (nothing appears in the RTL), but in some rare cases, deeper jump optimisations should be possible.
Relevant logs and/or screenshots
Currently no changes noted in RTL or compiler source. Feature is planned to be used more extensively later.