[llvm-commits] [llvm] r49617 - in /llvm/trunk: include/llvm/Analysis/CallGraph.h lib/Analysis/IPA/CallGraph.cpp
Chris Lattner
sabre at nondot.org
Sun Apr 13 12:41:25 PDT 2008
Author: lattner
Date: Sun Apr 13 14:41:25 2008
New Revision: 49617
URL: http://llvm.org/viewvc/llvm-project?rev=49617&view=rev
Log:
add a new CallGraphNode::removeCallEdgeFor method, tidy some comments.
Modified:
llvm/trunk/include/llvm/Analysis/CallGraph.h
llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=49617&r1=49616&r2=49617&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Sun Apr 13 14:41:25 2008
@@ -103,13 +103,13 @@
return I->second;
}
- //Returns the CallGraphNode which is used to represent undetermined calls
- // into the callgraph. Override this if you want behavioural inheritance.
+ /// Returns the CallGraphNode which is used to represent undetermined calls
+ /// into the callgraph. Override this if you want behavioral inheritance.
virtual CallGraphNode* getExternalCallingNode() const { return 0; }
- //Return the root/main method in the module, or some other root node, such
- // as the externalcallingnode. Overload these if you behavioural
- // inheritance.
+ /// Return the root/main method in the module, or some other root node, such
+ /// as the externalcallingnode. Overload these if you behavioral
+ /// inheritance.
virtual CallGraphNode* getRoot() { return 0; }
virtual const CallGraphNode* getRoot() const { return 0; }
@@ -227,6 +227,11 @@
/// used sparingly.
void removeCallEdgeTo(CallGraphNode *Callee);
+ /// 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.
+ void removeCallEdgeFor(CallSite CS);
+
/// removeAnyCallEdgeTo - This method removes any 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.
Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=49617&r1=49616&r2=49617&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Sun Apr 13 14:41:25 2008
@@ -293,6 +293,20 @@
}
}
+/// 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.
+void CallGraphNode::removeCallEdgeFor(CallSite CS) {
+ for (unsigned i = CalledFunctions.size(); ; --i) {
+ assert(i && "Cannot find callee to remove!");
+ if (CalledFunctions[i-1].first == CS) {
+ CalledFunctions.erase(CalledFunctions.begin()+i-1);
+ return;
+ }
+ }
+}
+
+
// removeAnyCallEdgeTo - This method removes any 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.
More information about the llvm-commits
mailing list