[llvm] 64a22b3 - [NVPTX] fix debug register encoding of special %Depot register (#111596)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 18:39:19 PDT 2024


Author: William G Hatch
Date: 2024-10-08T19:39:16-06:00
New Revision: 64a22b3e69587c83566a83e793764f2a13733f0b

URL: https://github.com/llvm/llvm-project/commit/64a22b3e69587c83566a83e793764f2a13733f0b
DIFF: https://github.com/llvm/llvm-project/commit/64a22b3e69587c83566a83e793764f2a13733f0b.diff

LOG: [NVPTX] fix debug register encoding of special %Depot register (#111596)

cuda-gdb doesn't seem to be able to read the `%Depot` register, but
because we always copy it to `%SP` in lowering, simply switching to use
it fixes the problem.

Added: 
    

Modified: 
    llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp
index c30372fed1832d..dc2584645b314c 100644
--- a/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp
@@ -176,6 +176,11 @@ void NVPTXRegisterInfo::addToDebugRegisterMap(
 int64_t NVPTXRegisterInfo::getDwarfRegNum(MCRegister RegNum, bool isEH) const {
   if (Register::isPhysicalRegister(RegNum)) {
     std::string name = NVPTXInstPrinter::getRegisterName(RegNum.id());
+    // In NVPTXFrameLowering.cpp, we do arrange for %Depot to be accessible from
+    // %SP. Using the %Depot register doesn't provide any debug info in
+    // cuda-gdb, but switching it to %SP does.
+    if (RegNum.id() == NVPTX::VRDepot)
+      name = "%SP";
     return encodeRegisterForDwarf(name);
   }
   uint64_t lookup = debugRegisterMap.lookup(RegNum.id());


        


More information about the llvm-commits mailing list