Index: flang/include/flang/Optimizer/Dialect/FIROps.h =================================================================== --- flang/include/flang/Optimizer/Dialect/FIROps.h +++ flang/include/flang/Optimizer/Dialect/FIROps.h @@ -33,7 +33,7 @@ mlir::OperationState &result); mlir::ParseResult parseSelector(mlir::OpAsmParser &parser, mlir::OperationState &result, - mlir::OpAsmParser::OperandType &selector, + mlir::OpAsmParser::UnresolvedOperand &selector, mlir::Type &type); static constexpr llvm::StringRef getAdaptToByRefAttrName() { Index: flang/lib/Optimizer/Dialect/FIROps.cpp =================================================================== --- flang/lib/Optimizer/Dialect/FIROps.cpp +++ flang/lib/Optimizer/Dialect/FIROps.cpp @@ -94,7 +94,7 @@ return mlir::failure(); auto &builder = parser.getBuilder(); result.addAttribute("in_type", mlir::TypeAttr::get(intype)); - llvm::SmallVector operands; + llvm::SmallVector operands; llvm::SmallVector typeVec; bool hasOperands = false; std::int32_t typeparamsSize = 0; @@ -627,7 +627,7 @@ mlir::ParseResult fir::CallOp::parse(mlir::OpAsmParser &parser, mlir::OperationState &result) { - llvm::SmallVector operands; + llvm::SmallVector operands; if (parser.parseOperandList(operands)) return mlir::failure(); @@ -654,7 +654,8 @@ return mlir::failure(); } else { auto funcArgs = - llvm::ArrayRef(operands).drop_front(); + llvm::ArrayRef(operands) + .drop_front(); if (parser.resolveOperand(operands[0], funcType, result.operands) || parser.resolveOperands(funcArgs, funcType.getInputs(), parser.getNameLoc(), result.operands)) @@ -707,7 +708,7 @@ template static mlir::ParseResult parseCmpOp(mlir::OpAsmParser &parser, mlir::OperationState &result) { - llvm::SmallVector ops; + llvm::SmallVector ops; mlir::NamedAttrList attrs; mlir::Attribute predicateNameAttr; mlir::Type type; @@ -895,13 +896,13 @@ mlir::ParseResult CoordinateOp::parse(mlir::OpAsmParser &parser, mlir::OperationState &result) { - mlir::OpAsmParser::OperandType memref; + mlir::OpAsmParser::UnresolvedOperand memref; if (parser.parseOperand(memref) || parser.parseComma()) return mlir::failure(); - llvm::SmallVector coorOperands; + llvm::SmallVector coorOperands; if (parser.parseOperandList(coorOperands)) return mlir::failure(); - llvm::SmallVector allOperands; + llvm::SmallVector allOperands; allOperands.push_back(memref); allOperands.append(coorOperands.begin(), coorOperands.end()); mlir::FunctionType funcTy; @@ -955,7 +956,7 @@ mlir::ParseResult DispatchOp::parse(mlir::OpAsmParser &parser, mlir::OperationState &result) { mlir::FunctionType calleeType; - llvm::SmallVector operands; + llvm::SmallVector operands; auto calleeLoc = parser.getNameLoc(); llvm::StringRef calleeName; if (failed(parser.parseOptionalKeyword(&calleeName))) { @@ -1100,7 +1101,7 @@ if (parser.parseAttribute(procRef, "funcname", result.attributes)) return mlir::failure(); bool hasTuple = false; - mlir::OpAsmParser::OperandType tupleRef; + mlir::OpAsmParser::UnresolvedOperand tupleRef; if (!parser.parseOptionalComma()) { if (parser.parseOperand(tupleRef)) return mlir::failure(); @@ -1376,7 +1377,7 @@ result.addAttribute(fir::FieldIndexOp::typeAttrName(), mlir::TypeAttr::get(recty)); if (!parser.parseOptionalLParen()) { - llvm::SmallVector operands; + llvm::SmallVector operands; llvm::SmallVector types; auto loc = parser.getNameLoc(); if (parser.parseOperandList(operands, mlir::OpAsmParser::Delimiter::None) || @@ -1591,7 +1592,7 @@ mlir::ParseResult IterWhileOp::parse(mlir::OpAsmParser &parser, mlir::OperationState &result) { auto &builder = parser.getBuilder(); - mlir::OpAsmParser::OperandType inductionVariable, lb, ub, step; + mlir::OpAsmParser::UnresolvedOperand inductionVariable, lb, ub, step; if (parser.parseLParen() || parser.parseRegionArgument(inductionVariable) || parser.parseEqual()) return mlir::failure(); @@ -1608,7 +1609,7 @@ parser.resolveOperand(step, indexType, result.operands)) return mlir::failure(); - mlir::OpAsmParser::OperandType iterateVar, iterateInput; + mlir::OpAsmParser::UnresolvedOperand iterateVar, iterateInput; if (parser.parseKeyword("and") || parser.parseLParen() || parser.parseRegionArgument(iterateVar) || parser.parseEqual() || parser.parseOperand(iterateInput) || parser.parseRParen() || @@ -1616,7 +1617,7 @@ return mlir::failure(); // Parse the initial iteration arguments. - llvm::SmallVector regionArgs; + llvm::SmallVector regionArgs; auto prependCount = false; // Induction variable. @@ -1624,7 +1625,7 @@ regionArgs.push_back(iterateVar); if (succeeded(parser.parseOptionalKeyword("iter_args"))) { - llvm::SmallVector operands; + llvm::SmallVector operands; llvm::SmallVector regionTypes; // Parse assignment list and results type list. if (parser.parseAssignmentList(regionArgs, operands) || @@ -1860,7 +1861,7 @@ mlir::ParseResult LoadOp::parse(mlir::OpAsmParser &parser, mlir::OperationState &result) { mlir::Type type; - mlir::OpAsmParser::OperandType oper; + mlir::OpAsmParser::UnresolvedOperand oper; if (parser.parseOperand(oper) || parser.parseOptionalAttrDict(result.attributes) || parser.parseColonType(type) || @@ -1915,7 +1916,7 @@ mlir::ParseResult DoLoopOp::parse(mlir::OpAsmParser &parser, mlir::OperationState &result) { auto &builder = parser.getBuilder(); - mlir::OpAsmParser::OperandType inductionVariable, lb, ub, step; + mlir::OpAsmParser::UnresolvedOperand inductionVariable, lb, ub, step; // Parse the induction variable followed by '='. if (parser.parseRegionArgument(inductionVariable) || parser.parseEqual()) return mlir::failure(); @@ -1934,7 +1935,7 @@ result.addAttribute("unordered", builder.getUnitAttr()); // Parse the optional initial iteration arguments. - llvm::SmallVector regionArgs, operands; + llvm::SmallVector regionArgs, operands; llvm::SmallVector argTypes; auto prependCount = false; regionArgs.push_back(inductionVariable); @@ -2346,7 +2347,7 @@ static mlir::ParseResult parseIntegralSwitchTerminator( mlir::OpAsmParser &parser, mlir::OperationState &result, llvm::StringRef casesAttr, llvm::StringRef operandSegmentAttr) { - mlir::OpAsmParser::OperandType selector; + mlir::OpAsmParser::UnresolvedOperand selector; mlir::Type type; if (parseSelector(parser, result, selector, type)) return mlir::failure(); @@ -2556,13 +2557,13 @@ // parser for fir.select_case Op mlir::ParseResult SelectCaseOp::parse(mlir::OpAsmParser &parser, mlir::OperationState &result) { - mlir::OpAsmParser::OperandType selector; + mlir::OpAsmParser::UnresolvedOperand selector; mlir::Type type; if (parseSelector(parser, result, selector, type)) return mlir::failure(); llvm::SmallVector attrs; - llvm::SmallVector opers; + llvm::SmallVector opers; llvm::SmallVector dests; llvm::SmallVector> destArgs; llvm::SmallVector argOffs; @@ -2579,8 +2580,8 @@ if (attr.dyn_cast_or_null()) { argOffs.push_back(0); } else if (attr.dyn_cast_or_null()) { - mlir::OpAsmParser::OperandType oper1; - mlir::OpAsmParser::OperandType oper2; + mlir::OpAsmParser::UnresolvedOperand oper1; + mlir::OpAsmParser::UnresolvedOperand oper2; if (parser.parseOperand(oper1) || parser.parseComma() || parser.parseOperand(oper2) || parser.parseComma()) return mlir::failure(); @@ -2589,7 +2590,7 @@ argOffs.push_back(2); offSize += 2; } else { - mlir::OpAsmParser::OperandType oper; + mlir::OpAsmParser::UnresolvedOperand oper; if (parser.parseOperand(oper) || parser.parseComma()) return mlir::failure(); opers.push_back(oper); @@ -2861,7 +2862,7 @@ } ParseResult SelectTypeOp::parse(OpAsmParser &parser, OperationState &result) { - mlir::OpAsmParser::OperandType selector; + mlir::OpAsmParser::UnresolvedOperand selector; mlir::Type type; if (parseSelector(parser, result, selector, type)) return mlir::failure(); @@ -3075,8 +3076,8 @@ mlir::ParseResult StoreOp::parse(mlir::OpAsmParser &parser, mlir::OperationState &result) { mlir::Type type; - mlir::OpAsmParser::OperandType oper; - mlir::OpAsmParser::OperandType store; + mlir::OpAsmParser::UnresolvedOperand oper; + mlir::OpAsmParser::UnresolvedOperand store; if (parser.parseOperand(oper) || parser.parseKeyword("to") || parser.parseOperand(store) || parser.parseOptionalAttrDict(result.attributes) || @@ -3274,7 +3275,7 @@ mlir::Region *elseRegion = result.addRegion(); auto &builder = parser.getBuilder(); - OpAsmParser::OperandType cond; + OpAsmParser::UnresolvedOperand cond; mlir::Type i1Type = builder.getIntegerType(1); if (parser.parseOperand(cond) || parser.resolveOperand(cond, i1Type, result.operands)) @@ -3363,10 +3364,10 @@ return o; } -mlir::ParseResult fir::parseSelector(mlir::OpAsmParser &parser, - mlir::OperationState &result, - mlir::OpAsmParser::OperandType &selector, - mlir::Type &type) { +mlir::ParseResult +fir::parseSelector(mlir::OpAsmParser &parser, mlir::OperationState &result, + mlir::OpAsmParser::UnresolvedOperand &selector, + mlir::Type &type) { if (parser.parseOperand(selector) || parser.parseColonType(type) || parser.resolveOperand(selector, type, result.operands) || parser.parseLSquare()) Index: mlir/docs/OpDefinitions.md =================================================================== --- mlir/docs/OpDefinitions.md +++ mlir/docs/OpDefinitions.md @@ -778,11 +778,11 @@ - Single: `(e.g. Attribute) &` - Optional: `(e.g. Attribute) &` * Operand Variables - - Single: `OpAsmParser::OperandType &` - - Optional: `Optional &` - - Variadic: `SmallVectorImpl &` + - Single: `OpAsmParser::UnresolvedOperand &` + - Optional: `Optional &` + - Variadic: `SmallVectorImpl &` - VariadicOfVariadic: - `SmallVectorImpl> &` + `SmallVectorImpl> &` * Ref Directives - A reference directive is passed to the parser using the same mapping as the input operand. For example, a single region would be passed as a Index: mlir/docs/Tutorials/Toy/Ch-2.md =================================================================== --- mlir/docs/Tutorials/Toy/Ch-2.md +++ mlir/docs/Tutorials/Toy/Ch-2.md @@ -639,7 +639,7 @@ mlir::OperationState &result) { // Parse the input operand, the attribute dictionary, and the type of the // input. - mlir::OpAsmParser::OperandType inputOperand; + mlir::OpAsmParser::UnresolvedOperand inputOperand; mlir::Type inputType; if (parser.parseOperand(inputOperand) || parser.parseOptionalAttrDict(result.attributes) || parser.parseColon() || Index: mlir/examples/toy/Ch2/mlir/Dialect.cpp =================================================================== --- mlir/examples/toy/Ch2/mlir/Dialect.cpp +++ mlir/examples/toy/Ch2/mlir/Dialect.cpp @@ -44,7 +44,7 @@ /// of 'printBinaryOp' below. static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser, mlir::OperationState &result) { - SmallVector operands; + SmallVector operands; SMLoc operandsLoc = parser.getCurrentLocation(); Type type; if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) || Index: mlir/examples/toy/Ch3/mlir/Dialect.cpp =================================================================== --- mlir/examples/toy/Ch3/mlir/Dialect.cpp +++ mlir/examples/toy/Ch3/mlir/Dialect.cpp @@ -44,7 +44,7 @@ /// of 'printBinaryOp' below. static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser, mlir::OperationState &result) { - SmallVector operands; + SmallVector operands; SMLoc operandsLoc = parser.getCurrentLocation(); Type type; if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) || Index: mlir/examples/toy/Ch4/mlir/Dialect.cpp =================================================================== --- mlir/examples/toy/Ch4/mlir/Dialect.cpp +++ mlir/examples/toy/Ch4/mlir/Dialect.cpp @@ -106,7 +106,7 @@ /// of 'printBinaryOp' below. static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser, mlir::OperationState &result) { - SmallVector operands; + SmallVector operands; SMLoc operandsLoc = parser.getCurrentLocation(); Type type; if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) || Index: mlir/examples/toy/Ch5/mlir/Dialect.cpp =================================================================== --- mlir/examples/toy/Ch5/mlir/Dialect.cpp +++ mlir/examples/toy/Ch5/mlir/Dialect.cpp @@ -106,7 +106,7 @@ /// of 'printBinaryOp' below. static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser, mlir::OperationState &result) { - SmallVector operands; + SmallVector operands; SMLoc operandsLoc = parser.getCurrentLocation(); Type type; if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) || Index: mlir/examples/toy/Ch6/mlir/Dialect.cpp =================================================================== --- mlir/examples/toy/Ch6/mlir/Dialect.cpp +++ mlir/examples/toy/Ch6/mlir/Dialect.cpp @@ -106,7 +106,7 @@ /// of 'printBinaryOp' below. static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser, mlir::OperationState &result) { - SmallVector operands; + SmallVector operands; SMLoc operandsLoc = parser.getCurrentLocation(); Type type; if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) || Index: mlir/examples/toy/Ch7/mlir/Dialect.cpp =================================================================== --- mlir/examples/toy/Ch7/mlir/Dialect.cpp +++ mlir/examples/toy/Ch7/mlir/Dialect.cpp @@ -93,7 +93,7 @@ /// of 'printBinaryOp' below. static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser, mlir::OperationState &result) { - SmallVector operands; + SmallVector operands; SMLoc operandsLoc = parser.getCurrentLocation(); Type type; if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) || Index: mlir/include/mlir/IR/FunctionImplementation.h =================================================================== --- mlir/include/mlir/IR/FunctionImplementation.h +++ mlir/include/mlir/IR/FunctionImplementation.h @@ -58,7 +58,7 @@ /// attributes and locations of the arguments. ParseResult parseFunctionArgumentList( OpAsmParser &parser, bool allowAttributes, bool allowVariadic, - SmallVectorImpl &argNames, + SmallVectorImpl &argNames, SmallVectorImpl &argTypes, SmallVectorImpl &argAttrs, SmallVectorImpl &argLocations, bool &isVariadic); @@ -66,14 +66,13 @@ /// indicates whether functions with variadic arguments are supported. The /// trailing arguments are populated by this function with names, types, /// attributes and locations of the arguments and those of the results. -ParseResult -parseFunctionSignature(OpAsmParser &parser, bool allowVariadic, - SmallVectorImpl &argNames, - SmallVectorImpl &argTypes, - SmallVectorImpl &argAttrs, - SmallVectorImpl &argLocations, - bool &isVariadic, SmallVectorImpl &resultTypes, - SmallVectorImpl &resultAttrs); +ParseResult parseFunctionSignature( + OpAsmParser &parser, bool allowVariadic, + SmallVectorImpl &argNames, + SmallVectorImpl &argTypes, SmallVectorImpl &argAttrs, + SmallVectorImpl &argLocations, bool &isVariadic, + SmallVectorImpl &resultTypes, + SmallVectorImpl &resultAttrs); /// Parser implementation for function-like operations. Uses /// `funcTypeBuilder` to construct the custom function type given lists of Index: mlir/include/mlir/IR/OpImplementation.h =================================================================== --- mlir/include/mlir/IR/OpImplementation.h +++ mlir/include/mlir/IR/OpImplementation.h @@ -1083,10 +1083,10 @@ //===--------------------------------------------------------------------===// /// This is the representation of an operand reference. - struct OperandType { - SMLoc location; // Location of the token. - StringRef name; // Value name, e.g. %42 or %abc - unsigned number; // Number, e.g. 12 for an operand like %xyz#12 + struct UnresolvedOperand { + SMLoc location; // Location of the token. + StringRef name; // Value name, e.g. %42 or %abc + unsigned number; // Number, e.g. 12 for an operand like %xyz#12 }; /// Parse different components, viz., use-info of operand(s), successor(s), @@ -1096,7 +1096,7 @@ /// skip parsing that component. virtual ParseResult parseGenericOperationAfterOpName( OperationState &result, - Optional> parsedOperandType = llvm::None, + Optional> parsedOperandType = llvm::None, Optional> parsedSuccessors = llvm::None, Optional>> parsedRegions = llvm::None, @@ -1104,18 +1104,19 @@ Optional parsedFnType = llvm::None) = 0; /// Parse a single operand. - virtual ParseResult parseOperand(OperandType &result) = 0; + virtual ParseResult parseOperand(UnresolvedOperand &result) = 0; /// Parse a single operand if present. - virtual OptionalParseResult parseOptionalOperand(OperandType &result) = 0; + virtual OptionalParseResult + parseOptionalOperand(UnresolvedOperand &result) = 0; /// Parse zero or more SSA comma-separated operand references with a specified /// surrounding delimiter, and an optional required operand count. virtual ParseResult - parseOperandList(SmallVectorImpl &result, + parseOperandList(SmallVectorImpl &result, int requiredOperandCount = -1, Delimiter delimiter = Delimiter::None) = 0; - ParseResult parseOperandList(SmallVectorImpl &result, + ParseResult parseOperandList(SmallVectorImpl &result, Delimiter delimiter) { return parseOperandList(result, /*requiredOperandCount=*/-1, delimiter); } @@ -1124,23 +1125,25 @@ /// references with a specified surrounding delimiter, and an optional /// required operand count. A leading comma is expected before the operands. virtual ParseResult - parseTrailingOperandList(SmallVectorImpl &result, + parseTrailingOperandList(SmallVectorImpl &result, int requiredOperandCount = -1, Delimiter delimiter = Delimiter::None) = 0; - ParseResult parseTrailingOperandList(SmallVectorImpl &result, - Delimiter delimiter) { + ParseResult + parseTrailingOperandList(SmallVectorImpl &result, + Delimiter delimiter) { return parseTrailingOperandList(result, /*requiredOperandCount=*/-1, delimiter); } /// Resolve an operand to an SSA value, emitting an error on failure. - virtual ParseResult resolveOperand(const OperandType &operand, Type type, + virtual ParseResult resolveOperand(const UnresolvedOperand &operand, + Type type, SmallVectorImpl &result) = 0; /// Resolve a list of operands to SSA values, emitting an error on failure, or /// appending the results to the list on success. This method should be used /// when all operands have the same type. - ParseResult resolveOperands(ArrayRef operands, Type type, + ParseResult resolveOperands(ArrayRef operands, Type type, SmallVectorImpl &result) { for (auto elt : operands) if (resolveOperand(elt, type, result)) @@ -1151,7 +1154,7 @@ /// Resolve a list of operands and a list of operand types to SSA values, /// emitting an error and returning failure, or appending the results /// to the list on success. - ParseResult resolveOperands(ArrayRef operands, + ParseResult resolveOperands(ArrayRef operands, ArrayRef types, SMLoc loc, SmallVectorImpl &result) { if (operands.size() != types.size()) @@ -1190,16 +1193,17 @@ /// Operand values must come from single-result sources, and be valid /// dimensions/symbol identifiers according to mlir::isValidDim/Symbol. virtual ParseResult - parseAffineMapOfSSAIds(SmallVectorImpl &operands, Attribute &map, - StringRef attrName, NamedAttrList &attrs, + parseAffineMapOfSSAIds(SmallVectorImpl &operands, + Attribute &map, StringRef attrName, + NamedAttrList &attrs, Delimiter delimiter = Delimiter::Square) = 0; /// Parses an affine expression where dims and symbols are SSA operands. /// Operand values must come from single-result sources, and be valid /// dimensions/symbol identifiers according to mlir::isValidDim/Symbol. virtual ParseResult - parseAffineExprOfSSAIds(SmallVectorImpl &dimOperands, - SmallVectorImpl &symbOperands, + parseAffineExprOfSSAIds(SmallVectorImpl &dimOperands, + SmallVectorImpl &symbOperands, AffineExpr &expr) = 0; //===--------------------------------------------------------------------===// @@ -1215,46 +1219,48 @@ /// scope. 'enableNameShadowing' can only be set to true for regions attached /// to operations that are 'IsolatedFromAbove'. virtual ParseResult parseRegion(Region ®ion, - ArrayRef arguments = {}, + ArrayRef arguments = {}, ArrayRef argTypes = {}, ArrayRef argLocations = {}, bool enableNameShadowing = false) = 0; /// Parses a region if present. - virtual OptionalParseResult - parseOptionalRegion(Region ®ion, ArrayRef arguments = {}, - ArrayRef argTypes = {}, - ArrayRef argLocations = {}, - bool enableNameShadowing = false) = 0; + virtual OptionalParseResult parseOptionalRegion( + Region ®ion, ArrayRef arguments = {}, + ArrayRef argTypes = {}, ArrayRef argLocations = {}, + bool enableNameShadowing = false) = 0; /// Parses a region if present. If the region is present, a new region is /// allocated and placed in `region`. If no region is present or on failure, /// `region` remains untouched. - virtual OptionalParseResult parseOptionalRegion( - std::unique_ptr ®ion, ArrayRef arguments = {}, - ArrayRef argTypes = {}, bool enableNameShadowing = false) = 0; + virtual OptionalParseResult + parseOptionalRegion(std::unique_ptr ®ion, + ArrayRef arguments = {}, + ArrayRef argTypes = {}, + bool enableNameShadowing = false) = 0; /// Parse a region argument, this argument is resolved when calling /// 'parseRegion'. - virtual ParseResult parseRegionArgument(OperandType &argument) = 0; + virtual ParseResult parseRegionArgument(UnresolvedOperand &argument) = 0; /// Parse zero or more region arguments with a specified surrounding /// delimiter, and an optional required argument count. Region arguments /// define new values; so this also checks if values with the same names have /// not been defined yet. virtual ParseResult - parseRegionArgumentList(SmallVectorImpl &result, + parseRegionArgumentList(SmallVectorImpl &result, int requiredOperandCount = -1, Delimiter delimiter = Delimiter::None) = 0; virtual ParseResult - parseRegionArgumentList(SmallVectorImpl &result, + parseRegionArgumentList(SmallVectorImpl &result, Delimiter delimiter) { return parseRegionArgumentList(result, /*requiredOperandCount=*/-1, delimiter); } /// Parse a region argument if present. - virtual ParseResult parseOptionalRegionArgument(OperandType &argument) = 0; + virtual ParseResult + parseOptionalRegionArgument(UnresolvedOperand &argument) = 0; //===--------------------------------------------------------------------===// // Successor Parsing @@ -1276,8 +1282,8 @@ /// Parse a list of assignments of the form /// (%x1 = %y1, %x2 = %y2, ...) - ParseResult parseAssignmentList(SmallVectorImpl &lhs, - SmallVectorImpl &rhs) { + ParseResult parseAssignmentList(SmallVectorImpl &lhs, + SmallVectorImpl &rhs) { OptionalParseResult result = parseOptionalAssignmentList(lhs, rhs); if (!result.hasValue()) return emitError(getCurrentLocation(), "expected '('"); @@ -1285,14 +1291,15 @@ } virtual OptionalParseResult - parseOptionalAssignmentList(SmallVectorImpl &lhs, - SmallVectorImpl &rhs) = 0; + parseOptionalAssignmentList(SmallVectorImpl &lhs, + SmallVectorImpl &rhs) = 0; /// Parse a list of assignments of the form /// (%x1 = %y1 : type1, %x2 = %y2 : type2, ...) - ParseResult parseAssignmentListWithTypes(SmallVectorImpl &lhs, - SmallVectorImpl &rhs, - SmallVectorImpl &types) { + ParseResult + parseAssignmentListWithTypes(SmallVectorImpl &lhs, + SmallVectorImpl &rhs, + SmallVectorImpl &types) { OptionalParseResult result = parseOptionalAssignmentListWithTypes(lhs, rhs, types); if (!result.hasValue()) @@ -1301,17 +1308,17 @@ } virtual OptionalParseResult - parseOptionalAssignmentListWithTypes(SmallVectorImpl &lhs, - SmallVectorImpl &rhs, + parseOptionalAssignmentListWithTypes(SmallVectorImpl &lhs, + SmallVectorImpl &rhs, SmallVectorImpl &types) = 0; private: /// Parse either an operand list or a region argument list depending on /// whether isOperandList is true. - ParseResult parseOperandOrRegionArgList(SmallVectorImpl &result, - bool isOperandList, - int requiredOperandCount, - Delimiter delimiter); + ParseResult + parseOperandOrRegionArgList(SmallVectorImpl &result, + bool isOperandList, int requiredOperandCount, + Delimiter delimiter); }; //===--------------------------------------------------------------------===// Index: mlir/include/mlir/Interfaces/ViewLikeInterface.h =================================================================== --- mlir/include/mlir/Interfaces/ViewLikeInterface.h +++ mlir/include/mlir/Interfaces/ViewLikeInterface.h @@ -105,7 +105,8 @@ /// 1. `result` is filled with the i64 ArrayAttr "[`dynVal`, 7, 42, `dynVal`]" /// 2. `ssa` is filled with "[%arg0, %arg1]". ParseResult parseOperandsOrIntegersOffsetsOrStridesList( - OpAsmParser &parser, SmallVectorImpl &values, + OpAsmParser &parser, + SmallVectorImpl &values, ArrayAttr &integers); /// Pasrer hook for custom directive in assemblyFormat. @@ -122,7 +123,8 @@ /// 1. `result` is filled with the i64 ArrayAttr "[`dynVal`, 7, 42, `dynVal`]" /// 2. `ssa` is filled with "[%arg0, %arg1]". ParseResult parseOperandsOrIntegersSizesList( - OpAsmParser &parser, SmallVectorImpl &values, + OpAsmParser &parser, + SmallVectorImpl &values, ArrayAttr &integers); /// Verify that a the `values` has as many elements as the number of entries in Index: mlir/lib/Dialect/Affine/IR/AffineOps.cpp =================================================================== --- mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -446,7 +446,7 @@ ParseResult mlir::parseDimAndSymbolList(OpAsmParser &parser, SmallVectorImpl &operands, unsigned &numDims) { - SmallVector opInfos; + SmallVector opInfos; if (parser.parseOperandList(opInfos, OpAsmParser::Delimiter::Paren)) return failure(); // Store number of dimensions for validation by caller. @@ -1041,17 +1041,17 @@ // ParseResult AffineDmaStartOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType srcMemRefInfo; + OpAsmParser::UnresolvedOperand srcMemRefInfo; AffineMapAttr srcMapAttr; - SmallVector srcMapOperands; - OpAsmParser::OperandType dstMemRefInfo; + SmallVector srcMapOperands; + OpAsmParser::UnresolvedOperand dstMemRefInfo; AffineMapAttr dstMapAttr; - SmallVector dstMapOperands; - OpAsmParser::OperandType tagMemRefInfo; + SmallVector dstMapOperands; + OpAsmParser::UnresolvedOperand tagMemRefInfo; AffineMapAttr tagMapAttr; - SmallVector tagMapOperands; - OpAsmParser::OperandType numElementsInfo; - SmallVector strideInfo; + SmallVector tagMapOperands; + OpAsmParser::UnresolvedOperand numElementsInfo; + SmallVector strideInfo; SmallVector types; auto indexType = parser.getBuilder().getIndexType(); @@ -1186,12 +1186,12 @@ // ParseResult AffineDmaWaitOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType tagMemRefInfo; + OpAsmParser::UnresolvedOperand tagMemRefInfo; AffineMapAttr tagMapAttr; - SmallVector tagMapOperands; + SmallVector tagMapOperands; Type type; auto indexType = parser.getBuilder().getIndexType(); - OpAsmParser::OperandType numElementsInfo; + OpAsmParser::UnresolvedOperand numElementsInfo; // Parse tag memref, its map operands, and dma size. if (parser.parseOperand(tagMemRefInfo) || @@ -1349,7 +1349,7 @@ : AffineForOp::getUpperBoundAttrName(); // Parse ssa-id as identity map. - SmallVector boundOpInfos; + SmallVector boundOpInfos; if (p.parseOperandList(boundOpInfos)) return failure(); @@ -1430,7 +1430,7 @@ ParseResult AffineForOp::parse(OpAsmParser &parser, OperationState &result) { auto &builder = parser.getBuilder(); - OpAsmParser::OperandType inductionVariable; + OpAsmParser::UnresolvedOperand inductionVariable; // Parse the induction variable followed by '='. if (parser.parseRegionArgument(inductionVariable) || parser.parseEqual()) return failure(); @@ -1461,7 +1461,7 @@ } // Parse the optional initial iteration arguments. - SmallVector regionArgs, operands; + SmallVector regionArgs, operands; SmallVector argTypes; regionArgs.push_back(inductionVariable); @@ -2317,9 +2317,9 @@ auto indexTy = builder.getIndexType(); MemRefType type; - OpAsmParser::OperandType memrefInfo; + OpAsmParser::UnresolvedOperand memrefInfo; AffineMapAttr mapAttr; - SmallVector mapOperands; + SmallVector mapOperands; return failure( parser.parseOperand(memrefInfo) || parser.parseAffineMapOfSSAIds(mapOperands, mapAttr, @@ -2453,10 +2453,10 @@ auto indexTy = parser.getBuilder().getIndexType(); MemRefType type; - OpAsmParser::OperandType storeValueInfo; - OpAsmParser::OperandType memrefInfo; + OpAsmParser::UnresolvedOperand storeValueInfo; + OpAsmParser::UnresolvedOperand memrefInfo; AffineMapAttr mapAttr; - SmallVector mapOperands; + SmallVector mapOperands; return failure(parser.parseOperand(storeValueInfo) || parser.parseComma() || parser.parseOperand(memrefInfo) || parser.parseAffineMapOfSSAIds(mapOperands, mapAttr, @@ -2539,8 +2539,8 @@ OperationState &result) { auto &builder = parser.getBuilder(); auto indexType = builder.getIndexType(); - SmallVector dimInfos; - SmallVector symInfos; + SmallVector dimInfos; + SmallVector symInfos; AffineMapAttr mapAttr; return failure( parser.parseAttribute(mapAttr, T::getMapAttrName(), result.attributes) || @@ -2789,13 +2789,13 @@ auto indexTy = builder.getIndexType(); MemRefType type; - OpAsmParser::OperandType memrefInfo; + OpAsmParser::UnresolvedOperand memrefInfo; IntegerAttr hintInfo; auto i32Type = parser.getBuilder().getIntegerType(32); StringRef readOrWrite, cacheType; AffineMapAttr mapAttr; - SmallVector mapOperands; + SmallVector mapOperands; if (parser.parseOperand(memrefInfo) || parser.parseAffineMapOfSSAIds(mapOperands, mapAttr, AffinePrefetchOp::getMapAttrName(), @@ -3262,7 +3262,7 @@ /// `operands` to accept `uniqueOperands` instead. static void deduplicateAndResolveOperands( OpAsmParser &parser, - ArrayRef> operands, + ArrayRef> operands, SmallVectorImpl &uniqueOperands, SmallVectorImpl &replacements, AffineExprKind kind) { assert((kind == AffineExprKind::DimId || kind == AffineExprKind::SymbolId) && @@ -3328,10 +3328,10 @@ } SmallVector flatExprs; - SmallVector> flatDimOperands; - SmallVector> flatSymOperands; + SmallVector> flatDimOperands; + SmallVector> flatSymOperands; SmallVector numMapsPerGroup; - SmallVector mapOperands; + SmallVector mapOperands; do { if (succeeded(parser.parseOptionalKeyword( kind == MinMaxKind::Min ? "min" : "max"))) { @@ -3345,11 +3345,11 @@ llvm::append_range(flatExprs, map.getValue().getResults()); auto operandsRef = llvm::makeArrayRef(mapOperands); auto dimsRef = operandsRef.take_front(map.getValue().getNumDims()); - SmallVector dims(dimsRef.begin(), - dimsRef.end()); + SmallVector dims(dimsRef.begin(), + dimsRef.end()); auto symsRef = operandsRef.drop_front(map.getValue().getNumDims()); - SmallVector syms(symsRef.begin(), - symsRef.end()); + SmallVector syms(symsRef.begin(), + symsRef.end()); flatDimOperands.append(map.getValue().getNumResults(), dims); flatSymOperands.append(map.getValue().getNumResults(), syms); numMapsPerGroup.push_back(map.getValue().getNumResults()); @@ -3408,7 +3408,7 @@ OperationState &result) { auto &builder = parser.getBuilder(); auto indexType = builder.getIndexType(); - SmallVector ivs; + SmallVector ivs; if (parser.parseRegionArgumentList(ivs, /*requiredOperandCount=*/-1, OpAsmParser::Delimiter::Paren) || parser.parseEqual() || @@ -3419,7 +3419,7 @@ AffineMapAttr stepsMapAttr; NamedAttrList stepsAttrs; - SmallVector stepsMapOperands; + SmallVector stepsMapOperands; if (failed(parser.parseOptionalKeyword("step"))) { SmallVector steps(ivs.size(), 1); result.addAttribute(AffineParallelOp::getStepsAttrName(), @@ -3561,9 +3561,9 @@ MemRefType memrefType; VectorType resultType; - OpAsmParser::OperandType memrefInfo; + OpAsmParser::UnresolvedOperand memrefInfo; AffineMapAttr mapAttr; - SmallVector mapOperands; + SmallVector mapOperands; return failure( parser.parseOperand(memrefInfo) || parser.parseAffineMapOfSSAIds(mapOperands, mapAttr, @@ -3650,10 +3650,10 @@ MemRefType memrefType; VectorType resultType; - OpAsmParser::OperandType storeValueInfo; - OpAsmParser::OperandType memrefInfo; + OpAsmParser::UnresolvedOperand storeValueInfo; + OpAsmParser::UnresolvedOperand memrefInfo; AffineMapAttr mapAttr; - SmallVector mapOperands; + SmallVector mapOperands; return failure( parser.parseOperand(storeValueInfo) || parser.parseComma() || parser.parseOperand(memrefInfo) || Index: mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp =================================================================== --- mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp +++ mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp @@ -1806,7 +1806,7 @@ ParseResult SelectOp::parse(OpAsmParser &parser, OperationState &result) { Type conditionType, resultType; - SmallVector operands; + SmallVector operands; if (parser.parseOperandList(operands, /*requiredOperandCount=*/3) || parser.parseOptionalAttrDict(result.attributes) || parser.parseColonType(resultType)) Index: mlir/lib/Dialect/Async/IR/Async.cpp =================================================================== --- mlir/lib/Dialect/Async/IR/Async.cpp +++ mlir/lib/Dialect/Async/IR/Async.cpp @@ -167,7 +167,7 @@ // Parse dependency tokens. if (succeeded(parser.parseOptionalLSquare())) { - SmallVector tokenArgs; + SmallVector tokenArgs; if (parser.parseOperandList(tokenArgs) || parser.resolveOperands(tokenArgs, tokenTy, result.operands) || parser.parseRSquare()) @@ -177,8 +177,8 @@ } // Parse async value operands (%value as %unwrapped : !async.value). - SmallVector valueArgs; - SmallVector unwrappedArgs; + SmallVector valueArgs; + SmallVector unwrappedArgs; SmallVector valueTypes; SmallVector unwrappedTypes; Index: mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp =================================================================== --- mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp +++ mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp @@ -481,11 +481,11 @@ /// ( `,` integer `:` bb-id (`(` ssa-use-and-type-list `)`)? )* static ParseResult parseSwitchOpCases( OpAsmParser &parser, Type &flagType, Block *&defaultDestination, - SmallVectorImpl &defaultOperands, + SmallVectorImpl &defaultOperands, SmallVectorImpl &defaultOperandTypes, DenseIntElementsAttr &caseValues, SmallVectorImpl &caseDestinations, - SmallVectorImpl> &caseOperands, + SmallVectorImpl> &caseOperands, SmallVectorImpl> &caseOperandTypes) { if (parser.parseKeyword("default") || parser.parseColon() || parser.parseSuccessor(defaultDestination)) @@ -505,7 +505,7 @@ values.push_back(APInt(bitWidth, value)); Block *destination; - SmallVector operands; + SmallVector operands; SmallVector operandTypes; if (failed(parser.parseColon()) || failed(parser.parseSuccessor(destination))) Index: mlir/lib/Dialect/GPU/IR/GPUDialect.cpp =================================================================== --- mlir/lib/Dialect/GPU/IR/GPUDialect.cpp +++ mlir/lib/Dialect/GPU/IR/GPUDialect.cpp @@ -475,11 +475,11 @@ // SSA value uses. static ParseResult parseSizeAssignment(OpAsmParser &parser, - MutableArrayRef sizes, - MutableArrayRef regionSizes, - MutableArrayRef indices) { + MutableArrayRef sizes, + MutableArrayRef regionSizes, + MutableArrayRef indices) { assert(indices.size() == 3 && "space for three indices expected"); - SmallVector args; + SmallVector args; if (parser.parseRegionArgumentList(args, /*requiredOperandCount=*/3, OpAsmParser::Delimiter::Paren) || parser.parseKeyword("in") || parser.parseLParen()) @@ -506,17 +506,17 @@ /// ssa-reassignment ::= `(` ssa-id `=` ssa-use (`,` ssa-id `=` ssa-use)* `)` ParseResult LaunchOp::parse(OpAsmParser &parser, OperationState &result) { // Sizes of the grid and block. - SmallVector sizes( - LaunchOp::kNumConfigOperands); - MutableArrayRef sizesRef(sizes); + SmallVector + sizes(LaunchOp::kNumConfigOperands); + MutableArrayRef sizesRef(sizes); // Actual (data) operands passed to the kernel. - SmallVector dataOperands; + SmallVector dataOperands; // Region arguments to be created. - SmallVector regionArgs( + SmallVector regionArgs( LaunchOp::kNumConfigRegionAttributes); - MutableArrayRef regionArgsRef(regionArgs); + MutableArrayRef regionArgsRef(regionArgs); // Parse the size assignment segments: the first segment assigns grid sizes // and defines values for block identifiers; the second segment assigns block @@ -535,7 +535,7 @@ result.operands)) return failure(); - OpAsmParser::OperandType dynamicSharedMemorySize; + OpAsmParser::UnresolvedOperand dynamicSharedMemorySize; if (!parser.parseOptionalKeyword( LaunchOp::getDynamicSharedMemorySizeKeyword())) if (parser.parseOperand(dynamicSharedMemorySize) || @@ -667,10 +667,10 @@ return success(); } -static ParseResult -parseLaunchFuncOperands(OpAsmParser &parser, - SmallVectorImpl &argNames, - SmallVectorImpl &argTypes) { +static ParseResult parseLaunchFuncOperands( + OpAsmParser &parser, + SmallVectorImpl &argNames, + SmallVectorImpl &argTypes) { if (parser.parseOptionalKeyword("args")) return success(); SmallVector argAttrs; @@ -769,7 +769,7 @@ /// keyword provided as argument. static ParseResult parseAttributions(OpAsmParser &parser, StringRef keyword, - SmallVectorImpl &args, + SmallVectorImpl &args, SmallVectorImpl &argTypes) { // If we could not parse the keyword, just assume empty list and succeed. if (failed(parser.parseOptionalKeyword(keyword))) @@ -783,7 +783,7 @@ return success(); do { - OpAsmParser::OperandType arg; + OpAsmParser::UnresolvedOperand arg; Type type; if (parser.parseRegionArgument(arg) || parser.parseColonType(type)) @@ -802,7 +802,7 @@ /// (`->` function-result-list)? memory-attribution `kernel`? /// function-attributes? region ParseResult GPUFuncOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector entryArgs; + SmallVector entryArgs; SmallVector argAttrs; SmallVector resultAttrs; SmallVector argTypes; @@ -1041,7 +1041,7 @@ static ParseResult parseAsyncDependencies( OpAsmParser &parser, Type &asyncTokenType, - SmallVectorImpl &asyncDependencies) { + SmallVectorImpl &asyncDependencies) { auto loc = parser.getCurrentLocation(); if (succeeded(parser.parseOptionalKeyword("async"))) { if (parser.getNumResults() == 0) Index: mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp =================================================================== --- mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -113,7 +113,7 @@ Builder &builder = parser.getBuilder(); StringAttr predicateAttr; - OpAsmParser::OperandType lhs, rhs; + OpAsmParser::UnresolvedOperand lhs, rhs; Type type; SMLoc predicateLoc, trailingTypeLoc; if (parser.getCurrentLocation(&predicateLoc) || @@ -200,7 +200,7 @@ // ::= `llvm.alloca` ssa-use `x` type attribute-dict? // `:` type `,` type ParseResult AllocaOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType arraySize; + OpAsmParser::UnresolvedOperand arraySize; Type type, elemType; SMLoc trailingTypeLoc; if (parser.parseOperand(arraySize) || parser.parseKeyword("x") || @@ -283,7 +283,7 @@ static ParseResult parseSwitchOpCases( OpAsmParser &parser, Type flagType, ElementsAttr &caseValues, SmallVectorImpl &caseDestinations, - SmallVectorImpl> &caseOperands, + SmallVectorImpl> &caseOperands, SmallVectorImpl> &caseOperandTypes) { SmallVector values; unsigned bitWidth = flagType.getIntOrFloatBitWidth(); @@ -298,7 +298,7 @@ values.push_back(APInt(bitWidth, value)); Block *destination; - SmallVector operands; + SmallVector operands; SmallVector operandTypes; if (parser.parseColon() || parser.parseSuccessor(destination)) return failure(); @@ -489,7 +489,7 @@ static ParseResult parseGEPIndices(OpAsmParser &parser, - SmallVectorImpl &indices, + SmallVectorImpl &indices, DenseIntElementsAttr &structIndices) { SmallVector constantIndices; do { @@ -657,7 +657,7 @@ // ::= `llvm.load` `volatile` ssa-use attribute-dict? `:` type ParseResult LoadOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType addr; + OpAsmParser::UnresolvedOperand addr; Type type; SMLoc trailingTypeLoc; @@ -707,7 +707,7 @@ // ::= `llvm.store` `volatile` ssa-use `,` ssa-use // attribute-dict? `:` type ParseResult StoreOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType addr, value; + OpAsmParser::UnresolvedOperand addr, value; Type type; SMLoc trailingTypeLoc; @@ -788,7 +788,7 @@ /// `unwind` bb-id (`[` ssa-use-and-type-list `]`)? /// attribute-dict? `:` function-type ParseResult InvokeOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector operands; + SmallVector operands; FunctionType funcType; SymbolRefAttr funcAttr; SMLoc trailingTypeLoc; @@ -948,7 +948,7 @@ while (succeeded(parser.parseOptionalLParen()) && (succeeded(parser.parseOptionalKeyword("filter")) || succeeded(parser.parseOptionalKeyword("catch")))) { - OpAsmParser::OperandType operand; + OpAsmParser::UnresolvedOperand operand; Type ty; if (parser.parseOperand(operand) || parser.parseColon() || parser.parseType(ty) || @@ -1075,7 +1075,7 @@ // ::= `llvm.call` (function-id | ssa-use) `(` ssa-use-list `)` // attribute-dict? `:` function-type ParseResult CallOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector operands; + SmallVector operands; Type type; SymbolRefAttr funcAttr; SMLoc trailingTypeLoc; @@ -1137,7 +1137,7 @@ auto wrappedFuncType = LLVM::LLVMPointerType::get(llvmFuncType); auto funcArguments = - ArrayRef(operands).drop_front(); + ArrayRef(operands).drop_front(); // Make sure that the first operand (indirect callee) matches the wrapped // LLVM IR function type, and that the types of the other call operands @@ -1180,7 +1180,7 @@ ParseResult ExtractElementOp::parse(OpAsmParser &parser, OperationState &result) { SMLoc loc; - OpAsmParser::OperandType vector, position; + OpAsmParser::UnresolvedOperand vector, position; Type type, positionType; if (parser.getCurrentLocation(&loc) || parser.parseOperand(vector) || parser.parseLSquare() || parser.parseOperand(position) || @@ -1315,7 +1315,7 @@ // `[` integer-literal (`,` integer-literal)* `]` // attribute-dict? `:` type ParseResult ExtractValueOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType container; + OpAsmParser::UnresolvedOperand container; Type containerType; ArrayAttr positionAttr; SMLoc attributeLoc, trailingTypeLoc; @@ -1400,7 +1400,7 @@ ParseResult InsertElementOp::parse(OpAsmParser &parser, OperationState &result) { SMLoc loc; - OpAsmParser::OperandType vector, value, position; + OpAsmParser::UnresolvedOperand vector, value, position; Type vectorType, positionType; if (parser.getCurrentLocation(&loc) || parser.parseOperand(value) || parser.parseComma() || parser.parseOperand(vector) || @@ -1449,7 +1449,7 @@ // `[` integer-literal (`,` integer-literal)* `]` // attribute-dict? `:` type ParseResult InsertValueOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType container, value; + OpAsmParser::UnresolvedOperand container, value; Type containerType; ArrayAttr positionAttr; SMLoc attributeLoc, trailingTypeLoc; @@ -1917,7 +1917,7 @@ ParseResult ShuffleVectorOp::parse(OpAsmParser &parser, OperationState &result) { SMLoc loc; - OpAsmParser::OperandType v1, v2; + OpAsmParser::UnresolvedOperand v1, v2; ArrayAttr maskAttr; Type typeV1, typeV2; if (parser.getCurrentLocation(&loc) || parser.parseOperand(v1) || @@ -2046,7 +2046,7 @@ parser, result, LLVM::Linkage::External))); StringAttr nameAttr; - SmallVector entryArgs; + SmallVector entryArgs; SmallVector argAttrs; SmallVector resultAttrs; SmallVector argTypes; @@ -2287,7 +2287,7 @@ // attribute-dict? `:` type ParseResult AtomicRMWOp::parse(OpAsmParser &parser, OperationState &result) { Type type; - OpAsmParser::OperandType ptr, val; + OpAsmParser::UnresolvedOperand ptr, val; if (parseAtomicBinOp(parser, result, "bin_op") || parser.parseOperand(ptr) || parser.parseComma() || parser.parseOperand(val) || parseAtomicOrdering(parser, result, "ordering") || @@ -2359,7 +2359,7 @@ OperationState &result) { auto &builder = parser.getBuilder(); Type type; - OpAsmParser::OperandType ptr, cmp, val; + OpAsmParser::UnresolvedOperand ptr, cmp, val; if (parser.parseOperand(ptr) || parser.parseComma() || parser.parseOperand(cmp) || parser.parseComma() || parser.parseOperand(val) || Index: mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp =================================================================== --- mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp +++ mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp @@ -51,7 +51,7 @@ auto int32Ty = IntegerType::get(context, 32); auto int1Ty = IntegerType::get(context, 1); - SmallVector ops; + SmallVector ops; Type type; return failure(parser.parseOperandList(ops) || parser.parseOptionalAttrDict(result.attributes) || Index: mlir/lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp =================================================================== --- mlir/lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp +++ mlir/lib/Dialect/LLVMIR/IR/ROCDLDialect.cpp @@ -40,7 +40,7 @@ // `llvm.amdgcn.buffer.load.* %rsrc, %vindex, %offset, %glc, %slc : // result_type` ParseResult MubufLoadOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector ops; + SmallVector ops; Type type; if (parser.parseOperandList(ops, 5) || parser.parseColonType(type) || parser.addTypeToList(type, result.types)) @@ -63,7 +63,7 @@ // `llvm.amdgcn.buffer.store.* %vdata, %rsrc, %vindex, %offset, %glc, %slc : // result_type` ParseResult MubufStoreOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector ops; + SmallVector ops; Type type; if (parser.parseOperandList(ops, 6) || parser.parseColonType(type)) return failure(); Index: mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp =================================================================== --- mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp +++ mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp @@ -638,7 +638,7 @@ failed(parser.parseOptionalAttrDict(result.attributes))) return failure(); - SmallVector regionOperands; + SmallVector regionOperands; std::unique_ptr region = std::make_unique(); SmallVector operandTypes, regionTypes; if (parser.parseRegion(*region, regionOperands, regionTypes)) @@ -1237,7 +1237,7 @@ } ParseResult YieldOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector opInfo; + SmallVector opInfo; SmallVector types; SMLoc loc = parser.getCurrentLocation(); return failure(parser.parseOperandList(opInfo) || @@ -1457,7 +1457,8 @@ SmallVectorImpl &inputTypes, SmallVectorImpl &outputTypes) { SMLoc inputsOperandsLoc, outputsOperandsLoc; - SmallVector inputsOperands, outputsOperands; + SmallVector inputsOperands, + outputsOperands; parser.parseOptionalAttrDict(result.attributes); Index: mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp =================================================================== --- mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp +++ mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp @@ -959,14 +959,14 @@ // memref<1 x i32> // ParseResult DmaStartOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType srcMemRefInfo; - SmallVector srcIndexInfos; - OpAsmParser::OperandType dstMemRefInfo; - SmallVector dstIndexInfos; - OpAsmParser::OperandType numElementsInfo; - OpAsmParser::OperandType tagMemrefInfo; - SmallVector tagIndexInfos; - SmallVector strideInfo; + OpAsmParser::UnresolvedOperand srcMemRefInfo; + SmallVector srcIndexInfos; + OpAsmParser::UnresolvedOperand dstMemRefInfo; + SmallVector dstIndexInfos; + OpAsmParser::UnresolvedOperand numElementsInfo; + OpAsmParser::UnresolvedOperand tagMemrefInfo; + SmallVector tagIndexInfos; + SmallVector strideInfo; SmallVector types; auto indexType = parser.getBuilder().getIndexType(); @@ -1153,9 +1153,9 @@ ParseResult GenericAtomicRMWOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType memref; + OpAsmParser::UnresolvedOperand memref; Type memrefType; - SmallVector ivs; + SmallVector ivs; Type indexType = parser.getBuilder().getIndexType(); if (parser.parseOperand(memref) || @@ -1341,8 +1341,8 @@ } ParseResult PrefetchOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType memrefInfo; - SmallVector indexInfo; + OpAsmParser::UnresolvedOperand memrefInfo; + SmallVector indexInfo; IntegerAttr localityHint; MemRefType type; StringRef readOrWrite, cacheType; @@ -2422,7 +2422,7 @@ } ParseResult TransposeOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType in; + OpAsmParser::UnresolvedOperand in; AffineMap permutation; MemRefType srcType, dstType; if (parser.parseOperand(in) || parser.parseAffineMap(permutation) || Index: mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp =================================================================== --- mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp +++ mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp @@ -54,7 +54,7 @@ static ParseResult parseOperandList(OpAsmParser &parser, StringRef keyword, - SmallVectorImpl &args, + SmallVectorImpl &args, SmallVectorImpl &argTypes, OperationState &result) { if (failed(parser.parseOptionalKeyword(keyword))) return success(); @@ -67,7 +67,7 @@ return success(); do { - OpAsmParser::OperandType arg; + OpAsmParser::UnresolvedOperand arg; Type type; if (parser.parseRegionArgument(arg) || parser.parseColonType(type)) @@ -97,7 +97,7 @@ } static ParseResult parseOptionalOperand(OpAsmParser &parser, StringRef keyword, - OpAsmParser::OperandType &operand, + OpAsmParser::UnresolvedOperand &operand, Type type, bool &hasOptional, OperationState &result) { hasOptional = false; @@ -113,7 +113,7 @@ static ParseResult parseOperandAndType(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType operand; + OpAsmParser::UnresolvedOperand operand; Type type; if (parser.parseOperand(operand) || parser.parseColonType(type) || parser.resolveOperand(operand, type, result.operands)) @@ -128,7 +128,7 @@ static OptionalParseResult parseOptionalOperandAndType(OpAsmParser &parser, StringRef keyword, OperationState &result) { - OpAsmParser::OperandType operand; + OpAsmParser::UnresolvedOperand operand; if (succeeded(parser.parseOptionalKeyword(keyword))) { return failure(parser.parseLParen() || parseOperandAndType(parser, result) || parser.parseRParen()); @@ -220,7 +220,7 @@ /// region attr-dict? ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) { Builder &builder = parser.getBuilder(); - SmallVector privateOperands, + SmallVector privateOperands, firstprivateOperands, copyOperands, copyinOperands, copyinReadonlyOperands, copyoutOperands, copyoutZeroOperands, createOperands, createZeroOperands, noCreateOperands, presentOperands, @@ -233,7 +233,7 @@ firstprivateOperandTypes; SmallVector operandTypes; - OpAsmParser::OperandType ifCond, selfCond; + OpAsmParser::UnresolvedOperand ifCond, selfCond; bool hasIfCond = false, hasSelfCond = false; OptionalParseResult async, numGangs, numWorkers, vectorLength; Type i1Type = builder.getI1Type(); @@ -516,8 +516,9 @@ Builder &builder = parser.getBuilder(); unsigned executionMapping = OpenACCExecMapping::NONE; SmallVector operandTypes; - SmallVector privateOperands, reductionOperands; - SmallVector tileOperands; + SmallVector privateOperands, + reductionOperands; + SmallVector tileOperands; OptionalParseResult gangNum, gangStatic, worker, vector; // gang? Index: mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp =================================================================== --- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -83,13 +83,13 @@ /// ssa-id-and-type ::= ssa-id `:` type static ParseResult parseAllocateAndAllocator( OpAsmParser &parser, - SmallVectorImpl &operandsAllocate, + SmallVectorImpl &operandsAllocate, SmallVectorImpl &typesAllocate, - SmallVectorImpl &operandsAllocator, + SmallVectorImpl &operandsAllocator, SmallVectorImpl &typesAllocator) { return parser.parseCommaSeparatedList([&]() -> ParseResult { - OpAsmParser::OperandType operand; + OpAsmParser::UnresolvedOperand operand; Type type; if (parser.parseOperand(operand) || parser.parseColonType(type)) return failure(); @@ -177,16 +177,16 @@ /// linear-val := ssa-id-and-type `=` ssa-id-and-type static ParseResult parseLinearClause(OpAsmParser &parser, - SmallVectorImpl &vars, + SmallVectorImpl &vars, SmallVectorImpl &types, - SmallVectorImpl &stepVars) { + SmallVectorImpl &stepVars) { if (parser.parseLParen()) return failure(); do { - OpAsmParser::OperandType var; + OpAsmParser::UnresolvedOperand var; Type type; - OpAsmParser::OperandType stepVar; + OpAsmParser::UnresolvedOperand stepVar; if (parser.parseOperand(var) || parser.parseEqual() || parser.parseOperand(stepVar) || parser.parseColonType(type)) return failure(); @@ -264,7 +264,7 @@ static ParseResult parseScheduleClause(OpAsmParser &parser, SmallString<8> &schedule, SmallVectorImpl> &modifiers, - Optional &chunkSize, + Optional &chunkSize, Type &chunkType) { if (parser.parseLParen()) return failure(); @@ -276,7 +276,7 @@ schedule = keyword; if (keyword == "static" || keyword == "dynamic" || keyword == "guided") { if (succeeded(parser.parseOptionalEqual())) { - chunkSize = OpAsmParser::OperandType{}; + chunkSize = OpAsmParser::UnresolvedOperand{}; if (parser.parseOperand(*chunkSize) || parser.parseColonType(chunkType)) return failure(); } else { @@ -326,9 +326,11 @@ /// reduction-entry-list ::= reduction-entry /// | reduction-entry-list `,` reduction-entry /// reduction-entry ::= symbol-ref `->` ssa-id `:` type -static ParseResult parseReductionVarList( - OpAsmParser &parser, SmallVectorImpl &operands, - SmallVectorImpl &types, ArrayAttr &redcuctionSymbols) { +static ParseResult +parseReductionVarList(OpAsmParser &parser, + SmallVectorImpl &operands, + SmallVectorImpl &types, + ArrayAttr &redcuctionSymbols) { SmallVector reductionVec; do { if (parser.parseAttribute(reductionVec.emplace_back()) || @@ -524,20 +526,20 @@ StringRef opName = result.name.getStringRef(); // Containers for storing operands, types and attributes for various clauses - SmallVector allocates, allocators; + SmallVector allocates, allocators; SmallVector allocateTypes, allocatorTypes; ArrayAttr reductions; - SmallVector reductionVars; + SmallVector reductionVars; SmallVector reductionVarTypes; - SmallVector linears; + SmallVector linears; SmallVector linearTypes; - SmallVector linearSteps; + SmallVector linearSteps; SmallString<8> schedule; SmallVector> modifiers; - Optional scheduleChunkSize; + Optional scheduleChunkSize; Type scheduleChunkType; // Compute the position of clauses in operand segments @@ -746,7 +748,7 @@ /// | reduction ParseResult WsLoopOp::parse(OpAsmParser &parser, OperationState &result) { // Parse an opening `(` followed by induction variables followed by `)` - SmallVector ivs; + SmallVector ivs; if (parser.parseRegionArgumentList(ivs, /*requiredOperandCount=*/-1, OpAsmParser::Delimiter::Paren)) return failure(); @@ -757,13 +759,13 @@ return failure(); // Parse loop bounds. - SmallVector lower; + SmallVector lower; if (parser.parseEqual() || parser.parseOperandList(lower, numIVs, OpAsmParser::Delimiter::Paren) || parser.resolveOperands(lower, loopVarType, result.operands)) return failure(); - SmallVector upper; + SmallVector upper; if (parser.parseKeyword("to") || parser.parseOperandList(upper, numIVs, OpAsmParser::Delimiter::Paren) || parser.resolveOperands(upper, loopVarType, result.operands)) @@ -775,7 +777,7 @@ } // Parse step values. - SmallVector steps; + SmallVector steps; if (parser.parseKeyword("step") || parser.parseOperandList(steps, numIVs, OpAsmParser::Delimiter::Paren) || parser.resolveOperands(steps, loopVarType, result.operands)) @@ -794,7 +796,7 @@ // Now parse the body. Region *body = result.addRegion(); SmallVector ivTypes(numIVs, loopVarType); - SmallVector blockArgs(ivs); + SmallVector blockArgs(ivs); if (parser.parseRegion(*body, blockArgs, ivTypes)) return failure(); return success(); @@ -851,7 +853,7 @@ /// clause ::= TODO ParseResult SimdLoopOp::parse(OpAsmParser &parser, OperationState &result) { // Parse an opening `(` followed by induction variables followed by `)` - SmallVector ivs; + SmallVector ivs; if (parser.parseRegionArgumentList(ivs, /*requiredOperandCount=*/-1, OpAsmParser::Delimiter::Paren)) return failure(); @@ -860,19 +862,19 @@ if (parser.parseColonType(loopVarType)) return failure(); // Parse loop bounds. - SmallVector lower; + SmallVector lower; if (parser.parseEqual() || parser.parseOperandList(lower, numIVs, OpAsmParser::Delimiter::Paren) || parser.resolveOperands(lower, loopVarType, result.operands)) return failure(); - SmallVector upper; + SmallVector upper; if (parser.parseKeyword("to") || parser.parseOperandList(upper, numIVs, OpAsmParser::Delimiter::Paren) || parser.resolveOperands(upper, loopVarType, result.operands)) return failure(); // Parse step values. - SmallVector steps; + SmallVector steps; if (parser.parseKeyword("step") || parser.parseOperandList(steps, numIVs, OpAsmParser::Delimiter::Paren) || parser.resolveOperands(steps, loopVarType, result.operands)) @@ -886,7 +888,7 @@ // Now parse the body. Region *body = result.addRegion(); SmallVector ivTypes(numIVs, loopVarType); - SmallVector blockArgs(ivs); + SmallVector blockArgs(ivs); if (parser.parseRegion(*body, blockArgs, ivTypes)) return failure(); return success(); Index: mlir/lib/Dialect/PDL/IR/PDL.cpp =================================================================== --- mlir/lib/Dialect/PDL/IR/PDL.cpp +++ mlir/lib/Dialect/PDL/IR/PDL.cpp @@ -142,14 +142,15 @@ //===----------------------------------------------------------------------===// static ParseResult parseOperationOpAttributes( - OpAsmParser &p, SmallVectorImpl &attrOperands, + OpAsmParser &p, + SmallVectorImpl &attrOperands, ArrayAttr &attrNamesAttr) { Builder &builder = p.getBuilder(); SmallVector attrNames; if (succeeded(p.parseOptionalLBrace())) { do { StringAttr nameAttr; - OpAsmParser::OperandType operand; + OpAsmParser::UnresolvedOperand operand; if (p.parseAttribute(nameAttr) || p.parseEqual() || p.parseOperand(operand)) return failure(); Index: mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp =================================================================== --- mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp +++ mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp @@ -48,14 +48,15 @@ //===----------------------------------------------------------------------===// static ParseResult parseCreateOperationOpAttributes( - OpAsmParser &p, SmallVectorImpl &attrOperands, + OpAsmParser &p, + SmallVectorImpl &attrOperands, ArrayAttr &attrNamesAttr) { Builder &builder = p.getBuilder(); SmallVector attrNames; if (succeeded(p.parseOptionalLBrace())) { do { StringAttr nameAttr; - OpAsmParser::OperandType operand; + OpAsmParser::UnresolvedOperand operand; if (p.parseAttribute(nameAttr) || p.parseEqual() || p.parseOperand(operand)) return failure(); @@ -100,7 +101,7 @@ ParseResult ForEachOp::parse(OpAsmParser &parser, OperationState &result) { // Parse the loop variable followed by type. - OpAsmParser::OperandType loopVariable; + OpAsmParser::UnresolvedOperand loopVariable; Type loopVariableType; if (parser.parseRegionArgument(loopVariable) || parser.parseColonType(loopVariableType)) @@ -111,7 +112,7 @@ return failure(); // Parse the operand (value range). - OpAsmParser::OperandType operandInfo; + OpAsmParser::UnresolvedOperand operandInfo; if (parser.parseOperand(operandInfo)) return failure(); Index: mlir/lib/Dialect/SCF/SCF.cpp =================================================================== --- mlir/lib/Dialect/SCF/SCF.cpp +++ mlir/lib/Dialect/SCF/SCF.cpp @@ -393,7 +393,7 @@ ParseResult ForOp::parse(OpAsmParser &parser, OperationState &result) { auto &builder = parser.getBuilder(); - OpAsmParser::OperandType inductionVariable, lb, ub, step; + OpAsmParser::UnresolvedOperand inductionVariable, lb, ub, step; // Parse the induction variable followed by '='. if (parser.parseRegionArgument(inductionVariable) || parser.parseEqual()) return failure(); @@ -409,7 +409,7 @@ return failure(); // Parse the optional initial iteration arguments. - SmallVector regionArgs, operands; + SmallVector regionArgs, operands; SmallVector argTypes; regionArgs.push_back(inductionVariable); @@ -1125,7 +1125,7 @@ Region *elseRegion = result.addRegion(); auto &builder = parser.getBuilder(); - OpAsmParser::OperandType cond; + OpAsmParser::UnresolvedOperand cond; Type i1Type = builder.getIntegerType(1); if (parser.parseOperand(cond) || parser.resolveOperand(cond, i1Type, result.operands)) @@ -1979,20 +1979,20 @@ ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) { auto &builder = parser.getBuilder(); // Parse an opening `(` followed by induction variables followed by `)` - SmallVector ivs; + SmallVector ivs; if (parser.parseRegionArgumentList(ivs, /*requiredOperandCount=*/-1, OpAsmParser::Delimiter::Paren)) return failure(); // Parse loop bounds. - SmallVector lower; + SmallVector lower; if (parser.parseEqual() || parser.parseOperandList(lower, ivs.size(), OpAsmParser::Delimiter::Paren) || parser.resolveOperands(lower, builder.getIndexType(), result.operands)) return failure(); - SmallVector upper; + SmallVector upper; if (parser.parseKeyword("to") || parser.parseOperandList(upper, ivs.size(), OpAsmParser::Delimiter::Paren) || @@ -2000,7 +2000,7 @@ return failure(); // Parse step values. - SmallVector steps; + SmallVector steps; if (parser.parseKeyword("step") || parser.parseOperandList(steps, ivs.size(), OpAsmParser::Delimiter::Paren) || @@ -2008,7 +2008,7 @@ return failure(); // Parse init values. - SmallVector initVals; + SmallVector initVals; if (succeeded(parser.parseOptionalKeyword("init"))) { if (parser.parseOperandList(initVals, /*requiredOperandCount=*/-1, OpAsmParser::Delimiter::Paren)) @@ -2290,7 +2290,7 @@ ParseResult ReduceOp::parse(OpAsmParser &parser, OperationState &result) { // Parse an opening `(` followed by the reduced value followed by `)` - OpAsmParser::OperandType operand; + OpAsmParser::UnresolvedOperand operand; if (parser.parseLParen() || parser.parseOperand(operand) || parser.parseRParen()) return failure(); @@ -2385,7 +2385,7 @@ /// assignment-list ::= assignment | assignment `,` assignment-list /// assignment ::= ssa-value `=` ssa-value ParseResult scf::WhileOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector regionArgs, operands; + SmallVector regionArgs, operands; Region *before = result.addRegion(); Region *after = result.addRegion(); Index: mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp =================================================================== --- mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp +++ mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp @@ -66,7 +66,7 @@ static ParseResult parseOneResultSameOperandTypeOp(OpAsmParser &parser, OperationState &result) { - SmallVector ops; + SmallVector ops; Type type; // If the operand list is in-between parentheses, then we have a generic form. // (see the fallback in `printOneResultOp`). @@ -766,8 +766,8 @@ OperationState &state, bool hasValue) { spirv::Scope scope; spirv::MemorySemantics memoryScope; - SmallVector operandInfo; - OpAsmParser::OperandType ptrInfo, valueInfo; + SmallVector operandInfo; + OpAsmParser::UnresolvedOperand ptrInfo, valueInfo; Type type; SMLoc loc; if (parseEnumStrAttr(scope, parser, state, kMemoryScopeAttrName) || @@ -846,7 +846,7 @@ OperationState &state) { spirv::Scope executionScope; spirv::GroupOperation groupOperation; - OpAsmParser::OperandType valueInfo; + OpAsmParser::UnresolvedOperand valueInfo; if (parseEnumStrAttr(executionScope, parser, state, kExecutionScopeAttrName) || parseEnumStrAttr(groupOperation, parser, state, @@ -854,9 +854,9 @@ parser.parseOperand(valueInfo)) return failure(); - Optional clusterSizeInfo; + Optional clusterSizeInfo; if (succeeded(parser.parseOptionalKeyword(kClusterSize))) { - clusterSizeInfo = OpAsmParser::OperandType(); + clusterSizeInfo = OpAsmParser::UnresolvedOperand(); if (parser.parseLParen() || parser.parseOperand(*clusterSizeInfo) || parser.parseRParen()) return failure(); @@ -1029,8 +1029,8 @@ ParseResult spirv::AccessChainOp::parse(OpAsmParser &parser, OperationState &state) { - OpAsmParser::OperandType ptrInfo; - SmallVector indicesInfo; + OpAsmParser::UnresolvedOperand ptrInfo; + SmallVector indicesInfo; Type type; auto loc = parser.getCurrentLocation(); SmallVector indicesTypes; @@ -1143,7 +1143,7 @@ OperationState &state) { spirv::Scope memoryScope; spirv::MemorySemantics equalSemantics, unequalSemantics; - SmallVector operandInfo; + SmallVector operandInfo; Type type; if (parseEnumStrAttr(memoryScope, parser, state, kMemoryScopeAttrName) || parseEnumStrAttr(equalSemantics, parser, state, @@ -1265,7 +1265,7 @@ OperationState &state) { spirv::Scope memoryScope; spirv::MemorySemantics semantics; - SmallVector operandInfo; + SmallVector operandInfo; Type type; if (parseEnumStrAttr(memoryScope, parser, state, kMemoryScopeAttrName) || parseEnumStrAttr(semantics, parser, state, kSemanticsAttrName) || @@ -1535,7 +1535,7 @@ ParseResult spirv::BranchConditionalOp::parse(OpAsmParser &parser, OperationState &state) { auto &builder = parser.getBuilder(); - OpAsmParser::OperandType condInfo; + OpAsmParser::UnresolvedOperand condInfo; Block *dest; // Parse the condition. @@ -1620,7 +1620,7 @@ ParseResult spirv::CompositeConstructOp::parse(OpAsmParser &parser, OperationState &state) { - SmallVector operands; + SmallVector operands; Type type; auto loc = parser.getCurrentLocation(); @@ -1699,7 +1699,7 @@ ParseResult spirv::CompositeExtractOp::parse(OpAsmParser &parser, OperationState &state) { - OpAsmParser::OperandType compositeInfo; + OpAsmParser::UnresolvedOperand compositeInfo; Attribute indicesAttr; Type compositeType; SMLoc attrLocation; @@ -1753,7 +1753,7 @@ ParseResult spirv::CompositeInsertOp::parse(OpAsmParser &parser, OperationState &state) { - SmallVector operands; + SmallVector operands; Type objectType, compositeType; Attribute indicesAttr; auto loc = parser.getCurrentLocation(); @@ -2071,7 +2071,7 @@ ParseResult spirv::EntryPointOp::parse(OpAsmParser &parser, OperationState &state) { spirv::ExecutionModel execModel; - SmallVector identifiers; + SmallVector identifiers; SmallVector idTypes; SmallVector interfaceVars; @@ -2194,7 +2194,7 @@ //===----------------------------------------------------------------------===// ParseResult spirv::FuncOp::parse(OpAsmParser &parser, OperationState &state) { - SmallVector entryArgs; + SmallVector entryArgs; SmallVector argAttrs; SmallVector resultAttrs; SmallVector argTypes; @@ -2601,7 +2601,7 @@ OperationState &state) { // Parse the storage class specification spirv::StorageClass storageClass; - OpAsmParser::OperandType ptrInfo; + OpAsmParser::UnresolvedOperand ptrInfo; Type elementType; if (parseEnumStrAttr(storageClass, parser) || parser.parseOperand(ptrInfo) || parser.parseColon() || parser.parseType(elementType)) { @@ -2639,7 +2639,7 @@ OperationState &state) { // Parse the storage class specification spirv::StorageClass storageClass; - SmallVector operandInfo; + SmallVector operandInfo; auto loc = parser.getCurrentLocation(); Type elementType; if (parseEnumStrAttr(storageClass, parser) || @@ -2857,7 +2857,7 @@ ParseResult spirv::LoadOp::parse(OpAsmParser &parser, OperationState &state) { // Parse the storage class specification spirv::StorageClass storageClass; - OpAsmParser::OperandType ptrInfo; + OpAsmParser::UnresolvedOperand ptrInfo; Type elementType; if (parseEnumStrAttr(storageClass, parser) || parser.parseOperand(ptrInfo) || parseMemoryAccessAttributes(parser, state) || @@ -3477,7 +3477,7 @@ ParseResult spirv::StoreOp::parse(OpAsmParser &parser, OperationState &state) { // Parse the storage class specification spirv::StorageClass storageClass; - SmallVector operandInfo; + SmallVector operandInfo; auto loc = parser.getCurrentLocation(); Type elementType; if (parseEnumStrAttr(storageClass, parser) || @@ -3541,9 +3541,9 @@ ParseResult spirv::VariableOp::parse(OpAsmParser &parser, OperationState &state) { // Parse optional initializer - Optional initInfo; + Optional initInfo; if (succeeded(parser.parseOptionalKeyword("init"))) { - initInfo = OpAsmParser::OperandType(); + initInfo = OpAsmParser::UnresolvedOperand(); if (parser.parseLParen() || parser.parseOperand(*initInfo) || parser.parseRParen()) return failure(); @@ -3670,7 +3670,7 @@ ParseResult spirv::CooperativeMatrixLoadNVOp::parse(OpAsmParser &parser, OperationState &state) { - SmallVector operandInfo; + SmallVector operandInfo; Type strideType = parser.getBuilder().getIntegerType(32); Type columnMajorType = parser.getBuilder().getIntegerType(1); Type ptrType; @@ -3728,7 +3728,7 @@ ParseResult spirv::CooperativeMatrixStoreNVOp::parse(OpAsmParser &parser, OperationState &state) { - SmallVector operandInfo; + SmallVector operandInfo; Type strideType = parser.getBuilder().getIntegerType(32); Type columnMajorType = parser.getBuilder().getIntegerType(1); Type ptrType; @@ -3859,10 +3859,10 @@ ParseResult spirv::CopyMemoryOp::parse(OpAsmParser &parser, OperationState &state) { spirv::StorageClass targetStorageClass; - OpAsmParser::OperandType targetPtrInfo; + OpAsmParser::UnresolvedOperand targetPtrInfo; spirv::StorageClass sourceStorageClass; - OpAsmParser::OperandType sourcePtrInfo; + OpAsmParser::UnresolvedOperand sourcePtrInfo; Type elementType; @@ -4325,8 +4325,8 @@ static ParseResult parsePtrAccessChainOpImpl(StringRef opName, OpAsmParser &parser, OperationState &state) { - OpAsmParser::OperandType ptrInfo; - SmallVector indicesInfo; + OpAsmParser::UnresolvedOperand ptrInfo; + SmallVector indicesInfo; Type type; auto loc = parser.getCurrentLocation(); SmallVector indicesTypes; Index: mlir/lib/Dialect/Shape/IR/Shape.cpp =================================================================== --- mlir/lib/Dialect/Shape/IR/Shape.cpp +++ mlir/lib/Dialect/Shape/IR/Shape.cpp @@ -257,7 +257,7 @@ Region *doRegion = result.addRegion(); auto &builder = parser.getBuilder(); - OpAsmParser::OperandType cond; + OpAsmParser::UnresolvedOperand cond; if (parser.parseOperand(cond) || parser.resolveOperand(cond, builder.getType(), result.operands)) @@ -1832,7 +1832,7 @@ ParseResult ReduceOp::parse(OpAsmParser &parser, OperationState &result) { // Parse operands. - SmallVector operands; + SmallVector operands; Type shapeOrExtentTensorType; if (parser.parseOperandList(operands, /*requiredOperandCount=*/-1, OpAsmParser::Delimiter::Paren) || Index: mlir/lib/Dialect/Tensor/IR/TensorOps.cpp =================================================================== --- mlir/lib/Dialect/Tensor/IR/TensorOps.cpp +++ mlir/lib/Dialect/Tensor/IR/TensorOps.cpp @@ -1734,7 +1734,7 @@ Type typeToInfer, Type typeToInferFrom) {} ParseResult parseInferType(OpAsmParser &parser, - Optional optOperand, + Optional optOperand, Type &typeToInfer, Type typeToInferFrom) { if (optOperand) typeToInfer = typeToInferFrom; Index: mlir/lib/Dialect/Vector/IR/VectorOps.cpp =================================================================== --- mlir/lib/Dialect/Vector/IR/VectorOps.cpp +++ mlir/lib/Dialect/Vector/IR/VectorOps.cpp @@ -416,7 +416,7 @@ } ParseResult ReductionOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector operandsInfo; + SmallVector operandsInfo; Type redType; Type resType; CombiningKindAttr kindAttr; @@ -526,10 +526,10 @@ } ParseResult ContractionOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType lhsInfo; - OpAsmParser::OperandType rhsInfo; - OpAsmParser::OperandType accInfo; - SmallVector masksInfo; + OpAsmParser::UnresolvedOperand lhsInfo; + OpAsmParser::UnresolvedOperand rhsInfo; + OpAsmParser::UnresolvedOperand accInfo; + SmallVector masksInfo; SmallVector types; Type resultType; auto loc = parser.getCurrentLocation(); @@ -2097,7 +2097,7 @@ } ParseResult OuterProductOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector operandsInfo; + SmallVector operandsInfo; Type tLHS, tRHS; if (parser.parseOperandList(operandsInfo) || parser.parseOptionalAttrDict(result.attributes) || @@ -2736,11 +2736,11 @@ ParseResult TransferReadOp::parse(OpAsmParser &parser, OperationState &result) { auto &builder = parser.getBuilder(); SMLoc typesLoc; - OpAsmParser::OperandType sourceInfo; - SmallVector indexInfo; - OpAsmParser::OperandType paddingInfo; + OpAsmParser::UnresolvedOperand sourceInfo; + SmallVector indexInfo; + OpAsmParser::UnresolvedOperand paddingInfo; SmallVector types; - OpAsmParser::OperandType maskInfo; + OpAsmParser::UnresolvedOperand maskInfo; // Parsing with support for paddingValue. if (parser.parseOperand(sourceInfo) || parser.parseOperandList(indexInfo, OpAsmParser::Delimiter::Square) || @@ -3115,10 +3115,10 @@ OperationState &result) { auto &builder = parser.getBuilder(); SMLoc typesLoc; - OpAsmParser::OperandType vectorInfo, sourceInfo; - SmallVector indexInfo; + OpAsmParser::UnresolvedOperand vectorInfo, sourceInfo; + SmallVector indexInfo; SmallVector types; - OpAsmParser::OperandType maskInfo; + OpAsmParser::UnresolvedOperand maskInfo; if (parser.parseOperand(vectorInfo) || parser.parseComma() || parser.parseOperand(sourceInfo) || parser.parseOperandList(indexInfo, OpAsmParser::Delimiter::Square)) Index: mlir/lib/IR/FunctionImplementation.cpp =================================================================== --- mlir/lib/IR/FunctionImplementation.cpp +++ mlir/lib/IR/FunctionImplementation.cpp @@ -15,7 +15,7 @@ ParseResult mlir::function_interface_impl::parseFunctionArgumentList( OpAsmParser &parser, bool allowAttributes, bool allowVariadic, - SmallVectorImpl &argNames, + SmallVectorImpl &argNames, SmallVectorImpl &argTypes, SmallVectorImpl &argAttrs, SmallVectorImpl &argLocations, bool &isVariadic) { if (parser.parseLParen()) @@ -28,7 +28,7 @@ SMLoc loc = parser.getCurrentLocation(); // Parse argument name if present. - OpAsmParser::OperandType argument; + OpAsmParser::UnresolvedOperand argument; Type argumentType; if (succeeded(parser.parseOptionalRegionArgument(argument)) && !argument.name.empty()) { @@ -133,7 +133,7 @@ ParseResult mlir::function_interface_impl::parseFunctionSignature( OpAsmParser &parser, bool allowVariadic, - SmallVectorImpl &argNames, + SmallVectorImpl &argNames, SmallVectorImpl &argTypes, SmallVectorImpl &argAttrs, SmallVectorImpl &argLocations, bool &isVariadic, SmallVectorImpl &resultTypes, @@ -194,7 +194,7 @@ ParseResult mlir::function_interface_impl::parseFunctionOp( OpAsmParser &parser, OperationState &result, bool allowVariadic, FuncTypeBuilder funcTypeBuilder) { - SmallVector entryArgs; + SmallVector entryArgs; SmallVector argAttrs; SmallVector resultAttrs; SmallVector argTypes; Index: mlir/lib/Interfaces/ViewLikeInterface.cpp =================================================================== --- mlir/lib/Interfaces/ViewLikeInterface.cpp +++ mlir/lib/Interfaces/ViewLikeInterface.cpp @@ -105,10 +105,10 @@ } template -static ParseResult -parseOperandsOrIntegersImpl(OpAsmParser &parser, - SmallVectorImpl &values, - ArrayAttr &integers) { +static ParseResult parseOperandsOrIntegersImpl( + OpAsmParser &parser, + SmallVectorImpl &values, + ArrayAttr &integers) { if (failed(parser.parseLSquare())) return failure(); // 0-D. @@ -119,7 +119,7 @@ SmallVector attrVals; while (true) { - OpAsmParser::OperandType operand; + OpAsmParser::UnresolvedOperand operand; auto res = parser.parseOptionalOperand(operand); if (res.hasValue() && succeeded(res.getValue())) { values.push_back(operand); @@ -143,14 +143,16 @@ } ParseResult mlir::parseOperandsOrIntegersOffsetsOrStridesList( - OpAsmParser &parser, SmallVectorImpl &values, + OpAsmParser &parser, + SmallVectorImpl &values, ArrayAttr &integers) { return parseOperandsOrIntegersImpl( parser, values, integers); } ParseResult mlir::parseOperandsOrIntegersSizesList( - OpAsmParser &parser, SmallVectorImpl &values, + OpAsmParser &parser, + SmallVectorImpl &values, ArrayAttr &integers) { return parseOperandsOrIntegersImpl(parser, values, integers); Index: mlir/lib/Parser/Parser.cpp =================================================================== --- mlir/lib/Parser/Parser.cpp +++ mlir/lib/Parser/Parser.cpp @@ -334,7 +334,7 @@ using OpOrArgument = llvm::PointerUnion; /// Parse an optional trailing location and add it to the specifier Operation - /// or `OperandType` if present. + /// or `UnresolvedOperand` if present. /// /// trailing-location ::= (`loc` (`(` location `)` | attribute-alias))? /// @@ -1216,29 +1216,30 @@ ParseResult parseGenericOperationAfterOpName( OperationState &result, - Optional> parsedOperandTypes, + Optional> parsedUnresolvedOperands, Optional> parsedSuccessors, Optional>> parsedRegions, Optional> parsedAttributes, Optional parsedFnType) final { - // TODO: The types, OperandType and SSAUseInfo, both share the same members - // but in different order. It would be cleaner to make one alias of the - // other, making the following code redundant. + // TODO: The types, UnresolvedOperand and SSAUseInfo, both share the same + // members but in different order. It would be cleaner to make one alias of + // the other, making the following code redundant. SmallVector parsedOperandUseInfo; - if (parsedOperandTypes) { - for (const OperandType &parsedOperandType : *parsedOperandTypes) + if (parsedUnresolvedOperands) { + for (const UnresolvedOperand &parsedUnresolvedOperand : + *parsedUnresolvedOperands) parsedOperandUseInfo.push_back({ - parsedOperandType.name, - parsedOperandType.number, - parsedOperandType.location, + parsedUnresolvedOperand.name, + parsedUnresolvedOperand.number, + parsedUnresolvedOperand.location, }); } return parser.parseGenericOperationAfterOpName( result, - parsedOperandTypes ? llvm::makeArrayRef(parsedOperandUseInfo) - : llvm::None, + parsedUnresolvedOperands ? llvm::makeArrayRef(parsedOperandUseInfo) + : llvm::None, parsedSuccessors, parsedRegions, parsedAttributes, parsedFnType); } //===--------------------------------------------------------------------===// @@ -1290,7 +1291,7 @@ //===--------------------------------------------------------------------===// /// Parse a single operand. - ParseResult parseOperand(OperandType &result) override { + ParseResult parseOperand(UnresolvedOperand &result) override { OperationParser::SSAUseInfo useInfo; if (parser.parseSSAUse(useInfo)) return failure(); @@ -1300,7 +1301,7 @@ } /// Parse a single operand if present. - OptionalParseResult parseOptionalOperand(OperandType &result) override { + OptionalParseResult parseOptionalOperand(UnresolvedOperand &result) override { if (parser.getToken().is(Token::percent_identifier)) return parseOperand(result); return llvm::None; @@ -1308,7 +1309,7 @@ /// Parse zero or more SSA comma-separated operand references with a specified /// surrounding delimiter, and an optional required operand count. - ParseResult parseOperandList(SmallVectorImpl &result, + ParseResult parseOperandList(SmallVectorImpl &result, int requiredOperandCount = -1, Delimiter delimiter = Delimiter::None) override { return parseOperandOrRegionArgList(result, /*isOperandList=*/true, @@ -1318,7 +1319,7 @@ /// Parse zero or more SSA comma-separated operand or region arguments with /// optional surrounding delimiter and required operand count. ParseResult - parseOperandOrRegionArgList(SmallVectorImpl &result, + parseOperandOrRegionArgList(SmallVectorImpl &result, bool isOperandList, int requiredOperandCount = -1, Delimiter delimiter = Delimiter::None) { auto startLoc = parser.getToken().getLoc(); @@ -1342,7 +1343,7 @@ } auto parseOneOperand = [&]() -> ParseResult { - OperandType operandOrArg; + UnresolvedOperand operandOrArg; if (isOperandList ? parseOperand(operandOrArg) : parseRegionArgument(operandOrArg)) return failure(); @@ -1364,9 +1365,10 @@ /// Parse zero or more trailing SSA comma-separated trailing operand /// references with a specified surrounding delimiter, and an optional /// required operand count. A leading comma is expected before the operands. - ParseResult parseTrailingOperandList(SmallVectorImpl &result, - int requiredOperandCount, - Delimiter delimiter) override { + ParseResult + parseTrailingOperandList(SmallVectorImpl &result, + int requiredOperandCount, + Delimiter delimiter) override { if (parser.getToken().is(Token::comma)) { parseComma(); return parseOperandList(result, requiredOperandCount, delimiter); @@ -1378,7 +1380,7 @@ } /// Resolve an operand to an SSA value, emitting an error on failure. - ParseResult resolveOperand(const OperandType &operand, Type type, + ParseResult resolveOperand(const UnresolvedOperand &operand, Type type, SmallVectorImpl &result) override { OperationParser::SSAUseInfo operandInfo = {operand.name, operand.number, operand.location}; @@ -1390,15 +1392,15 @@ } /// Parse an AffineMap of SSA ids. - ParseResult parseAffineMapOfSSAIds(SmallVectorImpl &operands, - Attribute &mapAttr, StringRef attrName, - NamedAttrList &attrs, - Delimiter delimiter) override { - SmallVector dimOperands; - SmallVector symOperands; + ParseResult + parseAffineMapOfSSAIds(SmallVectorImpl &operands, + Attribute &mapAttr, StringRef attrName, + NamedAttrList &attrs, Delimiter delimiter) override { + SmallVector dimOperands; + SmallVector symOperands; auto parseElement = [&](bool isSymbol) -> ParseResult { - OperandType operand; + UnresolvedOperand operand; if (parseOperand(operand)) return failure(); if (isSymbol) @@ -1425,11 +1427,11 @@ /// Parse an AffineExpr of SSA ids. ParseResult - parseAffineExprOfSSAIds(SmallVectorImpl &dimOperands, - SmallVectorImpl &symbOperands, + parseAffineExprOfSSAIds(SmallVectorImpl &dimOperands, + SmallVectorImpl &symbOperands, AffineExpr &expr) override { auto parseElement = [&](bool isSymbol) -> ParseResult { - OperandType operand; + UnresolvedOperand operand; if (parseOperand(operand)) return failure(); if (isSymbol) @@ -1448,7 +1450,7 @@ /// Parse a region that takes `arguments` of `argTypes` types. This /// effectively defines the SSA values of `arguments` and assigns their type. - ParseResult parseRegion(Region ®ion, ArrayRef arguments, + ParseResult parseRegion(Region ®ion, ArrayRef arguments, ArrayRef argTypes, ArrayRef argLocations, bool enableNameShadowing) override { @@ -1458,7 +1460,7 @@ SmallVector, 2> regionArguments; for (auto pair : llvm::zip(arguments, argTypes)) { - const OperandType &operand = std::get<0>(pair); + const UnresolvedOperand &operand = std::get<0>(pair); Type type = std::get<1>(pair); OperationParser::SSAUseInfo operandInfo = {operand.name, operand.number, operand.location}; @@ -1477,7 +1479,7 @@ /// Parses a region if present. OptionalParseResult parseOptionalRegion(Region ®ion, - ArrayRef arguments, + ArrayRef arguments, ArrayRef argTypes, ArrayRef argLocations, bool enableNameShadowing) override { @@ -1490,10 +1492,9 @@ /// Parses a region if present. If the region is present, a new region is /// allocated and placed in `region`. If no region is present, `region` /// remains untouched. - OptionalParseResult - parseOptionalRegion(std::unique_ptr ®ion, - ArrayRef arguments, ArrayRef argTypes, - bool enableNameShadowing = false) override { + OptionalParseResult parseOptionalRegion( + std::unique_ptr ®ion, ArrayRef arguments, + ArrayRef argTypes, bool enableNameShadowing = false) override { if (parser.getToken().isNot(Token::l_brace)) return llvm::None; std::unique_ptr newRegion = std::make_unique(); @@ -1507,19 +1508,20 @@ /// Parse a region argument. The type of the argument will be resolved later /// by a call to `parseRegion`. - ParseResult parseRegionArgument(OperandType &argument) override { + ParseResult parseRegionArgument(UnresolvedOperand &argument) override { return parseOperand(argument); } /// Parse a region argument if present. - ParseResult parseOptionalRegionArgument(OperandType &argument) override { + ParseResult + parseOptionalRegionArgument(UnresolvedOperand &argument) override { if (parser.getToken().isNot(Token::percent_identifier)) return success(); return parseRegionArgument(argument); } ParseResult - parseRegionArgumentList(SmallVectorImpl &result, + parseRegionArgumentList(SmallVectorImpl &result, int requiredOperandCount = -1, Delimiter delimiter = Delimiter::None) override { return parseOperandOrRegionArgList(result, /*isOperandList=*/false, @@ -1563,14 +1565,14 @@ /// Parse a list of assignments of the form /// (%x1 = %y1, %x2 = %y2, ...). - OptionalParseResult - parseOptionalAssignmentList(SmallVectorImpl &lhs, - SmallVectorImpl &rhs) override { + OptionalParseResult parseOptionalAssignmentList( + SmallVectorImpl &lhs, + SmallVectorImpl &rhs) override { if (failed(parseOptionalLParen())) return llvm::None; auto parseElt = [&]() -> ParseResult { - OperandType regionArg, operand; + UnresolvedOperand regionArg, operand; if (parseRegionArgument(regionArg) || parseEqual() || parseOperand(operand)) return failure(); @@ -1584,14 +1586,14 @@ /// Parse a list of assignments of the form /// (%x1 = %y1 : type1, %x2 = %y2 : type2, ...). OptionalParseResult - parseOptionalAssignmentListWithTypes(SmallVectorImpl &lhs, - SmallVectorImpl &rhs, + parseOptionalAssignmentListWithTypes(SmallVectorImpl &lhs, + SmallVectorImpl &rhs, SmallVectorImpl &types) override { if (failed(parseOptionalLParen())) return llvm::None; auto parseElt = [&]() -> ParseResult { - OperandType regionArg, operand; + UnresolvedOperand regionArg, operand; Type type; if (parseRegionArgument(regionArg) || parseEqual() || parseOperand(operand) || parseColon() || parseType(type)) Index: mlir/test/lib/Dialect/Test/TestDialect.cpp =================================================================== --- mlir/test/lib/Dialect/Test/TestDialect.cpp +++ mlir/test/lib/Dialect/Test/TestDialect.cpp @@ -415,9 +415,8 @@ //===----------------------------------------------------------------------===// // Parsing -static ParseResult -parseCustomOptionalOperand(OpAsmParser &parser, - Optional &optOperand) { +static ParseResult parseCustomOptionalOperand( + OpAsmParser &parser, Optional &optOperand) { if (succeeded(parser.parseOptionalLParen())) { optOperand.emplace(); if (parser.parseOperand(*optOperand) || parser.parseRParen()) @@ -427,9 +426,9 @@ } static ParseResult parseCustomDirectiveOperands( - OpAsmParser &parser, OpAsmParser::OperandType &operand, - Optional &optOperand, - SmallVectorImpl &varOperands) { + OpAsmParser &parser, OpAsmParser::UnresolvedOperand &operand, + Optional &optOperand, + SmallVectorImpl &varOperands) { if (parser.parseOperand(operand)) return failure(); if (succeeded(parser.parseOptionalComma())) { @@ -480,10 +479,11 @@ return success(); } static ParseResult parseCustomDirectiveOperandsAndTypes( - OpAsmParser &parser, OpAsmParser::OperandType &operand, - Optional &optOperand, - SmallVectorImpl &varOperands, Type &operandType, - Type &optOperandType, SmallVectorImpl &varOperandTypes) { + OpAsmParser &parser, OpAsmParser::UnresolvedOperand &operand, + Optional &optOperand, + SmallVectorImpl &varOperands, + Type &operandType, Type &optOperandType, + SmallVectorImpl &varOperandTypes) { if (parseCustomDirectiveOperands(parser, operand, optOperand, varOperands) || parseCustomDirectiveResults(parser, operandType, optOperandType, varOperandTypes)) @@ -533,7 +533,7 @@ return parser.parseOptionalAttrDict(attrs); } static ParseResult parseCustomDirectiveOptionalOperandRef( - OpAsmParser &parser, Optional &optOperand) { + OpAsmParser &parser, Optional &optOperand) { int64_t operandCount = 0; if (parser.parseInteger(operandCount)) return failure(); @@ -624,7 +624,7 @@ ParseResult IsolatedRegionOp::parse(OpAsmParser &parser, OperationState &result) { - OpAsmParser::OperandType argInfo; + OpAsmParser::UnresolvedOperand argInfo; Type argType = parser.getBuilder().getIndexType(); // Parse the input operand. @@ -774,7 +774,7 @@ Location currLocation = parser.getEncodedSourceLoc(loc); // Parse the operands. - SmallVector operands; + SmallVector operands; if (parser.parseOperandList(operands)) return failure(); @@ -867,7 +867,7 @@ //===----------------------------------------------------------------------===// ParseResult PolyForOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector ivsInfo; + SmallVector ivsInfo; // Parse list of region arguments without a delimiter. if (parser.parseRegionArgumentList(ivsInfo)) return failure(); @@ -1205,7 +1205,7 @@ } ParseResult RegionIfOp::parse(OpAsmParser &parser, OperationState &result) { - SmallVector operandInfos; + SmallVector operandInfos; SmallVector operandTypes; result.regions.reserve(3); Index: mlir/tools/mlir-tblgen/OpFormatGen.cpp =================================================================== --- mlir/tools/mlir-tblgen/OpFormatGen.cpp +++ mlir/tools/mlir-tblgen/OpFormatGen.cpp @@ -471,7 +471,7 @@ const char *const optionalOperandParserCode = R"( { {0}OperandsLoc = parser.getCurrentLocation(); - ::mlir::OpAsmParser::OperandType operand; + ::mlir::OpAsmParser::UnresolvedOperand operand; ::mlir::OptionalParseResult parseResult = parser.parseOptionalOperand(operand); if (parseResult.hasValue()) { @@ -787,7 +787,7 @@ genElementParserStorage(paramElement, op, body); } else if (isa(element)) { - body << " ::mlir::SmallVector<::mlir::OpAsmParser::OperandType, 4> " + body << " ::mlir::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> " "allOperands;\n"; } else if (isa(element)) { @@ -805,17 +805,18 @@ } else if (auto *operand = dyn_cast(element)) { StringRef name = operand->getVar()->name; if (operand->getVar()->isVariableLength()) { - body << " ::mlir::SmallVector<::mlir::OpAsmParser::OperandType, 4> " - << name << "Operands;\n"; + body + << " ::mlir::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> " + << name << "Operands;\n"; if (operand->getVar()->isVariadicOfVariadic()) { body << " llvm::SmallVector " << name << "OperandGroupSizes;\n"; } } else { - body << " ::mlir::OpAsmParser::OperandType " << name + body << " ::mlir::OpAsmParser::UnresolvedOperand " << name << "RawOperands[1];\n" - << " ::llvm::ArrayRef<::mlir::OpAsmParser::OperandType> " << name - << "Operands(" << name << "RawOperands);"; + << " ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> " + << name << "Operands(" << name << "RawOperands);"; } body << llvm::formatv(" ::llvm::SMLoc {0}OperandsLoc;\n" " (void){0}OperandsLoc;\n", @@ -929,13 +930,13 @@ << "OperandsLoc = parser.getCurrentLocation();\n"; if (var->isOptional()) { body << llvm::formatv( - " ::llvm::Optional<::mlir::OpAsmParser::OperandType> " + " ::llvm::Optional<::mlir::OpAsmParser::UnresolvedOperand> " "{0}Operand;\n", var->name); } else if (var->isVariadicOfVariadic()) { body << llvm::formatv(" " "::llvm::SmallVector<::llvm::SmallVector<::mlir::" - "OpAsmParser::OperandType>> " + "OpAsmParser::UnresolvedOperand>> " "{0}OperandGroups;\n", var->name); } @@ -958,7 +959,7 @@ body << llvm::formatv( " {0} {1}Operand = {1}Operands.empty() ? {0}() : " "{1}Operands[0];\n", - "::llvm::Optional<::mlir::OpAsmParser::OperandType>", + "::llvm::Optional<::mlir::OpAsmParser::UnresolvedOperand>", operand->getVar()->name); } else if (auto *type = dyn_cast(input)) { @@ -1432,7 +1433,7 @@ // llvm::concat does not allow the case of a single range, so guard it here. body << " if (parser.resolveOperands("; if (op.getNumOperands() > 1) { - body << "::llvm::concat("; + body << "::llvm::concat("; llvm::interleaveComma(op.getOperands(), body, [&](auto &operand) { body << operand.name << "Operands"; });