[mlir][IR] Define the singleton builtin types in ODS instead of C++

Authored by rriddle on Dec 15 2020, 1:39 PM.


[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

Event Timeline

kparzysz raised a concern with this commit.Dec 16 2020, 8:25 AM
kparzysz added a subscriber: kparzysz.

This commit broke compilation of debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp. The compile command for this file doesn't get the path to the tblgen-generated includes, and it fails with

In file included from /w/src/llvm.org/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp:2:
/w/src/llvm.org/llvm/../mlir/include/mlir/IR/BuiltinTypes.h:638:10: fatal error: 'mlir/IR/BuiltinTypes.h.inc' file not found
#include "mlir/IR/BuiltinTypes.h.inc"
1 error generated.
This commit now has outstanding concerns.Dec 16 2020, 8:25 AM
kparzysz accepted this commit.Thu, Jan 14, 8:16 AM

Mehdi has fixed this.

All concerns with this commit have now been addressed.Thu, Jan 14, 8:16 AM