Add custom attribute for complex dialect. Although this commit does not have significant impact on the conversion framework, it will lead us to construct complex numbers in a readable and tidy manner.
Related discussion: https://reviews.llvm.org/D127476
I wonder whether it would make sense to use FloatAttr here?
Something like:
let parameters = (ins AttributeSelfTypeParameter<"">:$type, "mlir::FloatAttr":$real, "mlir::FloatAttr":$imag);
And then you could have a convenience builder that also allows to build from APFloat:
let builders = [ AttrBuilderWithInferredContext< (ins "ComplexType":$type, "APFloat":$real, "APFloat":$imag), [{ auto elementType = type.getElementType(); auto realFloat = FloatAttr::get(elementType, real); auto imagFloat = FloatAttr::get(elementType, imag); return $_get(type.getContext(), type, realFloat, imagFloat); }]> ];