Implement new changeFunction method, nuke a never implemented one.

Add comments and doxygenify others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16387 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2004-09-18 00:22:43 +00:00
parent 6f7e5ebb42
commit ff8c495386

View File

@@ -124,22 +124,25 @@ public:
//===--------------------------------------------------------------------- //===---------------------------------------------------------------------
// Functions to keep a call graph up to date with a function that has been // Functions to keep a call graph up to date with a function that has been
// modified // modified.
// //
void addFunctionToModule(Function *F);
/// removeFunctionFromModule - Unlink the function from this module, returning
// removeFunctionFromModule - Unlink the function from this module, returning /// it. Because this removes the function from the module, the call graph
// it. Because this removes the function from the module, the call graph node /// node is destroyed. This is only valid if the function does not call any
// is destroyed. This is only valid if the function does not call any other /// other functions (ie, there are no edges in it's CGN). The easiest way to
// functions (ie, there are no edges in it's CGN). The easiest way to do this /// do this is to dropAllReferences before calling this.
// is to dropAllReferences before calling this. ///
//
Function *removeFunctionFromModule(CallGraphNode *CGN); Function *removeFunctionFromModule(CallGraphNode *CGN);
Function *removeFunctionFromModule(Function *F) { Function *removeFunctionFromModule(Function *F) {
return removeFunctionFromModule((*this)[F]); return removeFunctionFromModule((*this)[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 changeFunction(Function *OldF, Function *NewF);
//===--------------------------------------------------------------------- //===---------------------------------------------------------------------
// Pass infrastructure interface glue code... // Pass infrastructure interface glue code...
@@ -231,16 +234,21 @@ public:
// modified // modified
// //
/// removeAllCalledFunctions - As the name implies, this removes all edges
/// from this CallGraphNode to any functions it calls.
void removeAllCalledFunctions() { void removeAllCalledFunctions() {
CalledFunctions.clear(); CalledFunctions.clear();
} }
// addCalledFunction add a function to the list of functions called by this /// addCalledFunction add a function to the list of functions called by this
// one /// one.
void addCalledFunction(CallGraphNode *M) { void addCalledFunction(CallGraphNode *M) {
CalledFunctions.push_back(M); CalledFunctions.push_back(M);
} }
/// removeCallEdgeTo - This method removes a *single* edge to the specified
/// callee function. Note that this method takes linear time, so it should be
/// used sparingly.
void removeCallEdgeTo(CallGraphNode *Callee); void removeCallEdgeTo(CallGraphNode *Callee);
private: // Stuff to construct the node, used by CallGraph private: // Stuff to construct the node, used by CallGraph