[llvm-branch-commits] [NewPM][X86] Port AsmPrinter to NewPM (PR #182797)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Feb 22 20:14:12 PST 2026


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/182797

This patch makes AsmPrinter work with the NewPM. We essentially create
three new passes that wrap different parts of AsmPrinter so that we can
separate out doIntialization/doFinalization without needing to
materialize all MachineFunctions at the same time. This has two main
drawbacks for now:

1. We do not transfer any state between the three new AsmPrinter passes.
   This means that debuginfo/CFI currently does not work. This will be
   fixed in future passes by moving this state to MachineModuleInfo.
2. We probably incur some overhead by needing to setup up analysis
   callbacks for every MF rather than just per module. This should not
   be large, and can be optimized in the future on top of this if
   needed.
3. This solution is not really clean. However, a lot of cleanup is going
   to be difficult to do while supporting two pass managers. Once we
   remove LegacyPM support, we can make the code much cleaner and better
   enforce invariants like a lack of state between
   doInitialization/runOnMachineFunction/doFinalization.





More information about the llvm-branch-commits mailing list