34 class ExprLocalFunctionNode;
75 _type=((firstType.
isFP(1) ? secondType : firstType).setLifetime(firstType, secondType));
99 typedef std::map<std::string, std::unique_ptr<ExprLocalVar>>
VarDictType;
136 void add(
const std::string& name, std::unique_ptr<ExprLocalVar> var);
145 std::vector<std::pair<std::string,ExprLocalVarPhi*>>&
merge(
size_t index){
160 std::unique_ptr<ExprVarEnv> newEnv(
new ExprVarEnv);
162 all.emplace_back(std::move(newEnv));
170 std::unique_ptr<ExprVarEnv> newEnv(
new ExprVarEnv);
171 newEnv->resetAndSetParent(parent);
172 all.emplace_back(std::move(newEnv));
173 return all.back().get();
177 std::vector<std::unique_ptr<ExprVarEnv>>
all;
ExprEvalResult(int n, double *fp, const char **c)
std::vector< std::vector< std::pair< std::string, ExprLocalVarPhi * > > > _mergedVariables
Keep track of all merged variables in.
ExprLocalVar(const ExprType &type)
ExprEvalResult(int n, double *fp)
bool isFP() const
Direct is predicate checks.
std::vector< std::unique_ptr< ExprVarEnv > > all
All owned symbol tables.
ExprType type() const
returns type of the variable
Node that contains local function.
std::vector< std::unique_ptr< ExprLocalVar > > shadowedVariables
Variables that have been superceded (and thus are inaccessible)
int buildInterpreter(Interpreter *interpreter) const
Allocates variable for interpreter.
void add(const std::string &name, std::unique_ptr< ExprLocalVar > var)
Add a variable refernece.
std::map< std::string, std::unique_ptr< ExprLocalVar > > VarDictType
ExprVarEnv * createDescendant(ExprVarEnv *parent)
Create a descendant scope from the provided parent, does not clobber current.
ExprEvalResult(const char **c)
ExprVarEnv * _currentEnv
The current symbol table (should be a pointer owned by all)
ExprVarEnv()
Create a scope with no parent.
size_t mergeBranches(const ExprType &type, ExprVarEnv &env1, ExprVarEnv &env2)
Add all variables into scope by name, but modify their lifetimes to the given type's lifetime...
ExprType & setLifetime(const ExprType &a)
Assign the lifetime from type a to be my type.
ExprLocalVar reference, all local variables in seexpr are subclasses of this or this itself...
Variable scope for tracking variable lookup.
const ExprLocalVar * getPhi() const
get the primary representative phi node (i.e. the global parent of a dependent phi node) ...
The result is computed int int< br >< divstyle="margin-left:40px;"> Picks values randomly between loRange and hiRange based on supplied index(which is automatically hashed). 
ExprVarEnv & operator=(ExprVarEnv &other)
virtual LLVM_VALUE codegen(LLVM_BUILDER, const std::string &name, LLVM_VALUE referenceType) LLVM_BODY
LLVM value that has been allocated.
void reset()
Reset to factory state (one empty environment that is current)
static bool valuesCompatible(const ExprType &a, const ExprType &b)
Checks if value types are compatible.
ExprLocalVar * find(const std::string &name)
Find a variable name by name (recursive to parents)
std::map< std::string, ExprLocalFunctionNode * > FuncDictType
ExprLocalFunctionNode * findFunction(const std::string &name)
Find a function by name (recursive to parents)
ExprVarEnv * current()
Return the current variable scope.
virtual LLVM_VALUE varPtr()
LLVM value that has been pre-done.
ExprLocalVar const * lookup(const std::string &name) const
Find a const variable reference name by name (recursive to parents)
ExprVarEnv * _parent
Parent variable environment has all variablesf rom previou scope (for lookup)
void resetAndSetParent(ExprVarEnv *parent)
Resets the scope (deletes all variables) and sets parent.
void setPhi(ExprLocalVar *phi)
sets the representative phi node (like a brute force set unioning operation) phi is the set represent...
ExprLocalVar join (merge) references. Remembers which variables are possible assigners to this...
LLVM_VALUE codegenMerges(LLVM_BUILDER builder, int mergeIndex) LLVM_BODY
ExprLocalVarPhi(ExprType condLife, ExprLocalVar *thenVar, ExprLocalVar *elseVar)
void addFunction(const std::string &name, ExprLocalFunctionNode *prototype)
Add a function.
void setCurrent(ExprVarEnv *env)
Set a new current variable scope.
ExprVarEnvBuilder()
Creates an empty builder with one current scope entry.
std::vector< std::pair< std::string, ExprLocalVarPhi * > > & merge(size_t index)
virtual void setPhi(ExprLocalVar *phi)
sets the representative phi node (like a brute force set unioning operation) phi is the set represent...
Variable scope builder is used by the type checking and code gen to track visiblity of variables and ...