[llvm-branch-commits] [llvm] [NVPTX] add support for encoding PTX registers for DWARF (PR #109495)

Walter Erquinigo via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Sep 22 13:34:56 PDT 2024


================
@@ -1773,6 +1774,26 @@ void NVPTXAsmPrinter::setAndEmitFunctionVirtualRegisters(
   OutStreamer->emitRawText(O.str());
 }
 
+/// Translate virtual register numbers in DebugInfo locations to their printed
+/// encodings, as used by CUDA-GDB.
+void NVPTXAsmPrinter::encodeDebugInfoRegisterNumbers(
+    const MachineFunction &MF) {
+  const NVPTXSubtarget &STI = MF.getSubtarget<NVPTXSubtarget>();
+  const NVPTXRegisterInfo *registerInfo = STI.getRegisterInfo();
+
+  // Clear the old mapping, and add the new one.  This mapping is used after the
+  // printing of the current function is complete, but before the next function
+  // is printed.
+  registerInfo->clearDebugRegisterMap();
+
+  for (auto classMap : VRegMapping) {
+    for (auto registerMapping : classMap.getSecond()) {
----------------
walter-erquinigo wrote:

could you make these iterators references?

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


More information about the llvm-branch-commits mailing list