HomePhabricator

[mlir][ODS] Support specialized Attribute class for Enums

Authored by vinograd47 on Feb 27 2021, 4:21 AM.

Description

[mlir][ODS] Support specialized Attribute class for Enums

Add a feature to EnumAttr definition to generate
specialized Attribute class for the particular enumeration.

This class will inherit StringAttr or IntegerAttr and
will override classof and getValue methods.

With this class the enumeration predicate can be checked with simple
RTTI calls (isa, dyn_cast) and it will return the typed enumeration
directly instead of raw string/integer.

Based on the following discussion:
https://llvm.discourse.group/t/rfc-add-enum-attribute-decorator-class/2252

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D97836

Details

Committed
vinograd47Mar 17 2021, 6:44 AM
Reviewer
rriddle
Differential Revision
D97836: [mlir][ODS] Support specialized Attribute class for Enums
Parents
rG2571a0936719: [OCaml] Handle nullptr in Llvm.global_initializer
Branches
Unknown
Tags
Unknown