[llvm-commits] CVS: llvm/lib/Analysis/IPA/CallGraph.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Sep 17 17:22:26 PDT 2004



Changes in directory llvm/lib/Analysis/IPA:

CallGraph.cpp updated: 1.41 -> 1.42
---
Log message:

Implement new changeFunction method, nuke a never implemented one.


---
Diffs of the changes:  (+14 -8)

Index: llvm/lib/Analysis/IPA/CallGraph.cpp
diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.41 llvm/lib/Analysis/IPA/CallGraph.cpp:1.42
--- llvm/lib/Analysis/IPA/CallGraph.cpp:1.41	Wed Sep  1 17:55:35 2004
+++ llvm/lib/Analysis/IPA/CallGraph.cpp	Fri Sep 17 19:22:13 2004
@@ -163,14 +163,6 @@
 // Implementations of public modification methods
 //
 
-// Functions to keep a call graph up to date with a function that has been
-// modified
-//
-void CallGraph::addFunctionToModule(Function *F) {
-  assert(0 && "not implemented");
-  abort();
-}
-
 // removeFunctionFromModule - Unlink the function from this module, returning
 // it.  Because this removes the function from the module, the call graph node
 // is destroyed.  This is only valid if the function does not call any other
@@ -188,6 +180,20 @@
   return F;
 }
 
+// changeFunction - This method changes the function associated with this
+// CallGraphNode, for use by transformations that need to change the prototype
+// of a Function (thus they must create a new Function and move the old code
+// over).
+void CallGraph::changeFunction(Function *OldF, Function *NewF) {
+  iterator I = FunctionMap.find(OldF);
+  CallGraphNode *&New = FunctionMap[NewF];
+  assert(I != FunctionMap.end() && I->second && !New &&
+         "OldF didn't exist in CG or NewF already does!");
+  New = I->second;
+  FunctionMap.erase(I);
+}
+
+
 void CallGraph::stub() {}
 
 void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) {






More information about the llvm-commits mailing list