Doxygen-ify the comments on the public interface for BPI. Also, move the
[oota-llvm.git] / include / llvm / Analysis / CallGraph.h
index a4884edd5bd6b42328d3e5be2bce938ec01026ff..fb77da7b69ea4e77912e2e056513a643784c75a7 100644 (file)
@@ -57,7 +57,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/ValueHandle.h"
-#include "llvm/System/IncludeFile.h"
+#include "llvm/Support/IncludeFile.h"
 #include <map>
 
 namespace llvm {
@@ -138,6 +138,13 @@ public:
   /// not already exist.
   CallGraphNode *getOrInsertFunction(const Function *F);
 
+  /// spliceFunction - Replace the function represented by this node by another.
+  /// This does not rescan the body of the function, so it is suitable when
+  /// splicing the body of one function to another while also updating all
+  /// callers from the old function to the new.
+  ///
+  void spliceFunction(const Function *From, const Function *To);
+
   //===---------------------------------------------------------------------
   // Pass infrastructure interface glue code.
   //
@@ -163,8 +170,10 @@ protected:
 // CallGraphNode class definition.
 //
 class CallGraphNode {
-  AssertingVH<Function> F;
+  friend class CallGraph;
   
+  AssertingVH<Function> F;
+
   // CallRecord - This is a pair of the calling instruction (a call or invoke)
   // and the callgraph node being called.
 public:
@@ -250,6 +259,9 @@ public:
   /// addCalledFunction - Add a function to the list of functions called by this
   /// one.
   void addCalledFunction(CallSite CS, CallGraphNode *M) {
+    assert(!CS.getInstruction() ||
+           !CS.getCalledFunction() ||
+           !CS.getCalledFunction()->isIntrinsic());
     CalledFunctions.push_back(std::make_pair(CS.getInstruction(), M));
     M->AddRef();
   }