[llvm] [TableGen] Emit Debug code for dynamic bits(eg: instruction operands) in DecoderEmitter (PR #194699)

Prerona Chaudhuri via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 07:59:54 PDT 2026


================
@@ -683,6 +683,58 @@ static std::vector<EncodingIsland> getIslands(const KnownBits &EncodingBits,
   return Islands;
 }
 
+static std::string getOperandFieldDescForDebug(const OperandInfo &OpInfo) {
+  if (OpInfo.Fields.empty() && !OpInfo.InitValue)
+    return "bits<0>";
+  if (OpInfo.fields().empty())
----------------
pchaudhuri-nv wrote:

Hello @topperc 

This is a nice question, thanks for asking, I can see that both are pointing to the same i.e bits layout for the operand, fields() being a const wrapper over Fields. However I see both being used in DecoderEmitter.cpp for querying, may be we can use fields() instead whenever we just plan to query.

Tagging original author @s-barannikov to confirm my understanding ...

I can then create a separate PR to fix this. 

https://github.com/llvm/llvm-project/pull/194699


More information about the llvm-commits mailing list