Re: [fpc-devel] Potential whole program optimization

2021-07-18 Thread J. Gareth Moreton via fpc-devel
I mention WPO because of other procedures calling them.  It would be very impractical to go back to procedures that have already gone through the peephole optimizer etc and change the references, especially if said reference is converted into a raw offset (I'm not absolutely sure when it's

Re: [fpc-devel] Potential whole program optimization

2021-07-18 Thread Martin Frb via fpc-devel
On 19/07/2021 01:24, J. Gareth Moreton via fpc-devel wrote: The final assembly language of each method is identical. (Note that the trunk is not this efficient just yet... it still leaves a "movq %rcx,%rax" instruction prior to "movl $1,%r8d" and then calls "movq (%rax),%rax" instead of

[fpc-devel] Potential whole program optimization

2021-07-18 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I've been playing around with the peephole optimizer on x86_64 a lot lately, and I'm starting to notice that a lot of procedures, both in the RTL and the compiler itself, produce the same assembly language when fully optimized (or sometimes even before this point).  Just as an

Re: [fpc-devel] {$if SizeOf(TMyOrdinalType) = 1} doesn't compile

2021-07-18 Thread Michael Van Canneyt via fpc-devel
On Sun, 18 Jul 2021, Zeljko Avramovic via fpc-devel wrote: As discussed at https://forum.lazarus.freepascal.org/index.php/topic,55397.0.html, this compiles and works well: {$MACRO ON} {$if SizeOf(byte) = 1} WriteLn('SizeOf(byte) = ', SizeOf(byte)); {$endif} however this does not

[fpc-devel] {$if SizeOf(TMyOrdinalType) = 1} doesn't compile

2021-07-18 Thread Zeljko Avramovic via fpc-devel
As discussed at https://forum.lazarus.freepascal.org/index.php/topic,55397.0.html, this compiles and works well: {$MACRO ON} {$if SizeOf(byte) = 1} WriteLn('SizeOf(byte) = ', SizeOf(byte)); {$endif} however this does not compile: {$MACRO ON} {$define TMyOrdinalType := byte}