diff options
author | Markus Böck <markus.boeck02@gmail.com> | 2023-07-21 07:40:10 +0200 |
---|---|---|
committer | Markus Böck <markus.boeck02@gmail.com> | 2023-07-21 08:03:26 +0200 |
commit | f117bbca041c9b0c59002835d939e1bc9e76cf39 (patch) | |
tree | fbee358caaa748d2ea16e891c71c753961195f0c /clang/lib/Lex/ModuleMap.cpp | |
parent | ede20c1e690b8cb1f708c01c5267404a8fccd410 (diff) | |
download | llvm-f117bbca041c9b0c59002835d939e1bc9e76cf39.zip llvm-f117bbca041c9b0c59002835d939e1bc9e76cf39.tar.gz llvm-f117bbca041c9b0c59002835d939e1bc9e76cf39.tar.bz2 |
[mlir] Add opt-in default property bytecode read and write implementation
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
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions