LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
escapes-visitor.hh File Reference

Compute the escapes. More...

#include <map>
#include <ast/default-visitor.hh>
#include <ast/non-object-visitor.hh>
Include dependency graph for escapes-visitor.hh:
This graph shows which files directly or indirectly include this file:

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.

Detailed Description

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.