[mlir:ODS] Deprecate Op parser/printer fields in favor of a new hasCustomAssemblyForm...
authorRiver Riddle <riddleriver@gmail.com>
Sat, 5 Feb 2022 04:47:01 +0000 (20:47 -0800)
committerRiver Riddle <riddleriver@gmail.com>
Tue, 8 Feb 2022 03:03:57 +0000 (19:03 -0800)
commitd7f0083dcae45e6bf774af23533a2d5e18aaf253
tree9f9e345c5105b994a1fb88bd328ba09b342322e3
parent45084eab5e63550bf2fdbf325d8fa5498263130d
[mlir:ODS] Deprecate Op parser/printer fields in favor of a new hasCustomAssemblyFormat field

Currently if an operation wants a C++ implemented parser/printer, it specifies inline
code blocks. This is quite problematic for various reasons, e.g. it requires defining
C++ inside of Tablegen which is discouraged when possible, but mainly because
nearly all usages simply forward to static functions (e.g. `static void parseSomeOp(...)`)
with users devising their own standards for how these are defined.

This commit adds support for a `hasCustomAssemblyFormat` bit field that specifies if
a C++ parser/printer is needed, and when set to 1 declares the parse/print methods for
operations to override. For migration purposes, the existing behavior is untouched. Upstream
usages will be replaced in a followup to keep this patch focused on the new implementation.

Differential Revision: https://reviews.llvm.org/D119054
mlir/include/mlir/IR/OpBase.td
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/test/lib/Dialect/Test/TestOps.td
mlir/test/mlir-tblgen/op-decl-and-defs.td
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp