mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-02 15:51:54 +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>. llvm-svn: 176977
This commit is contained in:
parent
d3b3578c23
commit
b503b08daa
@ -390,14 +390,14 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
||||
// Make sure everything is still good.
|
||||
passes.add(createVerifierPass());
|
||||
|
||||
FunctionPassManager *codeGenPasses = new FunctionPassManager(mergedModule);
|
||||
PassManager codeGenPasses;
|
||||
|
||||
codeGenPasses->add(new DataLayout(*_target->getDataLayout()));
|
||||
_target->addAnalysisPasses(*codeGenPasses);
|
||||
codeGenPasses.add(new DataLayout(*_target->getDataLayout()));
|
||||
_target->addAnalysisPasses(codeGenPasses);
|
||||
|
||||
formatted_raw_ostream Out(out);
|
||||
|
||||
if (_target->addPassesToEmitFile(*codeGenPasses, Out,
|
||||
if (_target->addPassesToEmitFile(codeGenPasses, Out,
|
||||
TargetMachine::CGFT_ObjectFile)) {
|
||||
errMsg = "target file type not supported";
|
||||
return true;
|
||||
@ -407,15 +407,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
||||
passes.run(*mergedModule);
|
||||
|
||||
// Run the code generator, and write assembly file
|
||||
codeGenPasses->doInitialization();
|
||||
|
||||
for (Module::iterator
|
||||
it = mergedModule->begin(), e = mergedModule->end(); it != e; ++it)
|
||||
if (!it->isDeclaration())
|
||||
codeGenPasses->run(*it);
|
||||
|
||||
codeGenPasses->doFinalization();
|
||||
delete codeGenPasses;
|
||||
codeGenPasses.run(*mergedModule);
|
||||
|
||||
return false; // success
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user