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

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 12:42:47 PDT 2025


jurahul wrote:

Note, now the decoder Table generated by the decoder emitter looks like:

```
struct DecoderTable2Bytes { // Decoder Table with 2 bytes NumToSkip.
   ArrayRef<uint8_t> Data;
};
struct DecoderTable3Bytes { // Decoder Table with 3 bytes NumToSkip.
   ArrayRef<uint8_t> Data;
};
static constexpr uint8_t DecoderTable32RawData[] = ... 
static constexpr DecoderTable3Bytes DecoderTable32{DecoderTable32RawData};
...
template <typename InsnType>
static DecodeStatus decodeInstruction(DecoderTable3Bytes DecodeTable,
                                      MCInst &MI, InsnType insn,
                                      uint64_t Address,
                                      const MCDisassembler *DisAsm,
                                      const MCSubtargetInfo &STI) 
```

So we will now have 2 version of decodeInstruction with different signatures and hence safe from tramping on each other.


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


More information about the llvm-commits mailing list