[fpc-devel] Do type-helpers block "regvar" opt?

Sven Barth pascaldragon at googlemail.com
Mon Sep 29 14:17:08 CEST 2025


Martin Frb via fpc-devel <fpc-devel at lists.freepascal.org> schrieb am Mo.,
29. Sep. 2025, 12:30:

> Tested with 3.3.1  d3ac07ad27
> -O4
> Win 64 bit
>
> In the code below, compiled with -alr
>     .section .text.n_p$project1_$$_foo,"ax"
>     ....
>     # Var a located in register rbx
> (and it stays in rbx, until the call to write is prepared)
>
>
>
> But if I comment out the "write", and uncomment the "a.w"
>     # Var a located at rsp+32, size=OS_64
>
> Even the initial 2 lines will then NOT use a register for "a"?
>

The Self parameter of a type helper is a pointer, so the compiler needs to
be able to take the address which in turn prohibits the use of the regvar
optimization for that variable.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20250929/3dfa7276/attachment.htm>


More information about the fpc-devel mailing list