[fpc-devel] Merging identical procedure proposals

J. Gareth Moreton gareth at moreton-family.com
Sat Oct 16 19:59:20 CEST 2021


Sounds like "procvar = @myproc" would be -O4 at best due to the 
side-effects, otherwise I would wonder if it's possible to track such 
references, especially with units that are pre-compiled.

Gareth aka. Kit

On 16/10/2021 15:32, Jonas Maebe via fpc-devel wrote:
> On 13/10/2021 19:33, J. Gareth Moreton via fpc-devel wrote:
>> I figure this would be a whole-program optimization though due to 
>> inter-unit calls and comparisons and the like.
>
> Usually this is an optimisation that is performed at link-time because 
> you don't need any compiler-level information for it. And then it can 
> also consider code from statically linked libraries etc. Most standard 
> linkers don't have support for it, but link-time optimisation 
> frameworks generally do.
>
> One thing you have to be mindful of is that if the address of a 
> routine gets taken in any way then you cannot merge it anymore, 
> because there might be a comparison somewhere in the program such as
>
> if procvar = @myproc then
>   ..
> end;
>
> and if myproc gets merged with other routines, then this will return 
> true in more cases.
>
>
> Jonas
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>

-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the fpc-devel mailing list