[llvm] [AMDGPU][SIInsertWaitcnts][NFC] Common InstCounterType printer (PR #187559)
Sameer Sahasrabuddhe via llvm-commits
llvm-commits at lists.llvm.org
Wed May 6 02:06:58 PDT 2026
================
@@ -121,23 +122,25 @@ class Waitcnt {
return Wait;
}
- void print(raw_ostream &OS) const {
- ListSeparator LS;
- for (InstCounterType T : inst_counter_types())
- OS << LS << getInstCounterName(T) << ": " << Cnt[T];
- if (LS.unused())
- OS << "none";
- OS << '\n';
+ Printable getPrintable(raw_ostream &OS, bool HasExtendedWaitcnts) const {
+ return Printable([HasExtendedWaitcnts, this](raw_ostream &OS) {
+ ListSeparator LS;
+ for (InstCounterType T : inst_counter_types())
+ OS << LS << getInstCounterName(T, HasExtendedWaitcnts) << ": "
+ << Cnt[T];
+ if (LS.unused())
+ OS << "none";
+ OS << '\n';
+ });
+ }
+
+ void print(raw_ostream &OS, bool HasExtendedWaitcnts) const {
+ OS << getPrintable(OS, HasExtendedWaitcnts);
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
- LLVM_DUMP_METHOD void dump() const;
+ LLVM_DUMP_METHOD void dump(bool HasExtendedWaitcnts) const;
----------------
ssahasra wrote:
Imagine someone using a debugger and habitually calling `dump()` on things! Now they have to wait and go find out what is an extended waitcnt. This method really should be just `dump()` and nothing else.
https://github.com/llvm/llvm-project/pull/187559
More information about the llvm-commits
mailing list