[all-commits] [llvm/llvm-project] a266a2: [mlir][ods] Extend the EnumAttr tablegen class to ...
Jeremy Furtek via All-commits
all-commits at lists.llvm.org
Mon Apr 25 12:00:14 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a266a21000123b66718df2a09fd7ceeea67843c5
https://github.com/llvm/llvm-project/commit/a266a21000123b66718df2a09fd7ceeea67843c5
Author: Jeremy Furtek <jfurtek at nvidia.com>
Date: 2022-04-25 (Mon, 25 Apr 2022)
Changed paths:
M mlir/include/mlir/IR/EnumAttr.td
M mlir/include/mlir/IR/OpImplementation.h
M mlir/lib/Parser/AsmParserImpl.h
M mlir/lib/Parser/Lexer.cpp
M mlir/lib/Parser/TokenKinds.def
M mlir/test/IR/attribute.mlir
M mlir/test/lib/Dialect/Test/TestDialect.cpp
M mlir/test/lib/Dialect/Test/TestOps.td
Log Message:
-----------
[mlir][ods] Extend the EnumAttr tablegen class to support BitEnum attributes
This diff allows the EnumAttr class to be used for bit enum attributes (in
addition to previously supported integer enum attributes). While integer
and bit enum attributes share many common implementation aspects, parsing
bit enum values requires a separate implementation. This is accomplished
by creating empty parser and printer strings in the EnumAttrInfo record,
and having derived classes (specific to bit and integer enums) override with
an appropriate parser/printer string.
To support existing bit enums that may use a vertical bar separator, the
parser is modified to support the | token.
Tests were added for bit enums alongside integer enums.
Future diffs for fastmath attributes in the arithmetic dialect will use these
changes.
(resubmission of earlier abaondoned diff, updated to reflect subsequent changes
in the repository)
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D123880
More information about the All-commits
mailing list