This is an archive of the discontinued LLVM Phabricator instance.

[mlir][ods] Format: allow anchors in the else elements
ClosedPublic

Authored by Mogball on Sep 13 2022, 3:11 PM.

Details

Summary

This patch changes optional groups to allow anchors in the 'else'
element group. When printing, the optional condition is inverted to
decide which group to print. This is useful for parsing concrete
optional elements that don't have a parseOptional* method or some
other way to test whether it's present.

Depends on D133805

Diff Detail

Event Timeline

Mogball created this revision.Sep 13 2022, 3:11 PM
Mogball requested review of this revision.Sep 13 2022, 3:11 PM
Mogball updated this revision to Diff 459894.Sep 13 2022, 3:16 PM

update doc

Mogball updated this revision to Diff 459898.Sep 13 2022, 3:27 PM

fix erroneous delete

rriddle added inline comments.Sep 20 2022, 1:56 AM
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
787–791

This will only invert the first, is that intentional?

mlir/tools/mlir-tblgen/FormatGen.h
395

?

mlir/tools/mlir-tblgen/OpFormatGen.cpp
1180–1181

Please add parameter comments here and below for the true and false

1929–1930

Do we need to wrap the genOptionalGroupPrinterAnchor call with ( and )? i.e. will it ever generate something using ||/&&?

rriddle accepted this revision.Sep 20 2022, 2:01 AM
This revision is now accepted and ready to land.Sep 20 2022, 2:01 AM
Mogball marked 4 inline comments as done.Sep 20 2022, 10:55 AM
Mogball added inline comments.
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
787–791

yes good catch

mlir/tools/mlir-tblgen/OpFormatGen.cpp
1929–1930

No, not in this case. It only checks for single variables

Mogball updated this revision to Diff 461618.Sep 20 2022, 10:57 AM
Mogball marked 2 inline comments as done.

review comments

This revision was landed with ongoing or failed builds.Sep 20 2022, 11:08 AM
This revision was automatically updated to reflect the committed changes.