Hi all,
I’m trying to implement an std.constant
like operation that just takes integer operations, I’d like to use it as: %x = xyz.constant 42 : i32
. I’ve tried defining it like this, but I get a grammatical ambiguity between the colon in the attribute and the colon in the type descriptor:
def ConstantOp : XYZOp<"constant", [NoSideEffect, ConstantLike,
FirstAttrDerivedResultType]> {
let arguments = (ins APIntAttr:$value);
let results = (outs AnySignlessInteger:$result);
let assemblyFormat = [{
$value attr-dict `:` type($result)
}];
}
I can solve this by introducing extra punctuation, but I’d really like to tie the type of the attribute and the type of $result together. I would think the FirstAttrDerivedResultType
would be enough to do this, but it doesn’t seem to have any effect here.
Is there a way to achieve this, or is a custom parser/printer required?