From f200a0af58871778b3e8b727d7534aa82a6ca37f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 22 May 2011 00:20:07 +0000 Subject: [PATCH] switch bugpoint and liblto to PassManagerBuilder. llvm-svn: 131821 --- llvm/tools/bugpoint/bugpoint.cpp | 22 ++++++++++------------ llvm/tools/lto/LTOCodeGenerator.cpp | 14 ++++++-------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp index f9c9e18099ef..efacd6ae75cd 100644 --- a/llvm/tools/bugpoint/bugpoint.cpp +++ b/llvm/tools/bugpoint/bugpoint.cpp @@ -22,7 +22,7 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PluginLoader.h" #include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/StandardPasses.h" +#include "llvm/Support/PassManagerBuilder.h" #include "llvm/Support/Process.h" #include "llvm/Support/Signals.h" #include "llvm/Support/Valgrind.h" @@ -146,19 +146,17 @@ int main(int argc, char **argv) { AddToDriver PM(D); if (StandardCompileOpts) { - createStandardModulePasses(&PM, 3, - /*OptimizeSize=*/ false, - /*UnitAtATime=*/ true, - /*UnrollLoops=*/ true, - /*SimplifyLibCalls=*/ true, - /*HaveExceptions=*/ true, - createFunctionInliningPass()); + PassManagerBuilder Builder; + Builder.OptLevel = 3; + Builder.Inliner = createFunctionInliningPass(); + Builder.populateModulePassManager(PM); } - if (StandardLinkOpts) - createStandardLTOPasses(&PM, /*Internalize=*/true, - /*RunInliner=*/true, - /*VerifyEach=*/false); + if (StandardLinkOpts) { + PassManagerBuilder Builder; + Builder.populateLTOPassManager(PM, /*Internalize=*/true, + /*RunInliner=*/true); + } for (std::vector::iterator I = PassList.begin(), diff --git a/llvm/tools/lto/LTOCodeGenerator.cpp b/llvm/tools/lto/LTOCodeGenerator.cpp index d95f35405b25..3abd64136573 100644 --- a/llvm/tools/lto/LTOCodeGenerator.cpp +++ b/llvm/tools/lto/LTOCodeGenerator.cpp @@ -14,7 +14,6 @@ #include "LTOModule.h" #include "LTOCodeGenerator.h" - #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Linker.h" @@ -37,7 +36,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/StandardPasses.h" +#include "llvm/Support/PassManagerBuilder.h" #include "llvm/Support/SystemUtils.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/Host.h" @@ -355,9 +354,8 @@ void LTOCodeGenerator::applyScopeRestrictions() { } /// Optimize merged modules using various IPO passes -bool LTOCodeGenerator::generateObjectFile(raw_ostream& out, - std::string& errMsg) -{ +bool LTOCodeGenerator::generateObjectFile(raw_ostream &out, + std::string &errMsg) { if ( this->determineTarget(errMsg) ) return true; @@ -380,13 +378,13 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream& out, // Add an appropriate TargetData instance for this module... passes.add(new TargetData(*_target->getTargetData())); - createStandardLTOPasses(&passes, /*Internalize=*/ false, !DisableInline, - /*VerifyEach=*/ false); + PassManagerBuilder().populateLTOPassManager(passes, /*Internalize=*/ false, + !DisableInline); // Make sure everything is still good. passes.add(createVerifierPass()); - FunctionPassManager* codeGenPasses = new FunctionPassManager(mergedModule); + FunctionPassManager *codeGenPasses = new FunctionPassManager(mergedModule); codeGenPasses->add(new TargetData(*_target->getTargetData()));