Performs control flow analysis and records results for subsequent phases Generates call graph of a program that represents calling relationships between subroutines in a computer program. Each node represents a subroutine and each edge (a1, a0) indicates that procedure a1 calls procedure a0. A cycle in the graph indicates recursive procedure calls, e.g., a0 -> a0 indicates that a0 calls itself recursively this call graph is sometimes approximations. Not all the call relationship that exist in the graph will occur in the actual runs of the program.
More...
#include <CallGraph.h>
Performs control flow analysis and records results for subsequent phases Generates call graph of a program that represents calling relationships between subroutines in a computer program. Each node represents a subroutine and each edge (a1, a0) indicates that procedure a1 calls procedure a0. A cycle in the graph indicates recursive procedure calls, e.g., a0 -> a0 indicates that a0 calls itself recursively this call graph is sometimes approximations. Not all the call relationship that exist in the graph will occur in the actual runs of the program.
◆ CallGraph()
◆ build()
Return the shared pointer of the call graph for a given program.
- Parameters
-
The | AST of the program and symbol table |
◆ existEdge()
bool CallGraph::existEdge |
( |
std::string |
caller, |
|
|
std::string |
callee |
|
) |
| |
Returns bool value indicating whether there is an edge between two subroutines.
- Parameters
-
caller | and callee are the str name of the subroutines |
- Returns
- returns true if an edge exists otherwise false
◆ getASTFun()
ASTFunction * CallGraph::getASTFun |
( |
std::string |
f_name | ) |
|
Returns the ASTFunction* for a given function name .
- Parameters
-
str | name of the subroutines |
- Returns
- ASTFunction*
◆ getCalledFuns()
Return the set of functions that may be called at an application expr.
◆ getCallees() [1/2]
Returns all the subroutines called by function f. this is an overloaded function.
- Parameters
-
f | The AST Function node, caller is the string name of a function |
- Returns
- The set of all callee functions node
◆ getCallees() [2/2]
std::set< ASTFunction * > CallGraph::getCallees |
( |
std::string |
caller | ) |
|
◆ getCallers() [1/2]
Returns all the subroutines that call function f.
- Parameters
-
f | The AST Function node or sting name of the function |
- Returns
- The set of all callers functions node
◆ getCallers() [2/2]
std::set< std::string > CallGraph::getCallers |
( |
std::string |
callee | ) |
|
◆ getEdges()
Return the set of edges for a given call graph.
◆ getTotalEdges()
int CallGraph::getTotalEdges |
( |
| ) |
|
Return the total num of edges for a given call graph.
◆ getTotalVertices()
int CallGraph::getTotalVertices |
( |
| ) |
|
Return the total num of vertices for a given call graph.
◆ getVertices()
std::vector< ASTFunction * > CallGraph::getVertices |
( |
| ) |
|
Return the set of vertices for a given call graph.
◆ print()
void CallGraph::print |
( |
std::ostream & |
os | ) |
|
Print call graph contents to output stream.
The documentation for this class was generated from the following files: