[fpc-pascal] Register Allocation on x86_64

Martok listbox at martoks-place.de
Fri Jan 5 16:41:01 CET 2018


Hi all,

is it possible that the register allocation on x86_64 is a bit inefficient? No
matter the optimization settings, I can never get FPC to use more than the rax
and rdx registers. Especially $Optimization REGVAR does nothing (not even for
loop variables).
Instead, two nested loops are enough to get FPC to constantly do memory
load/stores on the loop variables. If an assembler block is marked as using
['rdx', 'rax'] (i.e.: rdtsc), instead of using some other general-purpose
registers, FPC stores them to memory before and reloads after the block. That
doesn't seem very efficient...

Is there anything else that needs to be switched on? I have the target arch set
to -CpCOREAVX2.


Regards,

Martok



More information about the fpc-pascal mailing list