Skip to content

Commit 64a22b3

Browse files
authored
[NVPTX] fix debug register encoding of special %Depot register (llvm#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.
1 parent 1818404 commit 64a22b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ void NVPTXRegisterInfo::addToDebugRegisterMap(
176176
int64_t NVPTXRegisterInfo::getDwarfRegNum(MCRegister RegNum, bool isEH) const {
177177
if (Register::isPhysicalRegister(RegNum)) {
178178
std::string name = NVPTXInstPrinter::getRegisterName(RegNum.id());
179+
// In NVPTXFrameLowering.cpp, we do arrange for %Depot to be accessible from
180+
// %SP. Using the %Depot register doesn't provide any debug info in
181+
// cuda-gdb, but switching it to %SP does.
182+
if (RegNum.id() == NVPTX::VRDepot)
183+
name = "%SP";
179184
return encodeRegisterForDwarf(name);
180185
}
181186
uint64_t lookup = debugRegisterMap.lookup(RegNum.id());

0 commit comments

Comments
 (0)