llvm.org GIT mirror llvm / 75caee2
add a new CallGraphNode::removeCallEdgeFor method, tidy some comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49617 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 12 years ago
2 changed file(s) with 24 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
102102 return I->second;
103103 }
104104
105 //Returns the CallGraphNode which is used to represent undetermined calls
106 // into the callgraph. Override this if you want behavioural inheritance.
105 /// Returns the CallGraphNode which is used to represent undetermined calls
106 /// into the callgraph. Override this if you want behavioral inheritance.
107107 virtual CallGraphNode* getExternalCallingNode() const { return 0; }
108108
109 //Return the root/main method in the module, or some other root node, such
110 // as the externalcallingnode. Overload these if you behavioural
111 // inheritance.
109 /// Return the root/main method in the module, or some other root node, such
110 /// as the externalcallingnode. Overload these if you behavioral
111 /// inheritance.
112112 virtual CallGraphNode* getRoot() { return 0; }
113113 virtual const CallGraphNode* getRoot() const { return 0; }
114114
226226 /// used sparingly.
227227 void removeCallEdgeTo(CallGraphNode *Callee);
228228
229 /// removeCallEdgeFor - This method removes the edge in the node for the
230 /// specified call site. Note that this method takes linear time, so it
231 /// should be used sparingly.
232 void removeCallEdgeFor(CallSite CS);
233
229234 /// removeAnyCallEdgeTo - This method removes any call edges from this node to
230235 /// the specified callee function. This takes more time to execute than
231236 /// removeCallEdgeTo, so it should not be used unless necessary.
292292 }
293293 }
294294
295 /// removeCallEdgeFor - This method removes the edge in the node for the
296 /// specified call site. Note that this method takes linear time, so it
297 /// should be used sparingly.
298 void CallGraphNode::removeCallEdgeFor(CallSite CS) {
299 for (unsigned i = CalledFunctions.size(); ; --i) {
300 assert(i && "Cannot find callee to remove!");
301 if (CalledFunctions[i-1].first == CS) {
302 CalledFunctions.erase(CalledFunctions.begin()+i-1);
303 return;
304 }
305 }
306 }
307
308
295309 // removeAnyCallEdgeTo - This method removes any call edges from this node to
296310 // the specified callee function. This takes more time to execute than
297311 // removeCallEdgeTo, so it should not be used unless necessary.