[llvm] [llvm-dwarfdump] Decode the virtual register names from the dwarf register numbers (PR #192353)

Scott Linder via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 13:49:32 PDT 2026


================
@@ -23,6 +24,57 @@ namespace llvm {
 typedef DWARFExpression::Operation Op;
 typedef Op::Description Desc;
 
+/// Some backends (e.g. NVPTX) encode virtual register names as the DWARF
+/// register number: the ASCII bytes of the name are concatenated into a
+/// uint64_t (see NVPTXRegisterInfo::encodeRegisterForDwarf). When the object
+/// file is not the target backend, MCRegisterInfo cannot map these numbers, so
+/// recover the string for dumping.
+static bool decodeVirtualRegisterName(uint64_t DwarfRegNum,
+                                      SmallString<32> &Out) {
----------------
slinder1 wrote:

Why `32`? The input is `uint64_t`, so as `NVPTXRegisterInfo::encodeRegisterForDwarf` notes this cannot be more than `8`.

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


More information about the llvm-commits mailing list