[llvm] [NewPM/CodeGen] Rewrite pass manager nesting (PR #81068)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 18:55:42 PST 2024
================
@@ -182,49 +147,53 @@ int llvm::compileModuleWithNewPM(
return 1;
}
- ExitOnErr(PB.parsePassPipeline(MFPM, PassPipeline));
+ ExitOnErr(PB.parsePassPipeline(MPM, PassPipeline));
MPM.addPass(PrintMIRPreparePass(*OS));
+ MachineFunctionPassManager MFPM;
MFPM.addPass(PrintMIRPass(*OS));
MFPM.addPass(FreeMachineFunctionPass());
+ MPM.addPass(createModuleToMachineFunctionPassAdaptor(std::move(MFPM)));
- auto &MMI = MFAM.getResult<MachineModuleAnalysis>(*M).getMMI();
if (MIR->parseMachineFunctions(*M, MMI))
return 1;
} else {
- ExitOnErr(LLVMTM.buildCodeGenPipeline(MPM, MFPM, MFAM, *OS,
- DwoOut ? &DwoOut->os() : nullptr,
- FileType, Opt, &PIC));
+ ExitOnErr(LLVMTM.buildCodeGenPipeline(
+ MPM, *OS, DwoOut ? &DwoOut->os() : nullptr, FileType, Opt, &PIC));
auto StartStopInfo = TargetPassConfig::getStartStopInfo(PIC);
assert(StartStopInfo && "Expect StartStopInfo!");
if (auto StopPassName = StartStopInfo->StopPass; !StopPassName.empty()) {
- MFPM.addPass(PrintMIRPass(*OS));
- MFPM.addPass(FreeMachineFunctionPass());
+ MPM.addPass(createModuleToMachineFunctionPassAdaptor(PrintMIRPass(*OS)));
----------------
paperchalice wrote:
Could we move this part to CodeGenPassBuilder? Thus we can print the complete MIR.
https://github.com/llvm/llvm-project/pull/81068
More information about the llvm-commits
mailing list