[fpc-devel] Register allocation question
Florian Klämpfl
florian at freepascal.org
Sat Apr 9 20:15:27 CEST 2011
Am 09.04.2011 20:08, schrieb Sergei Gorelkin:
> Hello,
>
> 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?
The registers are allocated in the order defined in
tcgx86_64.init_registers_allocators. However, there are rax etc. in
front of rbx etc. The reason why rbx etc. are used might be calls to
other procedures. Can you give an example which is affected by the
problem mentioned above?
More information about the fpc-devel
mailing list