@@ -98,13 +98,17 @@ class OpWithOffsetSizesAndStridesConstantArgumentFolder final
9898// /
9999// / If `valueTypes` is provided, the corresponding type of each dynamic value is
100100// / printed. Otherwise, the type is not printed. Each type must match the type
101- // / of the corresponding value in `values`. The type for integer elements is
102- // / `i64` by default and never printed.
103- // /
104- // / Integer indices can also be scalable, denoted with square brackets (e.g.,
105- // / "[2, [4], 8]"). For each value in `integers`, the corresponding `bool` in
106- // / `scalables` encodes whether it's a scalable index. If `scalables` is empty
107- // / then assume that all indices are non-scalable.
101+ // / of the corresponding value in `values`. `valueTypes` is redundant for
102+ // / printing as we can retrieve the types from the actual `values`. However,
103+ // / `valueTypes` is needed for parsing and we must keep the API symmetric for
104+ // / parsing and printing. The type for integer elements is `i64` by default and
105+ // / never printed.
106+ // /
107+ // / Integer indices can also be scalable in the context of scalable vectors,
108+ // / denoted by square brackets (e.g., "[2, [4], 8]"). For each value in
109+ // / `integers`, the corresponding `bool` in `scalableFlags` encodes whether it's
110+ // / a scalable index. If `scalableFlags` is empty then assume that all indices
111+ // / are non-scalable.
108112// /
109113// / Examples:
110114// /
@@ -122,21 +126,21 @@ class OpWithOffsetSizesAndStridesConstantArgumentFolder final
122126// /
123127// / * Input: `integers = [2, 4, 8]`,
124128// / `values = []` and
125- // / `scalables = [false, true, false]`
129+ // / `scalableFlags = [false, true, false]`
126130// / prints:
127131// / `[2, [4], 8]`
128132// /
129133void printDynamicIndexList (
130134 OpAsmPrinter &printer, Operation *op, OperandRange values,
131- ArrayRef<int64_t > integers, ArrayRef<bool > scalables ,
135+ ArrayRef<int64_t > integers, ArrayRef<bool > scalableFlags ,
132136 TypeRange valueTypes = TypeRange(),
133137 AsmParser::Delimiter delimiter = AsmParser::Delimiter::Square);
134138inline void printDynamicIndexList (
135139 OpAsmPrinter &printer, Operation *op, OperandRange values,
136140 ArrayRef<int64_t > integers, TypeRange valueTypes = TypeRange(),
137141 AsmParser::Delimiter delimiter = AsmParser::Delimiter::Square) {
138- return printDynamicIndexList (printer, op, values, integers, /* scalables= */ {},
139- valueTypes, delimiter);
142+ return printDynamicIndexList (printer, op, values, integers,
143+ /* scalableFlags= */ {}, valueTypes, delimiter);
140144}
141145
142146// / Parser hooks for custom directive in assemblyFormat.
@@ -151,38 +155,41 @@ inline void printDynamicIndexList(
151155// / values to `values` in-order.
152156// /
153157// / If `valueTypes` is provided, fill it with the types corresponding to each
154- // / value in `values`. Otherwise, the caller must handle the types.
158+ // / value in `values`. Otherwise, the caller must handle the types and parsing
159+ // / will fail if the type of the value is found (e.g., `[%arg0 : index, 3, %arg1
160+ // / : index]`).
155161// /
156- // / Integer indices can also be scalable, denoted by the square bracket (e.g.,
157- // / "[2, [4], 8]"). For each value in `integers`, the corresponding `bool` in
158- // / `scalables` encodes whether it's a scalable index.
162+ // / Integer indices can also be scalable in the context of scalable vectors,
163+ // / denoted by square brackets (e.g., "[2, [4], 8]"). For each value in
164+ // / `integers`, the corresponding `bool` in `scalableFlags` encodes whether it's
165+ // / a scalable index.
159166// /
160167// / Examples:
161168// /
162169// / * After parsing "[%arg0 : index, 7, 42, %arg42 : i32]":
163170// / 1. `result` is filled with `[kDynamic, 7, 42, kDynamic]`
164171// / 2. `values` is filled with "[%arg0, %arg1]".
165- // / 3. `scalables ` is filled with `[false, true, false]`.
172+ // / 3. `scalableFlags ` is filled with `[false, true, false]`.
166173// /
167174// / * After parsing `[2, [4], 8]`:
168175// / 1. `result` is filled with `[2, 4, 8]`
169176// / 2. `values` is empty.
170- // / 3. `scalables ` is filled with `[false, true, false]`.
177+ // / 3. `scalableFlags ` is filled with `[false, true, false]`.
171178// /
172179ParseResult parseDynamicIndexList (
173180 OpAsmParser &parser,
174181 SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
175- DenseI64ArrayAttr &integers, DenseBoolArrayAttr &scalables ,
182+ DenseI64ArrayAttr &integers, DenseBoolArrayAttr &scalableFlags ,
176183 SmallVectorImpl<Type> *valueTypes = nullptr ,
177184 AsmParser::Delimiter delimiter = AsmParser::Delimiter::Square);
178185inline ParseResult parseDynamicIndexList (
179186 OpAsmParser &parser,
180187 SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
181188 DenseI64ArrayAttr &integers, SmallVectorImpl<Type> *valueTypes = nullptr ,
182189 AsmParser::Delimiter delimiter = AsmParser::Delimiter::Square) {
183- DenseBoolArrayAttr scalables ;
184- return parseDynamicIndexList (parser, values, integers, scalables, valueTypes ,
185- delimiter);
190+ DenseBoolArrayAttr scalableFlags ;
191+ return parseDynamicIndexList (parser, values, integers, scalableFlags ,
192+ valueTypes, delimiter);
186193}
187194
188195// / Verify that a the `values` has as many elements as the number of entries in
0 commit comments