[mlir][ODS] Add support for optional operands and results with a new Optional directive.
authorRiver Riddle <riddleriver@gmail.com>
Fri, 10 Apr 2020 21:11:45 +0000 (14:11 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Fri, 10 Apr 2020 21:12:06 +0000 (14:12 -0700)
commitaba1acc89c653b2cc08cccfb754ff16994a05332
treeb678bbce7f3339b04fa606e32e1a8862909fd330
parent2a922da3a95f77a0eec96eab9ebc8c1ff090fb8c
[mlir][ODS] Add support for optional operands and results with a new Optional directive.

Summary: This revision adds support for specifying operands or results as "optional". This is a special case of variadic where the number of elements is either 0 or 1. Operands and results of this kind will have accessors generated using Value instead of the range types, making it more natural to interface with.

Differential Revision: https://reviews.llvm.org/D77863
21 files changed:
mlir/docs/OpDefinitions.md
mlir/include/mlir/IR/OpBase.td
mlir/include/mlir/IR/OpImplementation.h
mlir/include/mlir/TableGen/Argument.h
mlir/include/mlir/TableGen/Operator.h
mlir/include/mlir/TableGen/Type.h
mlir/lib/Parser/Parser.cpp
mlir/lib/TableGen/Argument.cpp
mlir/lib/TableGen/Operator.cpp
mlir/lib/TableGen/Pattern.cpp
mlir/lib/TableGen/Type.cpp
mlir/test/lib/Dialect/Test/TestOps.td
mlir/test/mlir-tblgen/op-decl.td
mlir/test/mlir-tblgen/op-format-spec.td
mlir/test/mlir-tblgen/op-format.mlir
mlir/test/mlir-tblgen/predicate.td
mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
mlir/tools/mlir-tblgen/OpFormatGen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp
mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp