LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Attributes | List of all members
llvm::CallGraph Class Reference

#include <CallGraph.h>

Inheritance diagram for llvm::CallGraph:
Inheritance graph
[legend]
Collaboration diagram for llvm::CallGraph:
Collaboration graph
[legend]

Public Types

typedef FunctionMapTy::iterator iterator
 
typedef
FunctionMapTy::const_iterator 
const_iterator
 

Public Member Functions

ModulegetModule () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const CallGraphNodeoperator[] (const Function *F) const
 
CallGraphNodeoperator[] (const Function *F)
 
CallGraphNodegetExternalCallingNode () const
 
CallGraphNodegetCallsExternalNode () const
 
CallGraphNodegetRoot ()
 
const CallGraphNodegetRoot () const
 
FunctionremoveFunctionFromModule (CallGraphNode *CGN)
 
CallGraphNodegetOrInsertFunction (const Function *F)
 
 CallGraph ()
 
virtual ~CallGraph ()
 
virtual void getAnalysisUsage (AnalysisUsage &AU) const
 
virtual bool runOnModule (Module &M)
 
virtual void releaseMemory ()
 
void print (raw_ostream &o, const Module *) const
 
void dump () const
 
- Public Member Functions inherited from llvm::ModulePass
PasscreatePrinterPass (raw_ostream &O, const std::string &Banner) const
 createPrinterPass - Get a module printer pass. More...
 
virtual void assignPassManager (PMStack &PMS, PassManagerType T)
 
virtual PassManagerType getPotentialPassManagerType () const
 Return what kind of Pass Manager can manage this pass. More...
 
 ModulePass (char &pid)
 
virtual ~ModulePass ()
 
- Public Member Functions inherited from llvm::Pass
 Pass (PassKind K, char &pid)
 
virtual ~Pass ()
 
PassKind getPassKind () const
 
virtual const char * getPassName () const
 
AnalysisID getPassID () const
 getPassID - Return the PassID number that corresponds to this pass. More...
 
virtual bool doInitialization (Module &)
 
virtual bool doFinalization (Module &)
 
void dump () const
 
virtual void preparePassManager (PMStack &)
 Check if available pass managers are suitable for this pass or not. More...
 
void setResolver (AnalysisResolver *AR)
 
AnalysisResolvergetResolver () const
 
virtual void * getAdjustedAnalysisPointer (AnalysisID ID)
 
virtual ImmutablePassgetAsImmutablePass ()
 
virtual PMDataManagergetAsPMDataManager ()
 
virtual void verifyAnalysis () const
 
virtual void dumpPassStructure (unsigned Offset=0)
 
template<typename AnalysisType >
AnalysisType * getAnalysisIfAvailable () const
 
bool mustPreserveAnalysisID (char &AID) const
 
template<typename AnalysisType >
AnalysisType & getAnalysis () const
 
template<typename AnalysisType >
AnalysisType & getAnalysis (Function &F)
 
template<typename AnalysisType >
AnalysisType & getAnalysisID (AnalysisID PI) const
 
template<typename AnalysisType >
AnalysisType & getAnalysisID (AnalysisID PI, Function &F)
 

Static Public Attributes

static char ID = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::Pass
static const PassInfolookupPassInfo (const void *TI)
 
static const PassInfolookupPassInfo (StringRef Arg)
 
static PasscreatePass (AnalysisID ID)
 

Detailed Description

Definition at line 72 of file CallGraph.h.

Member Typedef Documentation

typedef FunctionMapTy::const_iterator llvm::CallGraph::const_iterator

Definition at line 108 of file CallGraph.h.

typedef FunctionMapTy::iterator llvm::CallGraph::iterator

Definition at line 107 of file CallGraph.h.

Constructor & Destructor Documentation

CallGraph::CallGraph ( )
virtual llvm::CallGraph::~CallGraph ( )
inlinevirtual

Definition at line 161 of file CallGraph.h.

