switch bugpoint and liblto to PassManagerBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131821 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2011-05-22 00:20:07 +00:00
parent 92a9cb6594
commit 817a01ffb2
2 changed files with 16 additions and 20 deletions

View File

@ -22,7 +22,7 @@
#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PluginLoader.h" #include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/StandardPasses.h" #include "llvm/Support/PassManagerBuilder.h"
#include "llvm/Support/Process.h" #include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h" #include "llvm/Support/Signals.h"
#include "llvm/Support/Valgrind.h" #include "llvm/Support/Valgrind.h"
@ -146,19 +146,17 @@ int main(int argc, char **argv) {
AddToDriver PM(D); AddToDriver PM(D);
if (StandardCompileOpts) { if (StandardCompileOpts) {
createStandardModulePasses(&PM, 3, PassManagerBuilder Builder;
/*OptimizeSize=*/ false, Builder.OptLevel = 3;
/*UnitAtATime=*/ true, Builder.Inliner = createFunctionInliningPass();
/*UnrollLoops=*/ true, Builder.populateModulePassManager(PM);
/*SimplifyLibCalls=*/ true,
/*HaveExceptions=*/ true,
createFunctionInliningPass());
} }
if (StandardLinkOpts) if (StandardLinkOpts) {
createStandardLTOPasses(&PM, /*Internalize=*/true, PassManagerBuilder Builder;
/*RunInliner=*/true, Builder.populateLTOPassManager(PM, /*Internalize=*/true,
/*VerifyEach=*/false); /*RunInliner=*/true);
}
for (std::vector<const PassInfo*>::iterator I = PassList.begin(), for (std::vector<const PassInfo*>::iterator I = PassList.begin(),

View File

@ -14,7 +14,6 @@
#include "LTOModule.h" #include "LTOModule.h"
#include "LTOCodeGenerator.h" #include "LTOCodeGenerator.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#include "llvm/Linker.h" #include "llvm/Linker.h"
@ -37,7 +36,7 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormattedStream.h" #include "llvm/Support/FormattedStream.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/StandardPasses.h" #include "llvm/Support/PassManagerBuilder.h"
#include "llvm/Support/SystemUtils.h" #include "llvm/Support/SystemUtils.h"
#include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/Host.h" #include "llvm/Support/Host.h"
@ -355,9 +354,8 @@ void LTOCodeGenerator::applyScopeRestrictions() {
} }
/// Optimize merged modules using various IPO passes /// Optimize merged modules using various IPO passes
bool LTOCodeGenerator::generateObjectFile(raw_ostream& out, bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
std::string& errMsg) std::string &errMsg) {
{
if ( this->determineTarget(errMsg) ) if ( this->determineTarget(errMsg) )
return true; return true;
@ -380,13 +378,13 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream& out,
// Add an appropriate TargetData instance for this module... // Add an appropriate TargetData instance for this module...
passes.add(new TargetData(*_target->getTargetData())); passes.add(new TargetData(*_target->getTargetData()));
createStandardLTOPasses(&passes, /*Internalize=*/ false, !DisableInline, PassManagerBuilder().populateLTOPassManager(passes, /*Internalize=*/ false,
/*VerifyEach=*/ false); !DisableInline);
// Make sure everything is still good. // Make sure everything is still good.
passes.add(createVerifierPass()); passes.add(createVerifierPass());
FunctionPassManager* codeGenPasses = new FunctionPassManager(mergedModule); FunctionPassManager *codeGenPasses = new FunctionPassManager(mergedModule);
codeGenPasses->add(new TargetData(*_target->getTargetData())); codeGenPasses->add(new TargetData(*_target->getTargetData()));