|
LLVM
4.0.0
|
A class used to represent edges in the call graph. More...
#include <LazyCallGraph.h>
Public Types | |
| enum | Kind : bool { Ref = false, Call = true } |
| The kind of edge in the graph. More... | |
Public Member Functions | |
| Edge () | |
| Edge (Function &F, Kind K) | |
| Edge (Node &N, Kind K) | |
| operator bool () const | |
| Test whether the edge is null. More... | |
| Kind | getKind () const |
Returnss the Kind of the edge. More... | |
| bool | isCall () const |
| Test whether the edge represents a direct call to a function. More... | |
| Function & | getFunction () const |
| Get the function referenced by this edge. More... | |
| Node * | getNode () const |
| Get the call graph node referenced by this edge if one exists. More... | |
| Node & | getNode (LazyCallGraph &G) |
| Get the call graph node for this edge, building it if necessary. More... | |
Friends | |
| class | LazyCallGraph::Node |
| class | LazyCallGraph::RefSCC |
A class used to represent edges in the call graph.
The lazy call graph models both call edges and reference edges. Call edges are much what you would expect, and exist when there is a 'call' or 'invoke' instruction of some function. Reference edges are also tracked along side these, and exist whenever any instruction (transitively through its operands) references a function. All call edges are inherently reference edges, and so the reference graph forms a superset of the formal call graph.
Furthermore, edges also may point to raw Function objects when those functions have not been scanned and incorporated into the graph (yet). This is one of the primary ways in which the graph can be lazy. When functions are scanned and fully incorporated into the graph, all of the edges referencing them are updated to point to the graph Node objects instead of to the raw Function objects. This class even provides methods to trigger this scan on-demand by attempting to get the target node of the graph and providing a reference back to the graph in order to lazily build it if necessary.
All of these forms of edges are fundamentally represented as outgoing edges. The edges are stored in the source node and point at the target node. This allows the edge structure itself to be a very compact data structure: essentially a tagged pointer.
Definition at line 138 of file LazyCallGraph.h.
|
inline |
Definition at line 1110 of file LazyCallGraph.h.
Definition at line 1111 of file LazyCallGraph.h.
Definition at line 1112 of file LazyCallGraph.h.
|
inline |
Get the function referenced by this edge.
This requires that the edge is not null, but will succeed whether we have built a graph node for the function yet or not.
Definition at line 1128 of file LazyCallGraph.h.
|
inline |
Returnss the Kind of the edge.
Definition at line 1118 of file LazyCallGraph.h.
References assert().
|
inline |
Get the call graph node referenced by this edge if one exists.
This requires that the edge is not null. If we have built a graph node for the function this edge points to, this will return that node, otherwise it will return null.
Definition at line 1137 of file LazyCallGraph.h.
|
inline |
Get the call graph node for this edge, building it if necessary.
This requires that the edge is not null. If we have not yet built a graph node for the function this edge points to, this will first ask the graph to build that node, inserting it into all the relevant structures.
Definition at line 1146 of file LazyCallGraph.h.
References assert(), llvm::LazyCallGraph::get(), N, and P.
|
inline |
Test whether the edge represents a direct call to a function.
This requires that the edge is not null.
Definition at line 1123 of file LazyCallGraph.h.
References assert(), and llvm::Call.
Referenced by llvm::LazyCallGraph::RefSCC::insertTrivialCallEdge().
|
inlineexplicit |
Test whether the edge is null.
This happens when an edge has been deleted. We leave the edge objects around but clear them.
Definition at line 1114 of file LazyCallGraph.h.
|
friend |
Definition at line 183 of file LazyCallGraph.h.
|
friend |
Definition at line 184 of file LazyCallGraph.h.
1.8.6