[fpc-devel] optimizing the peephole optimizer?
nickysn at users.sourceforge.net
Thu Jan 23 02:38:22 CET 2014
On 01/22/2014 11:25 PM, Florian Klämpfl wrote:
> Am 22.01.2014 02:17, schrieb Nikolay Nikolov:
>> On 01/21/2014 11:20 PM, Florian Klämpfl wrote:
>>> It is still on my todo list though to update the peephole optimizer and
>>> make a common one for i386 and x86_64 ...
>> And don't forget i8086 :)
> I think there is little to share that's why I didn't mention it :)
Well, x86 is x86 is x86. Most of the x86 code generator is already
shared in x86/cgx86.pas and that code is common for i8086, i386 and
x86_64. IMHO, most of the peephole optimizations can be shared across
all x86. Only the 'lea'-related stuff wouldn't work on i8086 (because of
the register restrictions of 16-bit references) and there are some
optimizations, which are specific to i8086 (like converting certain
sequences of movs to lds/les). Of course, I could be wrong, but that was
my opinion from looking at popt386.pas. It just looked to me that most
optimizations done there apply equally well to i8086 as well as x86_64
and it was in my TODO list to eventually cleanup and unify the peephole
optimizer across all x86 (or if that turns out to be impractical, at
least write one for i8086).
More information about the fpc-devel