[llvm-branch-commits] [AVR] Port AsmPrinter to NewPM (PR #236491)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 28 23:16:18 PDT 2026


================
@@ -343,3 +348,32 @@ extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void
 LLVMInitializeAVRAsmPrinter() {
   llvm::RegisterAsmPrinter<AVRAsmPrinter> X(getTheAVRTarget());
 }
+
+PreservedAnalyses AVRAsmPrinterBeginPass::run(Module &M,
+                                              ModuleAnalysisManager &MAM) {
+  AVRAsmPrinter &AsmPrinter = static_cast<AVRAsmPrinter &>(
+      MAM.getResult<AsmPrinterAnalysis>(M).getPrinter());
+  setupModuleAsmPrinter(M, MAM, AsmPrinter);
+  AsmPrinter.doInitialization(M);
+  return PreservedAnalyses::all();
+}
+
+PreservedAnalyses AVRAsmPrinterPass::run(MachineFunction &MF,
+                                         MachineFunctionAnalysisManager &MFAM) {
+  AVRAsmPrinter &AsmPrinter = static_cast<AVRAsmPrinter &>(
+      MFAM.getResult<ModuleAnalysisManagerMachineFunctionProxy>(MF)
+          .getCachedResult<AsmPrinterAnalysis>(*MF.getFunction().getParent())
----------------
arsenm wrote:

Unchecked getCachedResult? either this should use get result or needs an error case?

https://github.com/llvm/llvm-project/pull/236491


More information about the llvm-branch-commits mailing list