This diff causes mlir-tblgen to generate code for an additional builder for an
operation argument with a return type that can be inferred *AND* an attribute in
the argument list can be "unwrapped." (Previously, the unwrapped build function
was only generated for builders with explicit return types in separate or
aggregate form.) As an example, this builder might be used by code that creates
operations that implement the SameOperandsAndResultType interface. A test case
was created.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Adding @mehdi_amini and @rriddle to reviewers to either review or suggest a reviewer...
Nice, thanks (I need to remove the hard coding on SameElement... there but that's not related here directly)
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | ||
---|---|---|
1656 | if any attribute ? (just to avoid a reading that all needs to be unwrappable) | |
1688 | Is the lambda even needed? Seems like we could just have it inlined here with returns changed to continue and horizontal whitespace reduced. Alternatively I'd avoid the array and do emit(AttrParamKind::WrappedAttr); emit(AttrParamKind::UnwrappedValue); to make it more locally obvious |
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | ||
---|---|---|
1688 | I was mimicking the code in genSeparateArgParamBuilder() - but that has a more elaborate emit() scenario. I agree that your suggestion is better - changed in updated commit. |
if any attribute ? (just to avoid a reading that all needs to be unwrappable)