[fpc-devel] Registers allocation technique

Sergei Gorelkin sergei_gorelkin at mail.ru
Wed Oct 1 10:25:05 CEST 2014


30.09.2014 23:34, Sven Barth пишет:
> On 30.09.2014 18:37, Lag Programming wrote:
>> 1) "Unless a function calls another function, the function result
>> register will always be in rax. Calling for inlined functions doesn't
>> change this behaviour as it's not a real function call."
>
> RAX will only then be used for the function result when it is really needed (e.g. the last
> assignment in a function).

To somewhat clarify: the reqirement is to place result into RAX at the function exit point. This is 
unrelated to assignments to the 'result' variable in code.

 > Before that the compiler might reuse RAX as it pleases.
Likewise, the value of 'result' may be placed into any register or even to memory.

Regards,
Sergei




More information about the fpc-devel mailing list