[mlir][ods] Support dialect specific content emission via hooks
authorLei Zhang <antiagainst@google.com>
Fri, 10 Jan 2020 16:24:47 +0000 (11:24 -0500)
committerLei Zhang <antiagainst@google.com>
Fri, 10 Jan 2020 23:39:28 +0000 (18:39 -0500)
commit397215cc309df1171a198b11cab3b241db9441db
tree3fa13872b42962acc0cb550bee37577fd6c34445
parentca4a55fabbbebef1752fd4e2913c28bb8b510621
[mlir][ods] Support dialect specific content emission via hooks

Thus far we can only generate the same set of methods even for
operations in different dialects. This is problematic for dialects that
want to generate additional operation class methods programmatically,
e.g., a special builder method or attribute getter method. Apparently
we cannot update the OpDefinitionsGen backend every time when such
a need arises. So this CL introduces a hook into the OpDefinitionsGen
backend to allow dialects to emit additional methods and traits to
operation classes.

Differential Revision: https://reviews.llvm.org/D72514
mlir/include/mlir/TableGen/ODSDialectHook.h [new file with mode: 0644]
mlir/include/mlir/TableGen/Operator.h
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp