[mlir] Infer SubElementInterface implementations using the storage KeyTy
authorRiver Riddle <riddleriver@gmail.com>
Thu, 3 Nov 2022 23:06:59 +0000 (16:06 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Sat, 5 Nov 2022 01:15:03 +0000 (18:15 -0700)
commit38c219b4a8ebe30d781a1ebbb9a9d29b24c28b39
tree3ad323741c7531ce4108202a28e3126e2831707a
parent200266a0a12b0af77967c8770e1e1bdd634bfc4a
[mlir] Infer SubElementInterface implementations using the storage KeyTy

The KeyTy of attribute/type storage classes provide enough information for
automatically implementing the necessary sub element interface methods. This
removes the need for derived classes to do it themselves, which is both much
nicer and easier to handle certain invariants (e.g. null handling). In cases where
explicitly handling for parameter types is necessary, they can provide an implementation
of `AttrTypeSubElementHandler` to opt-in to support.

This tickles a few things alias wise, which annoyingly messes with tests that hard
code specific affine map numbers.

Differential Revision: https://reviews.llvm.org/D137374
32 files changed:
flang/test/Fir/affine-promotion.fir
mlir/docs/AttributesAndTypes.md
mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
mlir/include/mlir/IR/BuiltinAttributes.td
mlir/include/mlir/IR/BuiltinLocationAttributes.td
mlir/include/mlir/IR/Location.h
mlir/include/mlir/IR/StorageUniquerSupport.h
mlir/include/mlir/IR/SubElementInterfaces.h
mlir/include/mlir/IR/SubElementInterfaces.td
mlir/include/mlir/IR/TypeRange.h
mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
mlir/lib/IR/BuiltinAttributes.cpp
mlir/lib/IR/BuiltinTypes.cpp
mlir/lib/IR/Location.cpp
mlir/lib/IR/SubElementInterfaces.cpp
mlir/lib/IR/TypeDetail.h
mlir/test/Dialect/Affine/loop-tiling.mlir
mlir/test/Dialect/Linalg/drop-unit-extent-dims.mlir
mlir/test/Dialect/MemRef/fold-memref-alias-ops.mlir
mlir/test/Dialect/SCF/for-loop-specialization.mlir
mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
mlir/test/Dialect/SCF/parallel-loop-tiling.mlir
mlir/test/Dialect/SparseTensor/roundtrip.mlir
mlir/test/IR/affine-map.mlir
mlir/test/IR/memory-ops.mlir
mlir/test/Transforms/loop-fusion-2.mlir
mlir/test/Transforms/normalize-memrefs-ops.mlir
mlir/test/lib/Dialect/Test/TestAttrDefs.td
mlir/test/lib/Dialect/Test/TestAttributes.cpp
mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
mlir/unittests/IR/SubElementInterfaceTest.cpp