llvm.org GIT mirror llvm / a991b25
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 Lang Hames 6 years ago
1 changed file(s) with 6 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
389389 // Make sure everything is still good.
390390 passes.add(createVerifierPass());
391391
392 FunctionPassManager *codeGenPasses = new FunctionPassManager(mergedModule);
393
394 codeGenPasses->add(new DataLayout(*_target->getDataLayout()));
395 _target->addAnalysisPasses(*codeGenPasses);
392 PassManager codeGenPasses;
393
394 codeGenPasses.add(new DataLayout(*_target->getDataLayout()));
395 _target->addAnalysisPasses(codeGenPasses);
396396
397397 formatted_raw_ostream Out(out);
398398
399 if (_target->addPassesToEmitFile(*codeGenPasses, Out,
399 if (_target->addPassesToEmitFile(codeGenPasses, Out,
400400 TargetMachine::CGFT_ObjectFile)) {
401401 errMsg = "target file type not supported";
402402 return true;
406406 passes.run(*mergedModule);
407407
408408 // Run the code generator, and write assembly file
409 codeGenPasses->doInitialization();
410
411 for (Module::iterator
412 it = mergedModule->begin(), e = mergedModule->end(); it != e; ++it)
413 if (!it->isDeclaration())
414 codeGenPasses->run(*it);
415
416 codeGenPasses->doFinalization();
417 delete codeGenPasses;
409 codeGenPasses.run(*mergedModule);
418410
419411 return false; // success
420412 }