[llvm] [LLVM][TableGen] Paramaterize NumToSkip in DecoderEmitter (PR #135882)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 18:11:10 PDT 2025


================
@@ -130,9 +138,20 @@ struct DecoderTable : public std::vector<uint8_t> {
   // in the table for patching.
   size_t insertNumToSkip() {
     size_t Size = size();
-    insert(end(), 3, 0);
+    insert(end(), NumToSkipSizeInBytes, 0);
     return Size;
   }
+
+  void patchNumToSkip(size_t FixupIdx, uint32_t Value) {
+    if (!isUIntN(8 * NumToSkipSizeInBytes, Value))
+      PrintFatalError(
+          "disassembler decoding table too large, try --num-to-skip-size=3");
+
+    (*this)[FixupIdx] = static_cast<uint8_t>(Value);
----------------
topperc wrote:

Not for this patch, but can we remove the inheritance from std::vector in this class? I think that's discouraged. The std::vector should be a member.

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


More information about the llvm-commits mailing list