[fpc-devel] optimizing the peephole optimizer?

Florian Klämpfl florian at freepascal.org
Thu Jan 23 20:31:23 CET 2014


Am 23.01.2014 02:38, schrieb Nikolay Nikolov:
> 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. 

Well, with "some" defines :)

> 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). 

Everything involving addresses must be handled very carefully. A lot is
movz/s, shifting or setxx related. So fear overlap is maybe 50%

> 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 

Which is also on my todo list :)






More information about the fpc-devel mailing list