LLVM API Documentation

llvm::CallGraph Class Reference

#include <CallGraph.h>

Collaboration diagram for llvm::CallGraph:

Collaboration graph
[legend]
List of all members.

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)
virtual CallGraphNodegetExternalCallingNode () const
virtual CallGraphNodegetRoot ()
virtual const CallGraphNodegetRoot () const
FunctionremoveFunctionFromModule (CallGraphNode *CGN)
FunctionremoveFunctionFromModule (Function *F)
void changeFunction (Function *OldF, Function *NewF)
CallGraphNodegetOrInsertFunction (const Function *F)
virtual ~CallGraph ()
void initialize (Module &M)
virtual void print (std::ostream &o, const Module *M) const
void dump () const

Static Public Member Functions

static void stub ()

Protected Types

typedef std::map< const Function *,
CallGraphNode * > 
FunctionMapTy

Protected Member Functions

 CallGraph ()
virtual void destroy ()

Protected Attributes

ModuleMod
FunctionMapTy FunctionMap

Detailed Description

Definition at line 67 of file CallGraph.h.


Member Typedef Documentation

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

Definition at line 79 of file CallGraph.h.

typedef std::map<const Function *, CallGraphNode *> llvm::CallGraph::FunctionMapTy [protected]

Definition at line 71 of file CallGraph.h.

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

Definition at line 78 of file CallGraph.h.


Constructor & Destructor Documentation

llvm::CallGraph::CallGraph (  )  [inline, protected]

Definition at line 144 of file CallGraph.h.

virtual llvm::CallGraph::~CallGraph (  )  [inline, virtual]

Definition at line 147 of file CallGraph.h.

References destroy().


Member Function Documentation

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

Definition at line 87 of file CallGraph.h.

References FunctionMap.

iterator llvm::CallGraph::begin (  )  [inline]

Definition at line 85 of file CallGraph.h.

References FunctionMap.

Referenced by llvm::Inliner::doFinalization(), llvm::GraphTraits< const CallGraph * >::nodes_begin(), llvm::GraphTraits< CallGraph * >::nodes_begin(), and print().

void CallGraph::changeFunction ( Function OldF,
Function NewF 
)

changeFunction - This method changes the function associated with this CallGraphNode, for use by transformations that need to change the prototype of a Function (thus they must create a new Function and move the old code over).

Definition at line 238 of file CallGraph.cpp.

References llvm::CallGraphNode::F, and FunctionMap.

void CallGraph::destroy (  )  [protected, virtual]

Definition at line 195 of file CallGraph.cpp.

References E, and FunctionMap.

Referenced by initialize(), and ~CallGraph().

void CallGraph::dump (  )  const

Definition at line 209 of file CallGraph.cpp.

References print().

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

Definition at line 88 of file CallGraph.h.

References FunctionMap.

iterator llvm::CallGraph::end (  )  [inline]

Definition at line 86 of file CallGraph.h.

References FunctionMap.

Referenced by llvm::Inliner::doFinalization(), llvm::GraphTraits< const CallGraph * >::nodes_end(), llvm::GraphTraits< CallGraph * >::nodes_end(), and print().

virtual CallGraphNode* llvm::CallGraph::getExternalCallingNode (  )  const [inline, virtual]

Definition at line 105 of file CallGraph.h.

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

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

getModule - Return the module the call graph corresponds to.

Definition at line 83 of file CallGraph.h.

References Mod.

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

References F, FunctionMap, and Mod.

Referenced by llvm::InlineFunction().

virtual const CallGraphNode* llvm::CallGraph::getRoot (  )  const [inline, virtual]

Definition at line 111 of file CallGraph.h.

virtual CallGraphNode* llvm::CallGraph::getRoot (  )  [inline, virtual]

Definition at line 110 of file CallGraph.h.

void CallGraph::initialize ( Module M  ) 

initialize - Call this method before calling other methods, re/initializes the state of the CallGraph.

Definition at line 190 of file CallGraph.cpp.

References destroy(), M, and Mod.

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

Definition at line 97 of file CallGraph.h.

References F, FunctionMap, and I.

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

Definition at line 92 of file CallGraph.h.

References F, FunctionMap, and I.

void CallGraph::print ( std::ostream &  o,
const Module M 
) const [virtual]

Definition at line 204 of file CallGraph.cpp.

References begin(), E, and end().

Referenced by dump().

Function* llvm::CallGraph::removeFunctionFromModule ( Function F  )  [inline]

Definition at line 125 of file CallGraph.h.

References F, and removeFunctionFromModule().

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

References llvm::CallGraphNode::CalledFunctions, FunctionMap, llvm::CallGraphNode::getFunction(), llvm::Module::getFunctionList(), and Mod.

Referenced by llvm::Inliner::doFinalization(), InlineCallIfPossible(), and removeFunctionFromModule().

void CallGraph::stub (  )  [static]

Definition at line 261 of file CallGraph.cpp.


Member Data Documentation

FunctionMapTy llvm::CallGraph::FunctionMap [protected]

Definition at line 72 of file CallGraph.h.

Referenced by begin(), changeFunction(), destroy(), end(), getOrInsertFunction(), operator[](), and removeFunctionFromModule().

Module* llvm::CallGraph::Mod [protected]

Definition at line 69 of file CallGraph.h.

Referenced by getModule(), getOrInsertFunction(), initialize(), and removeFunctionFromModule().


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