[fpc-pascal] Inline function parameters
Sven Barth
pascaldragon at googlemail.com
Thu Nov 11 07:35:21 CET 2021
Am 11.11.2021 um 02:52 schrieb Ryan Joseph via fpc-pascal:
>
>> On Nov 9, 2021, at 1:09 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>>
>> No, because the function that is called with a function pointer needs to be inlined itself (thus becoming part of its caller) so that constant propagation works at all for the parameters. If a function isn't inlined then there won't be any change and the passed in function variable will be called as usual.
> I mean in theory if the compiler were to support inlining function pointers that is how it could be done.
No, because that is not how inlining and constant propagation works. And
we're not going to implement something new just for this when perfectly
fine mechanisms exist already.
What needs to be done is to extend constant propagation to
function/method variables and then things would work out automatically
already.
Regards,
Sven
More information about the fpc-pascal
mailing list