summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-12 06:49:13 +0000
committerChris Lattner <sabre@nondot.org>2008-01-12 06:49:13 +0000
commit120d053e3ba810b44047fbcb719824bed5673ca9 (patch)
treed6faed5fff16ad6f2b84b013962451e628c22b6b
parentd3f6a8a8f05844753fab3d7c896a373603257f5a (diff)
downloadexternal_llvm-120d053e3ba810b44047fbcb719824bed5673ca9.zip
external_llvm-120d053e3ba810b44047fbcb719824bed5673ca9.tar.gz
external_llvm-120d053e3ba810b44047fbcb719824bed5673ca9.tar.bz2
Allow clients to specify the inline threshold when creating
the inliner pass. Patch by Robert Zeh. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45903 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Transforms/IPO.h1
-rw-r--r--include/llvm/Transforms/IPO/InlinerPass.h1
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp5
-rw-r--r--lib/Transforms/IPO/Inliner.cpp3
4 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Transforms/IPO.h b/include/llvm/Transforms/IPO.h
index c527cb5..e7590ac 100644
--- a/include/llvm/Transforms/IPO.h
+++ b/include/llvm/Transforms/IPO.h
@@ -91,6 +91,7 @@ ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false,
/// to inline direct function calls to small functions.
///
Pass *createFunctionInliningPass();
+Pass *createFunctionInliningPass(int Threshold);
//===----------------------------------------------------------------------===//
/// createPruneEHPass - Return a new pass object which transforms invoke
diff --git a/include/llvm/Transforms/IPO/InlinerPass.h b/include/llvm/Transforms/IPO/InlinerPass.h
index b2b772c..26cf4e4 100644
--- a/include/llvm/Transforms/IPO/InlinerPass.h
+++ b/include/llvm/Transforms/IPO/InlinerPass.h
@@ -27,6 +27,7 @@ namespace llvm {
///
struct Inliner : public CallGraphSCCPass {
explicit Inliner(const void *ID);
+ explicit Inliner(const void *ID, int Threshold);
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index d72edf8..fe0ea5a 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -35,6 +35,7 @@ namespace {
InlineCostAnalyzer CA;
public:
SimpleInliner() : Inliner(&ID) {}
+ SimpleInliner(int Threshold) : Inliner(&ID, Threshold) {}
static char ID; // Pass identification, replacement for typeid
int getInlineCost(CallSite CS) {
return CA.getInlineCost(CS, NeverInline);
@@ -47,6 +48,10 @@ namespace {
Pass *llvm::createFunctionInliningPass() { return new SimpleInliner(); }
+Pass *llvm::createFunctionInliningPass(int Threshold) {
+ return new SimpleInliner(Threshold);
+}
+
// doInitialization - Initializes the vector of functions that have been
// annotated with the noinline attribute.
bool SimpleInliner::doInitialization(CallGraph &CG) {
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index ca8eec4..7ad7dc4 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -39,6 +39,9 @@ namespace {
Inliner::Inliner(const void *ID)
: CallGraphSCCPass((intptr_t)ID), InlineThreshold(InlineLimit) {}
+Inliner::Inliner(const void *ID, int Threshold)
+ : CallGraphSCCPass((intptr_t)ID), InlineThreshold(Threshold) {}
+
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
/// always explicitly call the implementation here.