The attribute self type parameter is currently treated like any other attribute parameter in the assembly format. The self type parameter should be handled by the operation parser and printer and play no role in the generated parsers and printers of attributes.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks!
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp | ||
---|---|---|
237 | nit: Please drop the const here. |
Comment Actions
There's a further wrinkle here: attribute parsers embedded in operation assembly formats won't be able to have types.
def MyAttr : ... { let parameters = (ins "int":$a, AttributeSelfTypeParameter<"">:$type); let assemblyFormat = "$a"; } def MyOp : ... { let arguments = (ins MyAttr:$a); let assemblyFormat = "$a attr-dict" }
The pretty format won't be able to have a type because the parser directly invokes MyAttr::parse and won't be able to look ahead for the type.
Comment Actions
Can you just file a general bug for me to fix Attribute type handling in assembly formats (declarative and not)? There are also things surrounding type elision, providing types, etc. that should "just work" but we haven't invested in.
Comment Actions
Sure. I was thinking we needed a $type-elision directive or something in operation assembly formats.
nit: Please drop the const here.