[fpc-devel] (patch) An attempt to improve assignments/functionresult reuse

Florian Klaempfl florian at freepascal.org
Sun Dec 16 11:13:39 CET 2007

Jonas Maebe schrieb:
> On 16 Dec 2007, at 10:12, Florian Klaempfl wrote:
>> Sergei Gorelkin schrieb:
>>> I am not sure that we need the particular DFA from optdfa.pas, but
>>> something to reduce conservativeness of escape analysis is definitely
>>> needed. Otherwise, temps that are needed for just one particular case of
>>> x:=f(x) are being created almost everywhere.
>>> DFA comes from Jonas's advice from one of the first messages:
>> When Jonas posted this message first, I didn't understand because I
>> thought I read it too quick, but after carefull reading, I still don't
>> understand it :) The first paragraph talks about alias analysis while
>> the second talks about dfa.
> You need the latter to perform the former in a context-sensitive way.
> Context-sensitive means that the outcome of your analysis is tailored to
> a particular point in the procedure, rather than valid in any context/at
> any point in the procedure.

So indeed an alias analysis is required. Doing a simple one shouldn't be
too hard but I fear it will be too conservative as well ...

> However, you can only do this if you know what has been executed before
> you reached that particular point, and that is where DFA comes in.
>> Let it consider from a practical point :) Which piece of code makes too
>> conservative assumptions? The big if in ncgld.maybechangetemp?
> No, it's the big if in tcallnode.maybe_create_funcret_node. The
> conservative/context-insensitive parts are the ti_addr_taken and
> addr_taken checks. These are computed globally for the entire current
> procedure, rather than statement per statement based on which statements
> can have been executed before the current statement is executed.

What's a typical example of code which is compiled too conservative?
Maybe we can reduce the setting of ti_addr_taken?

More information about the fpc-devel mailing list