summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/Utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-14 20:05:06 +0000
committerChris Lattner <sabre@nondot.org>2006-01-14 20:05:06 +0000
commit4c2881ecb97ca9306396b74a61a6ce05f2b9a4f4 (patch)
treea8496177acc7efbfbdfd5626dcd726312a044770 /include/llvm/Transforms/Utils
parentc54b1c1f8b7cf7419b2843d54e9da6c8c15e0dd0 (diff)
downloadllvm-4c2881ecb97ca9306396b74a61a6ce05f2b9a4f4.tar.gz
llvm-4c2881ecb97ca9306396b74a61a6ce05f2b9a4f4.tar.bz2
llvm-4c2881ecb97ca9306396b74a61a6ce05f2b9a4f4.tar.xz
Teach inline function how to update the callgraph when it makes changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils')
-rw-r--r--include/llvm/Transforms/Utils/Cloning.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h
index d2dcc3d591..f721ea900d 100644
--- a/include/llvm/Transforms/Utils/Cloning.h
+++ b/include/llvm/Transforms/Utils/Cloning.h
@@ -32,6 +32,7 @@ class InvokeInst;
class ReturnInst;
class CallSite;
class Trace;
+class CallGraph;
/// CloneModule - Return an exact copy of the specified module
///
@@ -136,6 +137,12 @@ void CloneTraceInto(Function *NewFunc, Trace &T,
std::map<const Value*, Value*> &ValueMap,
const char *NameSuffix);
+/// CloneTrace - Returns a copy of the specified trace.
+/// It takes a vector of basic blocks clones the basic blocks, removes internal
+/// phi nodes, adds it to the same function as the original (although there is
+/// no jump to it) and returns the new vector of basic blocks.
+std::vector<BasicBlock *> CloneTrace(const std::vector<BasicBlock*> &origTrace);
+
/// InlineFunction - This function inlines the called function into the basic
/// block of the caller. This returns false if it is not possible to inline
/// this call. The program is still in a well defined state if this occurs
@@ -146,15 +153,12 @@ void CloneTraceInto(Function *NewFunc, Trace &T,
/// exists in the instruction stream. Similiarly this will inline a recursive
/// function by one level.
///
-bool InlineFunction(CallInst *C);
-bool InlineFunction(InvokeInst *II);
-bool InlineFunction(CallSite CS);
-
-/// CloneTrace - Returns a copy of the specified trace.
-/// It takes a vector of basic blocks clones the basic blocks, removes internal
-/// phi nodes, adds it to the same function as the original (although there is
-/// no jump to it) and returns the new vector of basic blocks.
-std::vector<BasicBlock *> CloneTrace(const std::vector<BasicBlock*> &origTrace);
+/// If a non-null callgraph pointer is provided, these functions update the
+/// CallGraph to represent the program after inlining.
+///
+bool InlineFunction(CallInst *C, CallGraph *CG = 0);
+bool InlineFunction(InvokeInst *II, CallGraph *CG = 0);
+bool InlineFunction(CallSite CS, CallGraph *CG = 0);
} // End llvm namespace