Allow clients to specify the inline threshold when creating
authorChris Lattner <sabre@nondot.org>
Sat, 12 Jan 2008 06:49:13 +0000 (06:49 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 12 Jan 2008 06:49:13 +0000 (06:49 +0000)
the inliner pass.  Patch by Robert Zeh.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45903 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Transforms/IPO.h
include/llvm/Transforms/IPO/InlinerPass.h
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/IPO/Inliner.cpp

index c527cb51736c71e481836ff4592aed690e1731e9..e7590ac019b2aa944a715f488a4cdfb5e85ccd12 100644 (file)
@@ -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
index b2b772cf0a7cb91a50f9130f6513771a9df4abe3..26cf4e44a26548e7f3bfd7f80e0453cf32c88338 100644 (file)
@@ -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
index d72edf84805ee0707f441ad504f95314823c7cc0..fe0ea5a4e89e8cee4d49fac90f6547d09e433135 100644 (file)
@@ -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) {
index ca8eec48b4a7b75e7a9ab741f057fae0de537c73..7ad7dc4c6ae57b7bad8f315e18ce4934a450d17c 100644 (file)
@@ -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.