[llvm] [Tablegen] Don't emit decoder tables with islands larger than 64 bits (PR #179651)
Petr Vesely via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 4 05:00:25 PST 2026
https://github.com/veselypeta created https://github.com/llvm/llvm-project/pull/179651
I have a downstream target which has 128-bit instructions where some instructions can have large sections of encoding to be determined ahead of time. This results in the island calculations for decoder tables to emit checks over 64-bits.
This change will emit multiple separate checks when the island exceeds 64-bits.
>From 2dd01a3fd71e5bc03c9cc665d3bf4f7bd8eb333f Mon Sep 17 00:00:00 2001
From: Petr Vesely <veselypeta at gmail.com>
Date: Wed, 4 Feb 2026 12:56:43 +0000
Subject: [PATCH] [Tablegen] Don't emit decoder tables with islands larger than
64 bits
---
llvm/utils/TableGen/DecoderEmitter.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 5d41b7dc3c311..664c3009ff504 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -656,8 +656,14 @@ static std::vector<EncodingIsland> getIslands(const KnownBits &EncodingBits,
if (!IsFiltered && IsKnown) {
if (OnIsland) {
// Accumulate island bits.
- FieldVal |= static_cast<uint64_t>(EncodingBits.One[I])
- << (I - StartBit);
+ const unsigned BitNo = I - StartBit;
+ FieldVal |= static_cast<uint64_t>(EncodingBits.One[I]) << (BitNo);
+ // If island becomes larger than 64-bits complete the island and start a
+ // new one
+ if (BitNo >= 63) {
+ Islands.push_back({StartBit, 64, FieldVal});
+ OnIsland = false;
+ }
} else {
// Onto an island.
StartBit = I;
More information about the llvm-commits
mailing list