[llvm] [AMDGPU][AsmParser] Print names of parsed registers in debug output. (PR #102328)

Ivan Kosarev via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 09:33:39 PDT 2024


https://github.com/kosarev created https://github.com/llvm/llvm-project/pull/102328

Knowing just their numeric values is not very helpful.

Part of <https://github.com/llvm/llvm-project/issues/62629>.

>From 30942c57ad746637f78e3536e344f425bc4a4984 Mon Sep 17 00:00:00 2001
From: Ivan Kosarev <ivan.kosarev at amd.com>
Date: Wed, 7 Aug 2024 13:24:46 +0100
Subject: [PATCH] [AMDGPU][AsmParser] Print names of parsed registers in debug
 output.

Knowing just their numeric values is not very helpful.

Part of <https://github.com/llvm/llvm-project/issues/62629>.
---
 llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index c8b594ffbc6452..bbd9d75aac0e91 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "AMDKernelCodeT.h"
+#include "MCTargetDesc/AMDGPUInstPrinter.h"
 #include "MCTargetDesc/AMDGPUMCExpr.h"
 #include "MCTargetDesc/AMDGPUMCKernelDescriptor.h"
 #include "MCTargetDesc/AMDGPUMCTargetDesc.h"
@@ -1133,7 +1134,8 @@ class AMDGPUOperand : public MCParsedAsmOperand {
   void print(raw_ostream &OS) const override {
     switch (Kind) {
     case Register:
-      OS << "<register " << getReg() << " mods: " << Reg.Mods << '>';
+      OS << "<register " << AMDGPUInstPrinter::getRegisterName(getReg())
+         << " mods: " << Reg.Mods << '>';
       break;
     case Immediate:
       OS << '<' << getImm();



More information about the llvm-commits mailing list