[llvm] [TableGen][Decoder] Decode operands with zero width or all bits known (PR #156358)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 13:21:24 PDT 2025
================
@@ -1058,11 +1070,23 @@ FilterChooser::getIslands(const KnownBits &EncodingBits) const {
void DecoderTableBuilder::emitBinaryParser(raw_ostream &OS, indent Indent,
const OperandInfo &OpInfo) const {
- bool UseInsertBits = OpInfo.numFields() != 1 || OpInfo.InitValue != 0;
+ // Special case for 'bits<0>'.
+ if (OpInfo.Fields.empty() && !OpInfo.InitValue) {
+ if (IgnoreNonDecodableOperands)
+ return;
+ assert(!OpInfo.Decoder.empty());
+ OS << Indent << OpInfo.Decoder << "(MI, Decoder);\n";
+ return;
+ }
----------------
lenary wrote:
Can we always pass `0` to the decoder function, for the encoded bits?
I'm not sure it would be entirely obvious that 0-width operands have a different decoder signature, and we already don't really document the decoder signature.
https://github.com/llvm/llvm-project/pull/156358
More information about the llvm-commits
mailing list