[mlir][IR] Define the singleton builtin types in ODS instead of C++
authorRiver Riddle <riddleriver@gmail.com>
Tue, 15 Dec 2020 21:39:09 +0000 (13:39 -0800)
committerRiver Riddle <riddleriver@gmail.com>
Tue, 15 Dec 2020 21:42:19 +0000 (13:42 -0800)
commit95019de8a122619fc038c9fe3c80e625e3456bbf
tree6cc3fc195f7183b01dff6fd84a34c478bcb53971
parente1133179587dd895962a2fe4d6eb0cb1e63b5ee2
[mlir][IR] Define the singleton builtin types in ODS instead of C++

This exposes several issues with the current generation that this revision also fixes.
 * TypeDef now allows specifying the base class to use when generating.
 * TypeDef now inherits from DialectType, which allows for using it as a TypeConstraint
 * Parser/Printers are now no longer generated in the header(removing duplicate symbols), and are now only generated when necessary.
    - Now that generatedTypeParser/Printer are only generated in the definition file,
      existing users will need to manually expose this functionality when necessary.
 * ::get() is no longer generated for singleton types, because it isn't necessary.

Differential Revision: https://reviews.llvm.org/D93270
16 files changed:
mlir/docs/OpDefinitions.md
mlir/include/mlir/IR/BuiltinDialect.td [new file with mode: 0644]
mlir/include/mlir/IR/BuiltinOps.td
mlir/include/mlir/IR/BuiltinTypes.h
mlir/include/mlir/IR/BuiltinTypes.td [new file with mode: 0644]
mlir/include/mlir/IR/CMakeLists.txt
mlir/include/mlir/IR/OpBase.td
mlir/include/mlir/TableGen/TypeDef.h
mlir/lib/IR/BuiltinTypes.cpp
mlir/lib/IR/CMakeLists.txt
mlir/lib/TableGen/Constraint.cpp
mlir/lib/TableGen/TypeDef.cpp
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/test/lib/Dialect/Test/TestTypes.cpp
mlir/test/mlir-tblgen/typedefs.td
mlir/tools/mlir-tblgen/TypeDefGen.cpp