[llvm] 115a42a - Add debug printers for KnownBits [nfc]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 31 15:36:26 PDT 2021
Author: Philip Reames
Date: 2021-03-31T15:36:07-07:00
New Revision: 115a42ad1e1c25fee6d10d5faab999b1b5c8b52c
URL: https://github.com/llvm/llvm-project/commit/115a42ad1e1c25fee6d10d5faab999b1b5c8b52c
DIFF: https://github.com/llvm/llvm-project/commit/115a42ad1e1c25fee6d10d5faab999b1b5c8b52c.diff
LOG: Add debug printers for KnownBits [nfc]
Added:
Modified:
llvm/include/llvm/Support/KnownBits.h
llvm/lib/Support/KnownBits.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/KnownBits.h b/llvm/include/llvm/Support/KnownBits.h
index c27ddb0ce804..2e720bdde59e 100644
--- a/llvm/include/llvm/Support/KnownBits.h
+++ b/llvm/include/llvm/Support/KnownBits.h
@@ -396,6 +396,9 @@ struct KnownBits {
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) {
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index 423a908eed57..5da4cf7045fd 100644
--- a/llvm/lib/Support/KnownBits.cpp
+++ b/llvm/lib/Support/KnownBits.cpp
@@ -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";
+}
More information about the llvm-commits
mailing list