mirror of
https://github.com/intel/llvm.git
synced 2026-01-23 07:58:23 +08:00
Using properties currently requires at the very least implementing four methods/code snippets: * `convertToAttribute` * `convertFromAttribute` * `writeToMlirBytecode` * `readFromMlirBytecode` This makes replacing attributes with properties harder than it has to be: Attributes by default do not require immediately defining custom bytecode encoding. This patch therefore adds opt-in implementations of `writeToMlirBytecode` and `readFromMlirBytecode` that work with the default implementations of `convertToAttribute` and `convertFromAttribute`. They are provided by `defvar`s in `OpBase.td` and can be used by adding: ``` let writeToMlirBytecode = writeMlirBytecodeWithConvertToAttribute; let readFromMlirBytecode = readMlirBytecodeUsingConvertFromAttribute; ``` to ones TableGen definition. While this bytecode encoding is almost certainly not ideal for a given property, it allows more incremental use of properties and getting something sane working before optimizing the bytecode format. Differential Revision: https://reviews.llvm.org/D155286
Multi-Level Intermediate Representation
See https://mlir.llvm.org/ for more information.