[all-commits] [llvm/llvm-project] 319d8c: [mlir][ods] Added EnumAttr, an AttrDef implementat...
Jeff Niu via All-commits
all-commits at lists.llvm.org
Thu Dec 16 18:55:40 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 319d8cf685f26293b25aa0a8962c67355565714f
https://github.com/llvm/llvm-project/commit/319d8cf685f26293b25aa0a8962c67355565714f
Author: Mogball <jeffniu22 at gmail.com>
Date: 2021-12-17 (Fri, 17 Dec 2021)
Changed paths:
A mlir/include/mlir/IR/EnumAttr.td
A mlir/test/IR/enum-attr-invalid.mlir
A mlir/test/IR/enum-attr-roundtrip.mlir
M mlir/test/lib/Dialect/Test/TestAttributes.h
M mlir/test/lib/Dialect/Test/TestDialect.h
M mlir/test/lib/Dialect/Test/TestOps.td
M utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Log Message:
-----------
[mlir][ods] Added EnumAttr, an AttrDef implementation of enum attributes
`EnumAttr` is a pure TableGen implementation of enum attributes using `AttrDef`. This is meant as a drop-in replacement for `StrEnumAttr`, which is soon to be deprecated. `StrEnumAttr` is often used over `IntEnumAttr` because its more readable in MLIR assembly formats. However, storing and manipulating strings is not efficient. Defining `StrEnumAttr` can also be awkward and relies on a lot of special logic in `EnumsGen`, and has some hidden sharp edges.
Also, `EnumAttr` stores the enum directly, removing the need to convert to/from integers when calling attribute getters on ops.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D115181
More information about the All-commits
mailing list