Add debug printers for KnownBits [nfc]
authorPhilip Reames <listmail@philipreames.com>
Wed, 31 Mar 2021 22:34:57 +0000 (15:34 -0700)
committerPhilip Reames <listmail@philipreames.com>
Wed, 31 Mar 2021 22:36:07 +0000 (15:36 -0700)
llvm/include/llvm/Support/KnownBits.h
llvm/lib/Support/KnownBits.cpp

index c27ddb0..2e720bd 100644 (file)
@@ -396,6 +396,9 @@ public:
   KnownBits reverseBits() {
     return KnownBits(Zero.reverseBits(), One.reverseBits());
   }
+
+  void print(raw_ostream &OS) const;
+  void dump() const;
 };
 
 inline KnownBits operator&(KnownBits LHS, const KnownBits &RHS) {
index 423a908..5da4cf7 100644 (file)
@@ -12,6 +12,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/KnownBits.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
 #include <cassert>
 
 using namespace llvm;
@@ -601,3 +603,11 @@ KnownBits &KnownBits::operator^=(const KnownBits &RHS) {
   Zero = std::move(Z);
   return *this;
 }
+
+void KnownBits::print(raw_ostream &OS) const {
+  OS << "{Zero=" << Zero << ", One=" << One << "}";
+}
+void KnownBits::dump() const {
+  print(dbgs());
+  dbgs() << "\n";
+}