[llvm] 369dba5 - [RDF] Print regmask index in more user-friendly way

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 08:38:31 PDT 2023


Author: Krzysztof Parzyszek
Date: 2023-06-13T08:38:08-07:00
New Revision: 369dba546838bb610dba35b8ef389c30d2ad324b

URL: https://github.com/llvm/llvm-project/commit/369dba546838bb610dba35b8ef389c30d2ad324b
DIFF: https://github.com/llvm/llvm-project/commit/369dba546838bb610dba35b8ef389c30d2ad324b.diff

LOG: [RDF] Print regmask index in more user-friendly way

Added: 
    

Modified: 
    llvm/lib/CodeGen/RDFRegisters.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RDFRegisters.cpp b/llvm/lib/CodeGen/RDFRegisters.cpp
index 7e6d33b1825e6..d46b2d907e11b 100644
--- a/llvm/lib/CodeGen/RDFRegisters.cpp
+++ b/llvm/lib/CodeGen/RDFRegisters.cpp
@@ -335,13 +335,16 @@ void PhysicalRegisterInfo::print(raw_ostream &OS, RegisterRef A) const {
     if (0 < A.idx() && A.idx() < TRI.getNumRegs())
       OS << TRI.getName(A.idx());
     else
-      OS << printReg(A.Reg, &TRI);
+      OS << printReg(A.idx(), &TRI);
     OS << PrintLaneMaskShort(A.Mask);
   } else if (A.isUnit()) {
     OS << printRegUnit(A.idx(), &TRI);
   } else {
     assert(A.isMask());
-    OS << '#' << format("%08x", A.Reg);
+    // RegMask SS flag is preserved by idx().
+    unsigned Idx = Register::stackSlot2Index(A.idx());
+    const char *Fmt = Idx < 0x10000 ? "%04x" : "%08x";
+    OS << "M#" << format(Fmt, Idx);
   }
 }
 


        


More information about the llvm-commits mailing list