mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
Make LTO codegen use a PassManager, rather than a FunctionPassManager, for the
codegen passes. This brings it in to line with clang and llc's codegen setup, and tidies up the code. If I understand correctly, adding ModulePasses to a FunctionPassManager is bogus. It only seems to explode if an added ModulePass depends on a FunctionPass though, which might be why this code has survived so long. Fixes <rdar://problem/13386816>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176977 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b91ce4fd9b
commit
a991b254f7
@ -390,14 +390,14 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
|||||||
// Make sure everything is still good.
|
// Make sure everything is still good.
|
||||||
passes.add(createVerifierPass());
|
passes.add(createVerifierPass());
|
||||||
|
|
||||||
FunctionPassManager *codeGenPasses = new FunctionPassManager(mergedModule);
|
PassManager codeGenPasses;
|
||||||
|
|
||||||
codeGenPasses->add(new DataLayout(*_target->getDataLayout()));
|
codeGenPasses.add(new DataLayout(*_target->getDataLayout()));
|
||||||
_target->addAnalysisPasses(*codeGenPasses);
|
_target->addAnalysisPasses(codeGenPasses);
|
||||||
|
|
||||||
formatted_raw_ostream Out(out);
|
formatted_raw_ostream Out(out);
|
||||||
|
|
||||||
if (_target->addPassesToEmitFile(*codeGenPasses, Out,
|
if (_target->addPassesToEmitFile(codeGenPasses, Out,
|
||||||
TargetMachine::CGFT_ObjectFile)) {
|
TargetMachine::CGFT_ObjectFile)) {
|
||||||
errMsg = "target file type not supported";
|
errMsg = "target file type not supported";
|
||||||
return true;
|
return true;
|
||||||
@ -407,15 +407,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
|||||||
passes.run(*mergedModule);
|
passes.run(*mergedModule);
|
||||||
|
|
||||||
// Run the code generator, and write assembly file
|
// Run the code generator, and write assembly file
|
||||||
codeGenPasses->doInitialization();
|
codeGenPasses.run(*mergedModule);
|
||||||
|
|
||||||
for (Module::iterator
|
|
||||||
it = mergedModule->begin(), e = mergedModule->end(); it != e; ++it)
|
|
||||||
if (!it->isDeclaration())
|
|
||||||
codeGenPasses->run(*it);
|
|
||||||
|
|
||||||
codeGenPasses->doFinalization();
|
|
||||||
delete codeGenPasses;
|
|
||||||
|
|
||||||
return false; // success
|
return false; // success
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user