References releaseMemory().

Member Function Documentation

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

Definition at line 116 of file CallGraph.h.

void CallGraph::dump ( ) const

Definition at line 129 of file CallGraph.cpp.

References llvm::dbgs(), and print().

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

Definition at line 117 of file CallGraph.h.

void CallGraph::getAnalysisUsage ( AnalysisUsage ) const
virtual

getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.

Reimplemented from llvm::Pass.

Definition at line 65 of file CallGraph.cpp.

References llvm::AnalysisUsage::setPreservesAll().

CallGraphNode* llvm::CallGraph::getCallsExternalNode ( ) const
inline

Definition at line 135 of file CallGraph.h.

CallGraphNode* llvm::CallGraph::getExternalCallingNode ( ) const
inline

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

Definition at line 134 of file CallGraph.h.

Referenced by llvm::GraphTraits< CallGraph * >::getEntryNode(), llvm::GraphTraits< const CallGraph * >::getEntryNode(), and llvm::Inliner::removeDeadFunctions().

Module& llvm::CallGraph::getModule ( ) const
inline

getModule - Return the module the call graph corresponds to.

Definition at line 112 of file CallGraph.h.

CallGraphNode * CallGraph::getOrInsertFunction ( const Function F)

getOrInsertFunction - This method is identical to calling operator[], but it will insert a new CallGraphNode for the specified function if one does not already exist.

Definition at line 173 of file CallGraph.cpp.

References F(), and llvm::GlobalValue::getParent().

Referenced by runOnModule().

CallGraphNode* llvm::CallGraph::getRoot ( )
inline

Return the root/main method in the module, or some other root node, such as the externalcallingnode.

Definition at line 139 of file CallGraph.h.

const CallGraphNode* llvm::CallGraph::getRoot ( ) const
inline

Definition at line 140 of file CallGraph.h.

const CallGraphNode* llvm::CallGraph::operator[] ( const Function F) const
inline

Definition at line 121 of file CallGraph.h.

References I.

CallGraphNode* llvm::CallGraph::operator[] ( const Function F)
inline

Definition at line 126 of file CallGraph.h.

References I.

void CallGraph::print ( raw_ostream O,
const Module M 
) const
virtual

print - Print out the internal state of the pass. This is called by Analyze to print out the contents of an analysis. Otherwise it is not necessary to implement this method. Beware that the module pointer MAY be null. This automatically forwards to a virtual function that does not provide the Module* in case the analysis doesn't need it it can just be ignored.

Reimplemented from llvm::Pass.

Definition at line 117 of file CallGraph.cpp.

References begin(), end(), llvm::CallGraphNode::getFunction(), llvm::Value::getName(), and I.

Referenced by dump().

void CallGraph::releaseMemory ( )
virtual

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused.

Optionally implement this function to release pass memory when it is no longer used.

CallsExternalNode is not in the function map, delete it explicitly.

Reimplemented from llvm::Pass.

Definition at line 92 of file CallGraph.cpp.

References I.

Referenced by ~CallGraph().

Function * CallGraph::removeFunctionFromModule ( CallGraphNode CGN)

removeFunctionFromModule - 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 144 of file CallGraph.cpp.

References llvm::CallGraphNode::empty(), F(), llvm::CallGraphNode::getFunction(), llvm::Module::getFunctionList(), and llvm::iplist< NodeTy, Traits >::remove().

Referenced by llvm::Inliner::removeDeadFunctions(), and llvm::Inliner::runOnSCC().

bool CallGraph::runOnModule ( Module M)
virtual

runOnModule - Virtual method overriden by subclasses to process the module being operated on.

Implements llvm::ModulePass.

Definition at line 69 of file CallGraph.cpp.

References llvm::Module::begin(), llvm::Module::end(), getOrInsertFunction(), and I.

Member Data Documentation

char CallGraph::ID = 0
static

Definition at line 103 of file CallGraph.h.


The documentation for this class was generated from the following files: