[llvm] [NVPTX] fix debug register encoding of special %Depot register (PR #111596)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 15:19:04 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-nvptx
Author: William G Hatch (willghatch)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/111596.diff
1 Files Affected:
- (modified) llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp (+5)
``````````diff
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());
``````````
</details>
https://github.com/llvm/llvm-project/pull/111596
More information about the llvm-commits
mailing list