From ff8c4953863cae2f56477e8a11f42ef7a47a4437 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 18 Sep 2004 00:22:43 +0000 Subject: [PATCH] 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 --- include/llvm/Analysis/CallGraph.h | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 2a1f49c83c8..4b4db6bd608 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -124,22 +124,25 @@ public: //===--------------------------------------------------------------------- // 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 - // 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 - // functions (ie, there are no edges in it's CGN). The easiest way to do this - // is to dropAllReferences before calling this. - // + /// 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 functions (ie, there are no edges in it's CGN). The easiest way to + /// do this is to dropAllReferences before calling this. + /// Function *removeFunctionFromModule(CallGraphNode *CGN); Function *removeFunctionFromModule(Function *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... @@ -231,16 +234,21 @@ public: // modified // + /// removeAllCalledFunctions - As the name implies, this removes all edges + /// from this CallGraphNode to any functions it calls. void removeAllCalledFunctions() { CalledFunctions.clear(); } - // addCalledFunction add a function to the list of functions called by this - // one + /// addCalledFunction add a function to the list of functions called by this + /// one. void addCalledFunction(CallGraphNode *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); private: // Stuff to construct the node, used by CallGraph