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

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 20 09:32:44 PDT 2025


================
@@ -2138,7 +2151,18 @@ insertBits(InsnType &field, uint64_t bits, unsigned startBit, unsigned numBits)
 // decodeInstruction().
 static void emitDecodeInstruction(formatted_raw_ostream &OS,
                                   bool IsVarLenInst) {
+  OS << formatv("\nconstexpr unsigned NumToSkipSizeInBytes = {};\n",
+                NumToSkipSizeInBytes);
+
   OS << R"(
+static unsigned decodeNumToSkip(const uint8_t *&Ptr) {
+  unsigned NumToSkip = *Ptr++;
+  NumToSkip |= (*Ptr++) << 8;
+  if constexpr (NumToSkipSizeInBytes == 3)
----------------
jurahul wrote:

Done

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


More information about the llvm-commits mailing list