[llvm] [TableGen][DecoderEmitter] Print the size of the decoder tables (PR #155139)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 23 21:13:09 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tablegen

Author: Sergei Barannikov (s-barannikov)

<details>
<summary>Changes</summary>

So we can see the changes in table sizes after making changes to DecoderEmitter by simply running `grep DecoderTable`.

Also, remove an unnecessary terminating 0 from the end of the tables.

---
Full diff: https://github.com/llvm/llvm-project/pull/155139.diff


1 Files Affected:

- (modified) llvm/utils/TableGen/DecoderEmitter.cpp (+1-2) 


``````````diff
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 84a9d35436bef..d232195e38534 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -795,7 +795,7 @@ unsigned DecoderEmitter::emitTable(formatted_raw_ostream &OS,
   OS << "static const uint8_t DecoderTable" << Namespace;
   if (HwModeID != DefaultMode)
     OS << '_' << Target.getHwModes().getModeName(HwModeID);
-  OS << BitWidth << "[] = {\n";
+  OS << BitWidth << "[" << Table.size() << "] = {\n";
 
   // Emit ULEB128 encoded value to OS, returning the number of bytes emitted.
   auto emitULEB128 = [](DecoderTable::const_iterator &I,
@@ -978,7 +978,6 @@ unsigned DecoderEmitter::emitTable(formatted_raw_ostream &OS,
       break;
     }
   }
-  OS << "  0\n";
   OS << "};\n\n";
 
   return OpcodeMask;

``````````

</details>


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


More information about the llvm-commits mailing list