[llvm] [TableGen][DecoderEmitter] Add option to emit type-specialized `decodeToMCInst` (PR #146593)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 3 09:34:44 PDT 2025
jurahul wrote:
> What if we duplicated decodeMCInst and decodeInstruction based on bitwidth but left them as template functions. That would remove the unused switch cases in each decodeMCInst. Unfortunately, we'd have to update targets to call the correct decodeInstruction with the bitwidth in the name.
I don't understand this. Can you elaborate? Do you mean something like:
```
template <typename InsnType>
std::enable_if<sizeof(InsnType) == 32); /// use the proper syntax here
decodeToMCInst(...) {
// just 32-bit decoder cases
}
template <typename InsnType>
std::enable_if<sizeof(InsnType) == 64); /// use the proper syntax here
decodeToMCInst(...) {
// just 64-bit decoder cases
}
```
?
https://github.com/llvm/llvm-project/pull/146593
More information about the llvm-commits
mailing list