[llvm] [NVPTX] Introduce custom AsmStreamer for NVPTX backend (PR #192527)

Karthik Senthil via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 10:47:39 PDT 2026


karthik-senthil wrote:

> While I'm generally in favor of moving this direction, I'm having trouble telling if this patch is doing anything (Is this a NFC)? While it maybe would make sense to land this bit first, I think it would be very helpful for reviewing the design if there were an example where having a custom AsmStreamer offered some benefit over what we're doing now.

Thanks for the review Alex! The PR adds the custom streamer under a new cl::opt which is disabled by default - hence the changes are NFC for now. I believe a good example of where custom AsmStreamer would help is `NVPTXAsmPrinter::emitGlobals` and specifically `NVPTXAsmPrinter::printModuleLevelGV`. Trying to reuse `AsmPrinter::emitGlobalConstant` within `NVPTXAsmPrinter` leads to issues because we create and use `MCAsmStreamer` by default for NVPTX backend.

Would you suggest I expand this PR to showcase how the new `NVPTXAsmStreamer` can be used to simplify handling of global variables in the printer?

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


More information about the llvm-commits mailing list