I'm liking these discussions!
I have done some refactoring, such as attempting to 'factor out' common
conditions (sometimes a matching instruction, but also commonly the
operand types). Sometimes I choose not to factor - for example,
sometimes I try to compute relatively cheap conditions first and delay
things like GetNextInstruction for as long as possible due to its
relative slowness (stepping through a linked list).
Pattern matching ideas do sound good honestly - it would especially be
good for simple, 2-instruction optimisations, say. That's definitely
somehing I want to try somewhere.
Kit
On 11/11/2022 10:54, Marco van de Voort via fpc-devel wrote:
On 11-11-2022 09:57, Jonas Maebe via fpc-devel wrote:
On 11/11/2022 00:44, J. Gareth Moreton via fpc-devel wrote:
My slight concern is that the x86 peephole optimizer is becoming
pretty bloated now
An alternative could be to specify the peephole optimizations in a
pattern matching format, and then either write a tool that converts
them to a bunch of if-then-else statements, or interpret this format
directly in the compiler.
Or maybe predicting branch taken taking more into consideration than
which node of if..then..else it is.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel