LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Compute the escapes. More...
Go to the source code of this file.
Classes | |
class | escapes::EscapesVisitor |
Compute the escapes. More... |
Namespaces | |
namespace | escapes |
Computing escape and static link related information. |
Compute the escapes.
Variables and formals of a function may escape, i.e., be accessed by an inner function.
When the semantic analysis finds a declaration of variable or formal FOO, it needs to know wether it escapes or not. This requires an additional pass, before the semantic analysis, just to spot the potential escapes of FOO.
In order to pass the result to the semantic analysis which walks across the ast, the most natural and easy solution consists in tagging the various VarDec and Field.
Now, how shall we compute the escapes? The answer is obvious: we need to walk the ast, searching for variables declared then accessed by an inner function.