LLVM  4.0.0
Public Types | Public Member Functions | Friends | List of all members
llvm::CallGraphNode Class Reference

A node in the call graph for a module. More...

#include <CallGraph.h>

Public Types

typedef std::pair< WeakVH,
CallGraphNode * > 
CallRecord
 A pair of the calling instruction (a call or invoke) and the call graph node being called. More...
 
typedef std::vector< CallRecordCalledFunctionsVector
 
typedef std::vector
< CallRecord >::iterator 
iterator
 
typedef std::vector
< CallRecord >::const_iterator 
const_iterator
 

Public Member Functions

 CallGraphNode (Function *F)
 Creates a node for the specified function. More...
 
 ~CallGraphNode ()
 
FunctiongetFunction () const
 Returns the function that this call graph node represents. More...
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
bool empty () const
 
unsigned size () const
 
unsigned getNumReferences () const
 Returns the number of other CallGraphNodes in this CallGraph that reference this node in their callee list. More...
 
CallGraphNodeoperator[] (unsigned i) const
 Returns the i'th called function. More...
 
void dump () const
 Print out this call graph node. More...
 
void print (raw_ostream &OS) const
 
void removeAllCalledFunctions ()
 Removes all edges from this CallGraphNode to any functions it calls. More...
 
void stealCalledFunctionsFrom (CallGraphNode *N)
 Moves all the callee information from N to this node. More...
 
void addCalledFunction (CallSite CS, CallGraphNode *M)
 Adds a function to the list of functions called by this one. More...
 
void removeCallEdge (iterator I)
 
void removeCallEdgeFor (CallSite CS)
 Removes the edge in the node for the specified call site. More...
 
void removeAnyCallEdgeTo (CallGraphNode *Callee)
 Removes all call edges from this node to the specified callee function. More...
 
void removeOneAbstractEdgeTo (CallGraphNode *Callee)
 Removes one edge associated with a null callsite from this node to the specified callee function. More...
 
void replaceCallEdge (CallSite CS, CallSite NewCS, CallGraphNode *NewNode)
 Replaces the edge in the node for the specified call site with a new one. More...
 

Friends

class CallGraph
 

Detailed Description

A node in the call graph for a module.

Typically represents a function in the call graph. There are also special "null" nodes used to represent theoretical entries in the call graph.

Definition at line 171 of file CallGraph.h.

Member Typedef Documentation

Definition at line 178 of file CallGraph.h.

A pair of the calling instruction (a call or invoke) and the call graph node being called.

Definition at line 175 of file CallGraph.h.

Definition at line 188 of file CallGraph.h.

Definition at line 187 of file CallGraph.h.

Constructor & Destructor Documentation

llvm::CallGraphNode::CallGraphNode ( Function F)
inline

Creates a node for the specified function.

Definition at line 181 of file CallGraph.h.

llvm::CallGraphNode::~CallGraphNode ( )
inline

Definition at line 183 of file CallGraph.h.

References assert().

Member Function Documentation

void llvm::CallGraphNode::addCalledFunction ( CallSite  CS,
CallGraphNode M 
)
inline
iterator llvm::CallGraphNode::begin ( )
inline
const_iterator llvm::CallGraphNode::begin ( ) const
inline

Definition at line 195 of file CallGraph.h.

LLVM_DUMP_METHOD void CallGraphNode::dump ( ) const

Print out this call graph node.

Definition at line 198 of file CallGraph.cpp.

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

bool llvm::CallGraphNode::empty ( ) const
inline

Definition at line 197 of file CallGraph.h.

Referenced by llvm::CallGraph::removeFunctionFromModule().

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

Definition at line 196 of file CallGraph.h.

Function* llvm::CallGraphNode::getFunction ( ) const
inline
unsigned llvm::CallGraphNode::getNumReferences ( ) const
inline

Returns the number of other CallGraphNodes in this CallGraph that reference this node in their callee list.

Definition at line 202 of file CallGraph.h.

Referenced by DoPromotion(), and print().

CallGraphNode* llvm::CallGraphNode::operator[] ( unsigned  i) const
inline

Returns the i'th called function.

Definition at line 205 of file CallGraph.h.

References assert(), and i.

void CallGraphNode::print ( raw_ostream OS) const

Definition at line 179 of file CallGraph.cpp.

References getFunction(), and getNumReferences().

Referenced by dump().

void llvm::CallGraphNode::removeAllCalledFunctions ( )
inline

Removes all edges from this CallGraphNode to any functions it calls.

Definition at line 221 of file CallGraph.h.

void CallGraphNode::removeAnyCallEdgeTo ( CallGraphNode Callee)

Removes all call edges from this node to the specified callee function.

This takes more time to execute than removeCallEdgeTo, so it should not be used unless necessary.

Definition at line 218 of file CallGraph.cpp.

References i.

Referenced by llvm::LegacyInlinerBase::removeDeadFunctions().

void llvm::CallGraphNode::removeCallEdge ( iterator  I)
inline

Definition at line 244 of file CallGraph.h.

void CallGraphNode::removeCallEdgeFor ( CallSite  CS)

Removes the edge in the node for the specified call site.

removeCallEdgeFor - This method removes the edge in the node for the specified call site.

Note that this method takes linear time, so it should be used sparingly.

Definition at line 203 of file CallGraph.cpp.

References assert(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), and I.

Referenced by DeleteBasicBlock(), and UpdateCallGraphAfterInlining().

void CallGraphNode::removeOneAbstractEdgeTo ( CallGraphNode Callee)

Removes one edge associated with a null callsite from this node to the specified callee function.

removeOneAbstractEdgeTo - Remove one edge associated with a null callsite from this node to the specified callee function.

Definition at line 230 of file CallGraph.cpp.

References assert(), and I.

Referenced by llvm::InternalizePass::internalizeModule().

void CallGraphNode::replaceCallEdge ( CallSite  CS,
CallSite  NewCS,
CallGraphNode NewNode 
)

Replaces the edge in the node for the specified call site with a new one.

replaceCallEdge - This method replaces the edge in the node for the specified call site with a new one.

Note that this method takes linear time, so it should be used sparingly.

Definition at line 246 of file CallGraph.cpp.

References assert(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), and I.

Referenced by DoPromotion().

unsigned llvm::CallGraphNode::size ( ) const
inline

Definition at line 198 of file CallGraph.h.

void llvm::CallGraphNode::stealCalledFunctionsFrom ( CallGraphNode N)
inline

Moves all the callee information from N to this node.

Definition at line 229 of file CallGraph.h.

References assert(), and std::swap().

Referenced by DoPromotion().

Friends And Related Function Documentation

friend class CallGraph
friend

Definition at line 273 of file CallGraph.h.


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