[llvm] 6129e4c - [MCA] Add ReadState::dump (#153345)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 13 08:20:05 PDT 2025


Author: Aiden Grossman
Date: 2025-08-13T08:20:00-07:00
New Revision: 6129e4cac2073cceda36120e2e7817bc61c294bc

URL: https://github.com/llvm/llvm-project/commit/6129e4cac2073cceda36120e2e7817bc61c294bc
DIFF: https://github.com/llvm/llvm-project/commit/6129e4cac2073cceda36120e2e7817bc61c294bc.diff

LOG: [MCA] Add ReadState::dump (#153345)

WriteState has a dump function that provides some helpful info for
debugging. Having this available in ReadState can be helpful as well in
some instances.

Added: 
    

Modified: 
    llvm/include/llvm/MCA/Instruction.h
    llvm/lib/MCA/Instruction.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MCA/Instruction.h b/llvm/include/llvm/MCA/Instruction.h
index 4c683aa3421de..3cdbf84748c79 100644
--- a/llvm/include/llvm/MCA/Instruction.h
+++ b/llvm/include/llvm/MCA/Instruction.h
@@ -382,6 +382,10 @@ class ReadState {
   bool isReadZero() const { return IsZero; }
   void setReadZero() { IsZero = true; }
   void setPRF(unsigned ID) { PRFID = ID; }
+
+#ifndef NDEBUG
+  void dump() const;
+#endif
 };
 
 /// A sequence of cycles.

diff  --git a/llvm/lib/MCA/Instruction.cpp b/llvm/lib/MCA/Instruction.cpp
index d4adfce597139..79667080ecbbc 100644
--- a/llvm/lib/MCA/Instruction.cpp
+++ b/llvm/lib/MCA/Instruction.cpp
@@ -128,6 +128,13 @@ void WriteState::dump() const {
 }
 #endif
 
+#ifndef NDEBUG
+void ReadState::dump() const {
+  dbgs() << "{ OpIdx=" << RD->OpIndex << ", RegID " << getRegisterID()
+         << ", Cycles Left=" << CyclesLeft << " }";
+}
+#endif
+
 const CriticalDependency &Instruction::computeCriticalRegDep() {
   if (CriticalRegDep.Cycles)
     return CriticalRegDep;


        


More information about the llvm-commits mailing list