[fpc-pascal] Register Allocation on x86_64

Jonas Maebe jonas at freepascal.org
Fri Jan 5 18:03:32 CET 2018


On 05/01/18 16:41, Martok wrote:

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

regvars have always been disabled for routines that contain assembler 
blocks (on all architectures). Sometimes the compiler temporarily uses 
registers for other purposes over a longer period, which is why marking 
the used registers is still required.


Jonas



More information about the fpc-pascal mailing list