================ @@ -215,6 +215,37 @@ def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]> }]; } +//===----------------------------------------------------------------------===// +// ConstVectorAttr +//===----------------------------------------------------------------------===// + +def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector", + [TypedAttrInterface]> { + let summary = "A constant vector from ArrayAttr"; + let description = [{ + A CIR vector attribute is an array of literals of the specified attribute + types. + }]; + + let parameters = (ins AttributeSelfTypeParameter<"">:$type, + "mlir::ArrayAttr":$elts); + + // Define a custom builder for the type; that removes the need to pass in an + // MLIRContext instance, as it can be inferred from the `type`. + let builders = [ + AttrBuilderWithInferredContext<(ins "cir::VectorType":$type, + "mlir::ArrayAttr":$elts), [{ + return $_get(type.getContext(), type, elts); + }]> + ]; + + // Printing and parsing available in CIRAttrs.cpp + let hasCustomAssemblyFormat = 1; ---------------- bcardosolopes wrote:
Have you tried to use a tablegen based asm fmt? The incubator impl is a bit outdated here - I don't see any real constraints these days blocking such approach. https://github.com/llvm/llvm-project/pull/137511 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits