mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
[PM] Sink the population of the pass manager with target-specific
analyses back into the LTO code generator. The pass manager builder (and the transforms library in general) shouldn't be referencing the target machine at all. This makes the LTO population work like the others -- the data layout and target transform info need to be pre-populated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227576 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -151,7 +151,7 @@ public:
|
|||||||
|
|
||||||
/// populateModulePassManager - This sets up the primary pass manager.
|
/// populateModulePassManager - This sets up the primary pass manager.
|
||||||
void populateModulePassManager(PassManagerBase &MPM);
|
void populateModulePassManager(PassManagerBase &MPM);
|
||||||
void populateLTOPassManager(PassManagerBase &PM, TargetMachine *TM = nullptr);
|
void populateLTOPassManager(PassManagerBase &PM);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers a function for adding a standard set of passes. This should be
|
/// Registers a function for adding a standard set of passes. This should be
|
||||||
|
@ -488,6 +488,9 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
|||||||
// Add an appropriate DataLayout instance for this module...
|
// Add an appropriate DataLayout instance for this module...
|
||||||
mergedModule->setDataLayout(TargetMach->getDataLayout());
|
mergedModule->setDataLayout(TargetMach->getDataLayout());
|
||||||
|
|
||||||
|
passes.add(new DataLayoutPass());
|
||||||
|
TargetMach->addAnalysisPasses(passes);
|
||||||
|
|
||||||
Triple TargetTriple(TargetMach->getTargetTriple());
|
Triple TargetTriple(TargetMach->getTargetTriple());
|
||||||
PassManagerBuilder PMB;
|
PassManagerBuilder PMB;
|
||||||
PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
|
PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
|
||||||
@ -501,7 +504,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
|||||||
PMB.VerifyInput = true;
|
PMB.VerifyInput = true;
|
||||||
PMB.VerifyOutput = true;
|
PMB.VerifyOutput = true;
|
||||||
|
|
||||||
PMB.populateLTOPassManager(passes, TargetMach);
|
PMB.populateLTOPassManager(passes);
|
||||||
|
|
||||||
PassManager codeGenPasses;
|
PassManager codeGenPasses;
|
||||||
|
|
||||||
|
@ -478,13 +478,7 @@ void PassManagerBuilder::addLTOOptimizationPasses(PassManagerBase &PM) {
|
|||||||
PM.add(createMergeFunctionsPass());
|
PM.add(createMergeFunctionsPass());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
|
void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM) {
|
||||||
TargetMachine *TM) {
|
|
||||||
if (TM) {
|
|
||||||
PM.add(new DataLayoutPass());
|
|
||||||
TM->addAnalysisPasses(PM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LibraryInfo)
|
if (LibraryInfo)
|
||||||
PM.add(new TargetLibraryInfoWrapperPass(*LibraryInfo));
|
PM.add(new TargetLibraryInfoWrapperPass(*LibraryInfo));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user