llvm-project/mlir/lib/Target/SPIRV/Serialization
River Riddle 42e5f1d97b [mlir] Refactor how additional verification is specified in ODS
Currently if an operation requires additional verification, it specifies an inline
code block (`let verifier = "blah"`). 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 a static function `static LogicalResult verify(SomeOp op)`.
This commit adds support for a `hasVerifier` bit field that specifies if an additional verifier
is needed, and when set to `1` declares a `LogicalResult verify()` method 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 hasVerifier implementation.

One main user facing change is that what was one `MyOp::verify` is now `MyOp::verifyInvariants`.
This better matches the name this method is called everywhere else, and also frees up `verify` for
the user defined additional verification. The `verify` function when generated now (for additional
verification) is private to the operation class, which should also help avoid accidental usages after
this switch.

Differential Revision: https://reviews.llvm.org/D118742
2022-02-02 13:34:28 -08:00
..
CMakeLists.txt [MLIR][SPIRV] NFC: Split serialization code among multiple files. 2021-02-08 14:15:31 +01:00
Serialization.cpp [mlir][spirv] Add serialization control to emit symbol name 2021-12-10 19:20:49 -05:00
SerializeOps.cpp [mlir][spirv] Serialize selection with separate header block 2021-12-13 10:42:26 -05:00
Serializer.cpp [mlir] Refactor how additional verification is specified in ODS 2022-02-02 13:34:28 -08:00
Serializer.h [mlir][spirv] Fix nested control flow serialization 2021-12-11 14:47:19 -05:00