This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Printing oilist element
ClosedPublic

Authored by shraiysh on Mar 14 2022, 1:24 AM.

Details

Summary

This patch attempts to deduce when the oilist element must be printed
based on the optional arguments to it. This especially helps creating
an operation accurately because with the current implementation, the
inferred unit attributes must be manually added to print the clauses
appropriately.

Diff Detail

Event Timeline

shraiysh created this revision.Mar 14 2022, 1:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2022, 1:24 AM
shraiysh requested review of this revision.Mar 14 2022, 1:24 AM
shraiysh updated this revision to Diff 415028.Mar 14 2022, 1:25 AM

Formatting.

rriddle requested changes to this revision.Mar 14 2022, 10:23 AM

Missing test cases?

This revision now requires changes to proceed.Mar 14 2022, 10:23 AM

Missing test cases?

Where should I add the testcases for this? This is basically an alternative implementation of printing (tests to check printing are already in the repo - mlir/test/IR/traits.mlir - they act as tests for this patch too). The builders will be benefiting from this implementation as they no longer will have to add the inferred attribute. I could not find a test file for testing builder functions or to check the generated C/C++ code for operations, but please let me know if there is one. (AFAICT mlir/test/mlir-tblgen/attr-or-type-format.td checks C++ code generated for attributes and types only).

shraiysh requested review of this revision.Mar 15 2022, 10:28 AM
shraiysh updated this revision to Diff 416289.Mar 17 2022, 12:50 PM

Added handling for unit attributes. Now no extra attributes are added because of the oilist element.

mlir/tools/mlir-tblgen/OpFormatGen.cpp
1197
1897

Nit: Curlies are probably not required here and in the other single line for statements.

2975

Nit: Braces not required.

shraiysh updated this revision to Diff 416828.Mar 21 2022, 12:00 AM

Addressed comments.

Mogball accepted this revision.Mar 21 2022, 1:24 PM
Mogball added inline comments.
mlir/tools/mlir-tblgen/OpFormatGen.cpp
1197

spell out the auto

1984

drop trivial braces (we should probably have a formatter for this..)

1988

spell out the auto

1995

add braces

2002

add braces

shraiysh updated this revision to Diff 417183.Mar 21 2022, 9:54 PM
shraiysh marked 8 inline comments as done.

Addressed comments, rebase with main.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 21 2022, 10:18 PM
This revision was automatically updated to reflect the committed changes.