LLVM API Documentation

Public Types | Public Member Functions | Friends
llvm::CallGraphNode Class Reference

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

#include <CallGraph.h>

List of all members.

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.
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.
 ~CallGraphNode ()
FunctiongetFunction () const
 Returns the function that this call graph node represents.
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.
CallGraphNodeoperator[] (unsigned i) const
 Returns the i'th called function.
void dump () const
 Print out this call graph node.
void print (raw_ostream &OS) const
void removeAllCalledFunctions ()
 Removes all edges from this CallGraphNode to any functions it calls.
void stealCalledFunctionsFrom (CallGraphNode *N)
 Moves all the callee information from N to this node.
void addCalledFunction (CallSite CS, CallGraphNode *M)
 Adds a function to the list of functions called by this one.
void removeCallEdge (iterator I)
void removeCallEdgeFor (CallSite CS)
 Removes the edge in the node for the specified call site.
void removeAnyCallEdgeTo (CallGraphNode *Callee)
 Removes all call edges from this node to the specified callee function.
void removeOneAbstractEdgeTo (CallGraphNode *Callee)
 Removes one edge associated with a null callsite from this node to the specified callee function.
void replaceCallEdge (CallSite CS, CallSite NewCS, CallGraphNode *NewNode)
 Replaces the edge in the node for the specified call site with a new one.

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 165 of file CallGraph.h.


Member Typedef Documentation

Definition at line 172 of file CallGraph.h.

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

Definition at line 169 of file CallGraph.h.

Definition at line 182 of file CallGraph.h.

Definition at line 181 of file CallGraph.h.


Constructor & Destructor Documentation

Creates a node for the specified function.

Definition at line 175 of file CallGraph.h.

Definition at line 177 of file CallGraph.h.


Member Function Documentation

Definition at line 189 of file CallGraph.h.

void CallGraphNode::dump ( ) const

Print out this call graph node.

Definition at line 176 of file CallGraph.cpp.

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

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

Definition at line 191 of file CallGraph.h.

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

Definition at line 190 of file CallGraph.h.

Returns the function that this call graph node represents.

Definition at line 185 of file CallGraph.h.

Referenced by llvm::DOTGraphTraits< CallGraph * >::getNodeLabel(), llvm::CallGraph::print(), print(), llvm::Inliner::removeDeadFunctions(), and llvm::CallGraph::removeFunctionFromModule().

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

Definition at line 196 of file CallGraph.h.

Referenced by print().

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

Returns the i'th called function.

Definition at line 199 of file CallGraph.h.

void CallGraphNode::print ( raw_ostream OS) const

Definition at line 157 of file CallGraph.cpp.

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

Referenced by dump().

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

Definition at line 215 of file CallGraph.h.

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

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

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

Definition at line 237 of file CallGraph.h.

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

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

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

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

Referenced by UpdateCallGraphAfterInlining().

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

References I.

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

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.

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

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

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

Definition at line 192 of file CallGraph.h.

Moves all the callee information from N to this node.

Definition at line 223 of file CallGraph.h.

References std::swap().


Friends And Related Function Documentation

friend class CallGraph [friend]

Definition at line 266 of file CallGraph.h.


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