summaryrefslogtreecommitdiff
path: root/llvm/lib/TableGen/Record.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/TableGen/Record.cpp')
-rw-r--r--llvm/lib/TableGen/Record.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 3657a15ab198..051a896cfd1b 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -525,6 +525,14 @@ std::optional<int64_t> BitsInit::convertInitializerToInt() const {
return Result;
}
+uint64_t BitsInit::convertKnownBitsToInt() const {
+ uint64_t Result = 0;
+ for (auto [Idx, InitV] : enumerate(getBits()))
+ if (auto *Bit = dyn_cast<BitInit>(InitV))
+ Result |= static_cast<int64_t>(Bit->getValue()) << Idx;
+ return Result;
+}
+
const Init *
BitsInit::convertInitializerBitRange(ArrayRef<unsigned> Bits) const {
SmallVector<const Init *, 16> NewBits(Bits.size());