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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
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).
Added handling for unit attributes. Now no extra attributes are added because of the oilist element.
mlir/tools/mlir-tblgen/OpFormatGen.cpp | ||
---|---|---|
1200 | Nit: Curlies are probably required here. https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements | |
1892 | Nit: Curlies are probably not required here and in the other single line for statements. | |
2970 | Nit: Braces not required. |
Nit: Curlies are probably required here. https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements