[llvm] [SPIRV] Migrate NSDI emission from a machine pass to DebugHandlerBase (PR #191212)
Diego Novillo via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 01:15:03 PDT 2026
================
@@ -861,6 +897,13 @@ void SPIRVAsmPrinter::outputModuleSections() {
bool SPIRVAsmPrinter::doInitialization(Module &M) {
ModuleSectionsEmitted = false;
+ // Register the NSDI handler before calling the base class so that
+ // AsmPrinter::doInitialization() calls Handler->beginModule(M) for it.
+ if (M.getNamedMetadata("llvm.dbg.cu")) {
+ auto Handler = std::make_unique<SPIRVNonSemanticDebugHandler>(*this);
+ NSDebugHandler = Handler.get();
----------------
dnovillo wrote:
Yes, that's correct. The handler list is owned by the `AsmPrinter` base class, which lives as long as the `SPIRVAsmPrinter` does. Both are destroyed together when the printer object goes out of scope. Added a comment.
https://github.com/llvm/llvm-project/pull/191212
More information about the llvm-commits
mailing list