class CallGraph

Declaration

class CallGraph { /* full declaration omitted */ };

Description

The basic data container for the call graph of a \c Module of IR. This class exposes both the interface to the call graph for a module of IR. The core call graph itself can also be updated to reflect changes to the IR.

Declared at: llvm/include/llvm/Analysis/CallGraph.h:72

Member Variables

private llvm::Module& M
private llvm::CallGraph::FunctionMapTy FunctionMap
A map from \c Function* to \c CallGraphNode*.
private llvm::CallGraphNode* ExternalCallingNode
This node has edges to all external functions and those internal functions that have their address taken.
private std::unique_ptr<CallGraphNode> CallsExternalNode
This node has edges to it from all functions making indirect calls or calling an external function.

Method Overview

Methods

CallGraph(llvm::CallGraph&& Arg)

Declared at: llvm/include/llvm/Analysis/CallGraph.h:91

Parameters

llvm::CallGraph&& Arg

CallGraph(llvm::Module& M)

Declared at: llvm/include/llvm/Analysis/CallGraph.h:90

Parameters

llvm::Module& M

void ReplaceExternalCallEdge(
    llvm::CallGraphNode* Old,
    llvm::CallGraphNode* New)

Description

Old node has been deleted, and New is to be used in its place, update the ExternalCallingNode.

Declared at: llvm/include/llvm/Analysis/CallGraph.h:135

Parameters

llvm::CallGraphNode* Old
llvm::CallGraphNode* New

void addToCallGraph(llvm::Function* F)

Description

Add a function to the call graph, and link the node to all of the functions that it calls.

Declared at: llvm/include/llvm/Analysis/CallGraph.h:159

Parameters

llvm::Function* F

inline llvm::CallGraph::iterator begin()

Declared at: llvm/include/llvm/Analysis/CallGraph.h:106

inline llvm::CallGraph::const_iterator begin()
    const

Declared at: llvm/include/llvm/Analysis/CallGraph.h:108

void dump() const

Declared at: llvm/include/llvm/Analysis/CallGraph.h:95

inline llvm::CallGraph::iterator end()

Declared at: llvm/include/llvm/Analysis/CallGraph.h:107

inline llvm::CallGraph::const_iterator end() const

Declared at: llvm/include/llvm/Analysis/CallGraph.h:109

llvm::CallGraphNode* getCallsExternalNode() const

Declared at: llvm/include/llvm/Analysis/CallGraph.h:129

llvm::CallGraphNode* getExternalCallingNode()
    const

Description

Returns the \c CallGraphNode which is used to represent undetermined calls into the callgraph.

Declared at: llvm/include/llvm/Analysis/CallGraph.h:127

llvm::Module& getModule() const

Description

Returns the module the call graph corresponds to.

Declared at: llvm/include/llvm/Analysis/CallGraph.h:101

llvm::CallGraphNode* getOrInsertFunction(
    const llvm::Function* F)

Description

Similar to operator[], but this will insert a new CallGraphNode for\c F if one does not already exist.

Declared at: llvm/include/llvm/Analysis/CallGraph.h:152

Parameters

const llvm::Function* F

bool invalidate(
    llvm::Module&,
    const llvm::PreservedAnalyses& PA,
    ModuleAnalysisManager::Invalidator&)

Declared at: llvm/include/llvm/Analysis/CallGraph.h:103

Parameters

llvm::Module&
const llvm::PreservedAnalyses& PA
ModuleAnalysisManager::Invalidator&

void populateCallGraphNode(
    llvm::CallGraphNode* CGN)

Description

Populate \p CGN based on the calls inside the associated function.

Declared at: llvm/include/llvm/Analysis/CallGraph.h:155

Parameters

llvm::CallGraphNode* CGN

void print(llvm::raw_ostream& OS) const

Declared at: llvm/include/llvm/Analysis/CallGraph.h:94

Parameters

llvm::raw_ostream& OS

llvm::Function* removeFunctionFromModule(
    llvm::CallGraphNode* CGN)

Description

Unlink the function from this module, returning it. Because this removes the function from the module, the call graph node is destroyed. This is only valid if the function does not call any other functions (ie, there are no edges in it's CGN). The easiest way to do this is to dropAllReferences before calling this.

Declared at: llvm/include/llvm/Analysis/CallGraph.h:148

Parameters

llvm::CallGraphNode* CGN

~CallGraph()

Declared at: llvm/include/llvm/Analysis/CallGraph.h:92