tipc
A TIP to LLVM compiler
CFAnalyzer.h
Go to the documentation of this file.
1 #include "ASTVisitor.h"
2 #include "CubicSolver.h"
3 #include "SymbolTable.h"
4 #include "treetypes/AST.h"
5 #include <stack>
6 
16 public:
23  static CFAnalyzer analyze(ASTProgram *p, SymbolTable *st);
24  bool visit(ASTFunction *element) override;
25  bool visit(ASTFunAppExpr *element) override;
26  bool visit(ASTAssignStmt *element) override;
27  void endVisit(ASTFunction *element) override;
28  std::vector<ASTFunction *> getPossibleFunctionsForExpr(ASTNode *n,
29  ASTFunction *f);
30 
31 private:
33  ASTNode *getCanonical(ASTNode *n);
34  ASTNode *getCanonicalForFunction(ASTNode *n, ASTFunction *);
35  CubicSolver s;
36  std::stack<ASTDeclNode *> scope;
37  SymbolTable *symbolTable;
38  ASTProgram *pgr;
39 };
Class for assignment.
Definition: ASTAssignStmt.h:8
Class for function call expressions.
Definition: ASTFunAppExpr.h:7
Class for defining the signature, local declarations, and a body of a function.
Definition: ASTFunction.h:11
Abstract base class for all AST nodes.
Definition: ASTNode.h:34
Class for a program which is a name and a list of functions.
Definition: ASTProgram.h:11
Base class for AST visitors.
Definition: ASTVisitor.h:23
Performs control flow analyses with the help of AST and Symbol table of a program Provides helper fun...
Definition: CFAnalyzer.h:15
void endVisit(ASTFunction *element) override
Definition: CFAnalyzer.cpp:47
bool visit(ASTFunction *element) override
Definition: CFAnalyzer.cpp:42
static CFAnalyzer analyze(ASTProgram *p, SymbolTable *st)
analyzes the AST and symbol table for a given program. Generates control flow constraints.
Definition: CFAnalyzer.cpp:4
std::vector< ASTFunction * > getPossibleFunctionsForExpr(ASTNode *n, ASTFunction *f)
Definition: CFAnalyzer.cpp:11
Definition: CubicSolver.h:24
Performs symbol analysis and records results for subsequent phases.
Definition: SymbolTable.h:17