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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 16 09:17:33 PDT 2025


================
@@ -130,10 +138,29 @@ 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 DestIdx) {
+    // Calculate the distance from the byte following the fixup entry byte
+    // to the destination. The Target is calculated from after the
+    // `NumToSkipSizeInBytes`-byte NumToSkip entry itself, so subtract
+    // `NumToSkipSizeInBytes` from the displacement here to account for that.
+    assert(DestIdx > FixupIdx &&
----------------
topperc wrote:

`DestIdx >= (FixupIdx + NumToSkipSizeInBytes)`

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


More information about the llvm-commits mailing list