llvm-project/mlir/lib/TableGen
Jeff Niu e179532284 [mlir] Remove types from attributes
This patch removes the `type` field from `Attribute` along with the
`Attribute::getType` accessor.

Going forward, this means that attributes in MLIR will no longer have
types as a first-class concept. This patch lays the groundwork to
incrementally remove or refactor code that relies on generic attributes
being typed. The immediate impact will be on attributes that rely on
`Attribute` containing a type, such as `IntegerAttr`,
`DenseElementsAttr`, and `ml_program::ExternAttr`, which will now need
to define a type parameter on their storage classes. This will save
memory as all other attribute kinds will no longer contain a type.

Moreover, it will not be possible to generically query the type of an
attribute directly. This patch provides an attribute interface
`TypedAttr` that implements only one method, `getType`, which can be
used to generically query the types of attributes that implement the
interface. This interface can be used to retain the concept of a "typed
attribute". The ODS-generated accessor for a `type` parameter
automatically implements this method.

Next steps will be to refactor the assembly formats of certain operations
that rely on `parseAttribute(type)` and `printAttributeWithoutType` to
remove special handling of type elision until `type` can be removed from
the dialect parsing hook entirely; and incrementally remove uses of
`TypedAttr`.

Reviewed By: lattner, rriddle, jpienaar

Differential Revision: https://reviews.llvm.org/D130092
2022-07-31 20:01:31 -04:00
..
Argument.cpp [mlir] Add support for VariadicOfVariadic operands 2021-08-23 20:32:31 +00:00
AttrOrTypeDef.cpp [mlir] Remove types from attributes 2022-07-31 20:01:31 -04:00
Attribute.cpp [mlir][ods] Remove StructAttr 2022-06-21 01:10:05 +00:00
Builder.cpp [mlir][tblgen] Improving error messages 2022-06-30 18:25:53 -07:00
CMakeLists.txt [mlir][ods] Cleanup of Class Codegen helper 2021-11-12 21:22:01 +00:00
Class.cpp [mlir][ods] ODS ops get an `extraClassDefinition` 2022-01-06 01:43:26 +00:00
Constraint.cpp Use value_or instead of getValueOr (NFC) 2022-06-19 10:34:41 -07:00
Dialect.cpp [mlir] Add extensible dialects 2022-04-26 19:48:22 -07:00
Format.cpp [llvm] Cleanup header dependencies in ADT and Support 2022-01-21 13:54:49 +01:00
Interfaces.cpp [mlir][ods] Make Type- and AttrInterfaces also `Type`s and `Attr`s 2022-07-07 11:54:47 +02:00
Operator.cpp [mlir] Don't use Optional::hasValue (NFC) 2022-06-20 11:22:37 -07:00
Pass.cpp Fix more clang-tidy cleanups in mlir/ (NFC) 2021-12-22 20:53:11 +00:00
Pattern.cpp Use isa instead of dyn_cast (NFC) 2022-07-25 23:00:58 -07:00
Predicate.cpp [mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.h 2022-01-26 21:37:23 -08:00
Region.cpp
SideEffects.cpp [mlir] Add support for adding attribute+type traits/interfaces to tablegen defs 2021-04-15 11:41:51 -07:00
Successor.cpp
Trait.cpp [mlir] Support verification order (2/3) 2022-02-25 19:04:56 +00:00
Type.cpp [mlir:PDLL] Add better support for providing Constraint/Pattern/Rewrite documentation 2022-06-02 16:31:07 -07:00