[mlir] Support for mutable types
authorAlex Zinenko <zinenko@google.com>
Wed, 22 Jul 2020 11:03:24 +0000 (13:03 +0200)
committerAlex Zinenko <zinenko@google.com>
Mon, 27 Jul 2020 11:07:44 +0000 (13:07 +0200)
commita51829913dba28dae603fdcdddd242c7e20192a1
treeb25c5a77eab577d7719224e639c5c570aa4be686
parent1956cf1042d3c406d9e9cefe47d3b43adf2bdbe1
[mlir] Support for mutable types

Introduce support for mutable storage in the StorageUniquer infrastructure.
This makes MLIR have key-value storage instead of just uniqued key storage. A
storage instance now contains a unique immutable key and a mutable value, both
stored in the arena allocator that belongs to the context. This is a
preconditio for supporting recursive types that require delayed initialization,
in particular LLVM structure types.  The functionality is exercised in the test
pass with trivial self-recursive type. So far, recursive types can only be
printed in parsed in a closed type system. Removing this restriction is left
for future work.

Differential Revision: https://reviews.llvm.org/D84171
14 files changed:
mlir/docs/Tutorials/DefiningAttributesAndTypes.md
mlir/include/mlir/IR/AttributeSupport.h
mlir/include/mlir/IR/Attributes.h
mlir/include/mlir/IR/StorageUniquerSupport.h
mlir/include/mlir/IR/TypeSupport.h
mlir/include/mlir/IR/Types.h
mlir/include/mlir/Support/StorageUniquer.h
mlir/lib/Support/StorageUniquer.cpp
mlir/test/IR/recursive-type.mlir [new file with mode: 0644]
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/test/lib/Dialect/Test/TestTypes.h
mlir/test/lib/IR/CMakeLists.txt
mlir/test/lib/IR/TestTypes.cpp [new file with mode: 0644]
mlir/tools/mlir-opt/mlir-opt.cpp