Interprocedural analysis (IPA)¶
GCC builds a “call graph”, recording which functions call which other functions, and it uses this for various optimizations.
It is constructed by the “*build_cgraph_edges” pass.
In case it’s of interest, it is available via the following Python API:
- gcc.get_callgraph_nodes()¶
Get a list of all
gcc.CallgraphNode
instances
- gccutils.callgraph_to_dot()¶
Return the GraphViz source for a rendering of the current callgraph, as a string.
Here’s an example of such a rendering:
- class gcc.CallgraphNode¶
- decl¶
The
gcc.FunctionDecl
for this node within the callgraph
- callees¶
The function calls made by this function, as a list of
gcc.CallgraphEdge
instances
- callers¶
The places that call this function, as a list of
gcc.CallgraphEdge
instances
Internally, this wraps a struct cgraph_node *
- class gcc.CallgraphEdge¶
- caller¶
The function that makes this call, as a
gcc.CallgraphNode
- callee¶
The function that is called here, as a
gcc.CallgraphNode
- call_stmt¶
The
gcc.GimpleCall
statememt for the function call
Internally, this wraps a struct cgraph_edge *