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

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 03:03:52 PDT 2025


================
@@ -32,44 +32,6 @@ class MCOperand;
 class MCSubtargetInfo;
 class Twine;
 
-// Exposes an interface expected by autogenerated code in
-// FixedLenDecoderEmitter
-class DecoderUInt128 {
----------------
s-barannikov wrote:

> But beyond that, what else do you expect such a class to provide?

```
// * be default-constructible and copy-constructible
// * Support extractBitsAsZExtValue(numBits, startBit)
// * Support the ~, &, ==, and != operators with other objects of the same type
// * Support the != and bitwise & with uint64_t
```

The idea is to have `DecoderInt<>` (for integer types) and  `DecoderInt<std::bitset>` / `DecoderInt<APInt>` specializations written once in a header / raw string literal rather than generate functions like extractBitsAsZExtValue on the fly.


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


More information about the llvm-commits mailing list