[fpc-devel] Pure function development

J. Gareth Moreton gareth at moreton-family.com
Thu Apr 30 15:12:15 CEST 2020

It's likely that this feature may go through several iterations before 
we settle on some code that everyone is happy with.  At the moment I'm 
trying to design and develop a system that captures everything, like 
propagating through nested or recursive calls and calling internal 
functions that are, by all accounts, pure (e.g. Sqrt).

Constant propagation and simplification isn't perfect, especially where 
there's implicit typecasting and inline expansion.  Room for improvement 

Gareth aka. Kit

On 30/04/2020 10:48, Jonas Maebe wrote:
> On 30/04/2020 07:24, Sven Barth via fpc-devel wrote:
>> Well, Jonas is right that if you have a node tree that only has constant
>> nodes as inputs the tnode.simplify method should (in theory) be able to
>> completely collapse that (under the assumption that this is also handled
>> by call nodes and such).
> Simplify by itself cannot do that, but simplify + constant propagation
> can (once constant propagation gets extended). There is no reason why it
> should not be able to handle out-parameters, and it can already collapse
> entire (simple) functions into a single assignment of a constant to a
> function result (when combined with -Oodeadstore).
> I cannot think of a single reason why a particular
> propagation/simplification/emulation/... feature should not be supported
> by constant propagation, but should be supported when evaluating pure
> functions.
> 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.

More information about the fpc-devel mailing list