@@ -204,7 +204,7 @@ def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]>
204204 }]>
205205 ];
206206
207- // Printing and parsing available in CIRDialect .cpp
207+ // Printing and parsing available in CIRAttrs .cpp
208208 let hasCustomAssemblyFormat = 1;
209209
210210 // Enable verifier.
@@ -215,6 +215,38 @@ def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]>
215215 }];
216216}
217217
218+ //===----------------------------------------------------------------------===//
219+ // ConstVectorAttr
220+ //===----------------------------------------------------------------------===//
221+
222+ def ConstVectorAttr : CIR_Attr<"ConstVector", "const_vector",
223+ [TypedAttrInterface]> {
224+ let summary = "A constant vector from ArrayAttr";
225+ let description = [{
226+ A CIR vector attribute is an array of literals of the specified attribute
227+ types.
228+ }];
229+
230+ let parameters = (ins AttributeSelfTypeParameter<"">:$type,
231+ "mlir::ArrayAttr":$elts);
232+
233+ // Define a custom builder for the type; that removes the need to pass in an
234+ // MLIRContext instance, as it can be inferred from the `type`.
235+ let builders = [
236+ AttrBuilderWithInferredContext<(ins "cir::VectorType":$type,
237+ "mlir::ArrayAttr":$elts), [{
238+ return $_get(type.getContext(), type, elts);
239+ }]>
240+ ];
241+
242+ let assemblyFormat = [{
243+ `<` $elts `>`
244+ }];
245+
246+ // Enable verifier.
247+ let genVerifyDecl = 1;
248+ }
249+
218250//===----------------------------------------------------------------------===//
219251// ConstPtrAttr
220252//===----------------------------------------------------------------------===//
0 commit comments