ODS: support UnitAttr in Operation definitions
authorAlex Zinenko <zinenko@google.com>
Tue, 23 Jul 2019 17:16:52 +0000 (10:16 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Tue, 23 Jul 2019 17:17:29 +0000 (10:17 -0700)
commit0aed5222d8862436d84883cd0afc93bdff2af919
tree3b9602854afc710ff73b014ec2a44a7a4b207225
parent8543f8aaba3b5bd5def2e17bbcb9c935d5a47122
ODS: support UnitAttr in Operation definitions

A recent commit introduced UnitAttr into the ODS but did not include the
support for using UnitAttrs in operation definitions (only patterns were
supported).  Extend the ODS definition of UnitAttr to be usable in operation
definition by providing a trivial builder and an accessor that returns "true"
if the unit attribute is present since the attribute presence itself has
meaning.

Additionally, test that unit attributes are effectively rewritten in patterns
in addition to the already available FileCheck tests of the generated rewriter
code.

PiperOrigin-RevId: 259560653
mlir/include/mlir/IR/OpBase.td
mlir/test/lib/TestDialect/TestOps.td
mlir/test/mlir-tblgen/op-attribute.td
mlir/test/mlir-tblgen/pattern.mlir