tipc
A TIP to LLVM compiler
SemanticAnalysis.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ASTNode.h"
4 #include "ASTProgram.h"
5 #include "SymbolTable.h"
6 #include "TypeInference.h"
7 #include "cfa/CallGraph.h" //call graph builder header
8 #include <memory>
9 
19  std::shared_ptr<SymbolTable> symTable;
20  std::shared_ptr<TypeInference> typeResults;
21  std::shared_ptr<CallGraph> callGraph;
22 
23 public:
24  SemanticAnalysis(std::shared_ptr<SymbolTable> s,
25  std::shared_ptr<TypeInference> t,
26  std::shared_ptr<CallGraph> cg)
27  : symTable(std::move(s)), typeResults(std::move(t)),
28  callGraph(std::move(cg)) {}
29 
40  static std::shared_ptr<SemanticAnalysis> analyze(ASTProgram *ast,
41  bool polyInf);
42 
48 
54 
60 };
Class for a program which is a name and a list of functions.
Definition: ASTProgram.h:11
Performs control flow analysis and records results for subsequent phases Generates call graph of a pr...
Definition: CallGraph.h:22
Stores the results of semantic analysis passes.
Definition: SemanticAnalysis.h:18
TypeInference * getTypeResults()
Returns the type inference results.
Definition: SemanticAnalysis.cpp:16
SemanticAnalysis(std::shared_ptr< SymbolTable > s, std::shared_ptr< TypeInference > t, std::shared_ptr< CallGraph > cg)
Definition: SemanticAnalysis.h:24
static std::shared_ptr< SemanticAnalysis > analyze(ASTProgram *ast, bool polyInf)
Perform semantic analysis on program AST.
Definition: SemanticAnalysis.cpp:4
SymbolTable * getSymbolTable()
Returns the symbol table computed for the program.
Definition: SemanticAnalysis.cpp:14
CallGraph * getCallGraph()
Returns the call graph for the program.
Definition: SemanticAnalysis.cpp:18
Performs symbol analysis and records results for subsequent phases.
Definition: SymbolTable.h:17
Perform type inference and checking.
Definition: TypeInference.h:17