Page MenuHomePhabricator

[mlir][ODS] Add support for optional operands and results with a new Optional directive.
ClosedPublic

Authored by rriddle on Apr 10 2020, 1:32 AM.

Details

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.

Diff Detail

Event Timeline

rriddle created this revision.Apr 10 2020, 1:32 AM
antiagainst accepted this revision.Apr 10 2020, 9:54 AM

Nice! Thnks River!

mlir/docs/OpDefinitions.md
225

nit: space before (

228

Also mention AttrSizedOperandSegments?

mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
1103

Nit: else would be better here. We don't have a large body of code following this anyway.

mlir/tools/mlir-tblgen/OpFormatGen.cpp
488

remove trailing s

This revision is now accepted and ready to land.Apr 10 2020, 9:54 AM
rriddle updated this revision to Diff 256640.Apr 10 2020, 1:13 PM
rriddle marked 4 inline comments as done.

Resolve comments

This revision was automatically updated to reflect the committed changes.