[mlir][ods] Make Type- and AttrInterfaces also `Type`s and `Attr`s
authorMarkus Böck <markus.boeck02@gmail.com>
Wed, 6 Jul 2022 14:42:21 +0000 (16:42 +0200)
committerMarkus Böck <markus.boeck02@gmail.com>
Thu, 7 Jul 2022 09:54:47 +0000 (11:54 +0200)
commit9f186bb125d697786066f1fdd1d0c0e0479a3a4d
tree509fcac74aa4c3e9c65f08ec19f2a6895ec1045c
parent60d6be5dd3f411cfe1b5392cbbd6131d0ade2faa
[mlir][ods] Make Type- and AttrInterfaces also `Type`s and `Attr`s

By making TypeInterfaces and AttrInterfaces, Types and Attrs respectively it'd then be possible to use them anywhere where a Type or Attr may go. That is within the arguments and results of an Op definition, in a RewritePattern etc.

Prior to this change users had to separately define a Type or Attr, with a predicate to check whether a type or attribute implements a given interface. Such code will be redundant now.
Removing such occurrences in upstream dialects will be part of a separate patch.

As part of implementing this patch, slight refactoring had to be done. In particular, Interfaces cppClassName field was renamed to cppInterfaceName as it "clashed" with TypeConstraints cppClassName. In particular Interfaces cppClassName expected just the class name, without any namespaces, while TypeConstraints cppClassName expected a fully qualified class name.

Differential Revision: https://reviews.llvm.org/D129209
mlir/docs/PDLL.md
mlir/include/mlir/IR/OpBase.td
mlir/lib/TableGen/Interfaces.cpp
mlir/lib/Tools/PDLL/Parser/Parser.cpp
mlir/test/mlir-pdll/Parser/include_td.pdll
mlir/test/mlir-tblgen/interfaces-as-constraints.td [new file with mode: 0644]
mlir/tools/mlir-tblgen/OpFormatGen.cpp