Skip to content

Commit 115a42a

Browse files
committed
Add debug printers for KnownBits [nfc]
1 parent 777a58e commit 115a42a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

llvm/include/llvm/Support/KnownBits.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ struct KnownBits {
396396
KnownBits reverseBits() {
397397
return KnownBits(Zero.reverseBits(), One.reverseBits());
398398
}
399+
400+
void print(raw_ostream &OS) const;
401+
void dump() const;
399402
};
400403

401404
inline KnownBits operator&(KnownBits LHS, const KnownBits &RHS) {

llvm/lib/Support/KnownBits.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
#include "llvm/Support/KnownBits.h"
15+
#include "llvm/Support/Debug.h"
16+
#include "llvm/Support/raw_ostream.h"
1517
#include <cassert>
1618

1719
using namespace llvm;
@@ -601,3 +603,11 @@ KnownBits &KnownBits::operator^=(const KnownBits &RHS) {
601603
Zero = std::move(Z);
602604
return *this;
603605
}
606+
607+
void KnownBits::print(raw_ostream &OS) const {
608+
OS << "{Zero=" << Zero << ", One=" << One << "}";
609+
}
610+
void KnownBits::dump() const {
611+
print(dbgs());
612+
dbgs() << "\n";
613+
}

0 commit comments

Comments
 (0)