[mlir] Improve BitEnumAttr, update documentation
authorKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Tue, 6 Sep 2022 20:25:20 +0000 (20:25 +0000)
committerKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Tue, 6 Sep 2022 21:36:34 +0000 (21:36 +0000)
commit839b436c93604e042f74050cf2adadd75f30e898
tree0b97589e5739d03ec6bff66eea4eaf7943cf9b3a
parent648e182d92441b39b62f2fc30473d12d25e6ce8b
[mlir] Improve BitEnumAttr, update documentation

- Add new operators to BitEnumAttr, mainly not (which only inverts
bits that can be valid bits for the attribute) and xor
- Add new bit enum utility functions: bitEnumClear(bits, bit) and
bitEnumSet(bits, bit, value=true) as they've come up in code I've been
writing that makes use of such enums
- Add rudimentary tests for the enum generator
- Update the OpDefinition documentation to make it contain a correct
example and to have it account for the changes mentioned above.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D133374
mlir/docs/OpDefinitions.md
mlir/test/mlir-tblgen/enums-gen.td [new file with mode: 0644]
mlir/tools/mlir-tblgen/EnumsGen.cpp