add a new CallGraphNode::removeCallEdgeFor method, tidy some comments.
authorChris Lattner <sabre@nondot.org>
Sun, 13 Apr 2008 19:41:25 +0000 (19:41 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 13 Apr 2008 19:41:25 +0000 (19:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49617 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/CallGraph.h
lib/Analysis/IPA/CallGraph.cpp

index 6cf33dc2ff8073d8be45dd3298f514654932e8bd..2bb06900abad0d90ca5a97793e4ba588e00cb334 100644 (file)
@@ -103,13 +103,13 @@ public:
     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 @@ public:
   /// 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.
index 5c5418ba250355be89bca32351da48851f0aaeb0..f0dd1880ff4e171667870dbe8b521cafb9b1f9cb 100644 (file)
@@ -293,6 +293,20 @@ void CallGraphNode::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 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.