diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-21 20:03:44 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-21 20:03:44 +0000 |
commit | 7cebf36a9586f11a02077059c37701f7c020f573 (patch) | |
tree | d14f5ce12832e4a03f75ffa28714cfbd2c7693c7 /llvm/lib/LTO | |
parent | b245ecac79459de6db2d1443190a1e67eac56fff (diff) | |
download | bcm5719-llvm-7cebf36a9586f11a02077059c37701f7c020f573.tar.gz bcm5719-llvm-7cebf36a9586f11a02077059c37701f7c020f573.zip |
Move some logic to populateLTOPassManager.
This will avoid code duplication in the next commit which calls it directly
from the gold plugin.
llvm-svn: 216211
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r-- | llvm/lib/LTO/LTOCodeGenerator.cpp | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 80aa48e0fbc..34cd79c2a6e 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -458,32 +458,21 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out, // Instantiate the pass manager to organize the passes. PassManager passes; - // Start off with a verification pass. - passes.add(createVerifierPass()); - passes.add(createDebugInfoVerifierPass()); - // Add an appropriate DataLayout instance for this module... mergedModule->setDataLayout(TargetMach->getSubtargetImpl()->getDataLayout()); - passes.add(new DataLayoutPass(mergedModule)); - - TargetMach->addAnalysisPasses(passes); Triple TargetTriple(TargetMach->getTargetTriple()); - // Enabling internalize here would use its AllButMain variant. It - // keeps only main if it exists and does nothing for libraries. Instead - // we create the pass ourselves with the symbol list provided by the linker. - if (!DisableOpt) { - PassManagerBuilder PMB; - PMB.DisableGVNLoadPRE = DisableGVNLoadPRE; - if (!DisableInline) - PMB.Inliner = createFunctionInliningPass(); - PMB.LibraryInfo = new TargetLibraryInfo(TargetTriple); - PMB.populateLTOPassManager(passes); - } - - // Make sure everything is still good. - passes.add(createVerifierPass()); - passes.add(createDebugInfoVerifierPass()); + PassManagerBuilder PMB; + PMB.DisableGVNLoadPRE = DisableGVNLoadPRE; + if (!DisableInline) + PMB.Inliner = createFunctionInliningPass(); + PMB.LibraryInfo = new TargetLibraryInfo(TargetTriple); + if (DisableOpt) + PMB.OptLevel = 0; + PMB.VerifyInput = true; + PMB.VerifyOutput = true; + + PMB.populateLTOPassManager(passes, TargetMach); PassManager codeGenPasses; |