[fpc-devel] Register allocation question

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Apr 9 20:13:16 CEST 2011


On 09 Apr 2011, at 20:08, Sergei Gorelkin wrote:

> I wonder whether it is possible to assign a priority (or order) of registers for FPC's register allocator. Currently registers are allocated in the order of ordinals defined in cpubase.pas. On i386 it doesn't make any difference, but on x86_64 'nonvolatile' rbx (and in Win64 also rsi and rdi) are always used before 'volatile' ones r8..r11. Reversing this order would help avoiding stackframes in simple procedures, resulting in nicer code.
> 
> Maybe somebody could share some clues about if this is possible and where to start looking?

Simply changing the register order in the array to trgcpu.create in Tcgx86_64.init_register_allocators should do it.


Jonas


More information about the fpc-devel mailing list