[llvm] [TableGen][DecoderEmitter] Add option to emit type-specialized code (PR #146593)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 10:16:30 PDT 2025


jurahul wrote:

I did one other minor change. We used to generate, for each bitwidth, a `decodeInstruction<N>` function as well as a `decodeInstruction` that just calls `decodeInstruction<N>`. Since we don't really use `decodeInstruction<N>` directly, I am just generating `decodeInstruction` directly now. So, for example, for 16 and 32-bit instructions, old code has:

```
decodeToMCInst16() {}
decodeInstruction16 {
    call decodeToMCInst16()
}
decodeInstruction(..., uint16_t insn, ...)

decodeToMCInst32
decodeInstruction32 {
    call decodeToMCInst32()
}

decodeInstruction(..., uint32_t insn, ...) {
  return decodeInstruction32(...)
}
```

Now it will just have:

```
decodeToMCInst16() {}
decodeInstruction(..., uint16_t insn, ...) {
    call decodeToMCInst16()
}

decodeToMCInst32
decodeInstruction(..., uint32_t insn, ...) {
    call decodeToMCInst32()
}
```


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


More information about the llvm-commits mailing list