LLVM
8.0.1
|
The basic data container for the call graph of a Module
of IR.
More...
#include "llvm/Analysis/CallGraph.h"
Public Types | |
using | iterator = FunctionMapTy::iterator |
using | const_iterator = FunctionMapTy::const_iterator |
Public Member Functions | |
CallGraph (Module &M) | |
CallGraph (CallGraph &&Arg) | |
~CallGraph () | |
void | print (raw_ostream &OS) const |
void | dump () const |
Module & | getModule () const |
Returns the module the call graph corresponds to. More... | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
const CallGraphNode * | operator[] (const Function *F) const |
Returns the call graph node for the provided function. More... | |
CallGraphNode * | operator[] (const Function *F) |
Returns the call graph node for the provided function. More... | |
CallGraphNode * | getExternalCallingNode () const |
Returns the CallGraphNode which is used to represent undetermined calls into the callgraph. More... | |
CallGraphNode * | getCallsExternalNode () const |
Function * | removeFunctionFromModule (CallGraphNode *CGN) |
Unlink the function from this module, returning it. More... | |
CallGraphNode * | getOrInsertFunction (const Function *F) |
Similar to operator[], but this will insert a new CallGraphNode for F if one does not already exist. More... | |
The basic data container for the call graph of a 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.
Definition at line 74 of file CallGraph.h.
using llvm::CallGraph::const_iterator = FunctionMapTy::const_iterator |
Definition at line 111 of file CallGraph.h.
using llvm::CallGraph::iterator = FunctionMapTy::iterator |
Definition at line 110 of file CallGraph.h.
|
explicit |
Definition at line 32 of file CallGraph.cpp.
References F().
Referenced by llvm::CallGraphAnalysis::run().
CallGraph::CallGraph | ( | CallGraph && | Arg | ) |
Definition at line 40 of file CallGraph.cpp.
References Arg.
CallGraph::~CallGraph | ( | ) |
Definition at line 48 of file CallGraph.cpp.
|
inline |
Definition at line 116 of file CallGraph.h.
Referenced by llvm::GraphTraits< CallGraph * >::nodes_begin(), and llvm::GraphTraits< const CallGraph * >::nodes_begin().
|
inline |
Definition at line 118 of file CallGraph.h.
LLVM_DUMP_METHOD void CallGraph::dump | ( | ) | const |
Definition at line 113 of file CallGraph.cpp.
References llvm::dbgs(), and print().
Referenced by llvm::CallGraphWrapperPass::getOrInsertFunction(), and llvm::CallGraphNode::operator[]().
|
inline |
Definition at line 117 of file CallGraph.h.
Referenced by llvm::GraphTraits< CallGraph * >::nodes_end(), and llvm::GraphTraits< const CallGraph * >::nodes_end().
|
inline |
Definition at line 119 of file CallGraph.h.
|
inline |
Definition at line 139 of file CallGraph.h.
References getOrInsertFunction(), and removeFunctionFromModule().
Referenced by prepareForSplit().
|
inline |
Returns the CallGraphNode
which is used to represent undetermined calls into the callgraph.
Definition at line 137 of file CallGraph.h.
Referenced by llvm::GraphTraits< CallGraph * >::getEntryNode(), llvm::GraphTraits< const CallGraph * >::getEntryNode(), llvm::InternalizePass::internalizeModule(), and llvm::LegacyInlinerBase::removeDeadFunctions().
|
inline |
Returns the module the call graph corresponds to.
Definition at line 114 of file CallGraph.h.
Referenced by copyFeaturesToFunction(), createDevirtTriggerFunc(), llvm::LegacyInlinerBase::doInitialization(), llvm::CallGraphSCCPass::getAnalysisUsage(), and llvm::CallGraphSCCPass::skipSCC().
CallGraphNode * CallGraph::getOrInsertFunction | ( | const Function * | F | ) |
Similar to operator[], but this will insert a new CallGraphNode for F
if one does not already exist.
Definition at line 149 of file CallGraph.cpp.
References assert(), F(), and llvm::GlobalValue::getParent().
Referenced by llvm::createArgumentPromotionPass(), getCallsExternalNode(), and llvm::coro::updateCallGraph().
|
inline |
Returns the call graph node for the provided function.
Definition at line 122 of file CallGraph.h.
|
inline |
Returns the call graph node for the provided function.
Definition at line 129 of file CallGraph.h.
void CallGraph::print | ( | raw_ostream & | OS | ) | const |
Definition at line 90 of file CallGraph.cpp.
References llvm::CallGraphNode::getFunction(), I, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorImpl< T >::reserve(), and llvm::sort().
Referenced by dump(), llvm::CallGraphNode::dump(), llvm::CallGraphWrapperPass::getOrInsertFunction(), llvm::CallGraphNode::operator[](), and llvm::CallGraphPrinterPass::run().
Function * CallGraph::removeFunctionFromModule | ( | CallGraphNode * | CGN | ) |
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.
Definition at line 122 of file CallGraph.cpp.
References assert(), llvm::CallGraphNode::empty(), F(), From, llvm::CallGraphNode::getFunction(), llvm::Module::getFunctionList(), I, and llvm::iplist_impl< IntrusiveListT, TraitsT >::remove().
Referenced by llvm::createArgumentPromotionPass(), and getCallsExternalNode().