I am not sure about the meaning of Type in the name (was it meant be interpreted as Kind?), and given the importance and meaning of Type in the context of MLIR, its probably better to rename it. Given the comment in the source code, the suggestion in the GitHub issue and the final discussions in the review, this patch renames the OperandType to UnresolvedOperand.
Fixes https://github.com/llvm/llvm-project/issues/54446
Differential Revision: https://reviews.llvm.org/D122142
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() {
return mlir::failure();
auto &builder = parser.getBuilder();
result.addAttribute("in_type", mlir::TypeAttr::get(intype));
- llvm::SmallVector<mlir::OpAsmParser::OperandType> operands;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> operands;
llvm::SmallVector<mlir::Type> typeVec;
bool hasOperands = false;
std::int32_t typeparamsSize = 0;
mlir::ParseResult fir::CallOp::parse(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- llvm::SmallVector<mlir::OpAsmParser::OperandType> operands;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> operands;
if (parser.parseOperandList(operands))
return mlir::failure();
return mlir::failure();
} else {
auto funcArgs =
- llvm::ArrayRef<mlir::OpAsmParser::OperandType>(operands).drop_front();
+ llvm::ArrayRef<mlir::OpAsmParser::UnresolvedOperand>(operands)
+ .drop_front();
if (parser.resolveOperand(operands[0], funcType, result.operands) ||
parser.resolveOperands(funcArgs, funcType.getInputs(),
parser.getNameLoc(), result.operands))
template <typename OPTY>
static mlir::ParseResult parseCmpOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- llvm::SmallVector<mlir::OpAsmParser::OperandType> ops;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> ops;
mlir::NamedAttrList attrs;
mlir::Attribute predicateNameAttr;
mlir::Type type;
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<mlir::OpAsmParser::OperandType> coorOperands;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> coorOperands;
if (parser.parseOperandList(coorOperands))
return mlir::failure();
- llvm::SmallVector<mlir::OpAsmParser::OperandType> allOperands;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> allOperands;
allOperands.push_back(memref);
allOperands.append(coorOperands.begin(), coorOperands.end());
mlir::FunctionType funcTy;
mlir::ParseResult DispatchOp::parse(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
mlir::FunctionType calleeType;
- llvm::SmallVector<mlir::OpAsmParser::OperandType> operands;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> operands;
auto calleeLoc = parser.getNameLoc();
llvm::StringRef calleeName;
if (failed(parser.parseOptionalKeyword(&calleeName))) {
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();
result.addAttribute(fir::FieldIndexOp::typeAttrName(),
mlir::TypeAttr::get(recty));
if (!parser.parseOptionalLParen()) {
- llvm::SmallVector<mlir::OpAsmParser::OperandType> operands;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> operands;
llvm::SmallVector<mlir::Type> types;
auto loc = parser.getNameLoc();
if (parser.parseOperandList(operands, mlir::OpAsmParser::Delimiter::None) ||
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();
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() ||
return mlir::failure();
// Parse the initial iteration arguments.
- llvm::SmallVector<mlir::OpAsmParser::OperandType> regionArgs;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> regionArgs;
auto prependCount = false;
// Induction variable.
regionArgs.push_back(iterateVar);
if (succeeded(parser.parseOptionalKeyword("iter_args"))) {
- llvm::SmallVector<mlir::OpAsmParser::OperandType> operands;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> operands;
llvm::SmallVector<mlir::Type> regionTypes;
// Parse assignment list and results type list.
if (parser.parseAssignmentList(regionArgs, operands) ||
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) ||
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();
result.addAttribute("unordered", builder.getUnitAttr());
// Parse the optional initial iteration arguments.
- llvm::SmallVector<mlir::OpAsmParser::OperandType> regionArgs, operands;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> regionArgs, operands;
llvm::SmallVector<mlir::Type> argTypes;
auto prependCount = false;
regionArgs.push_back(inductionVariable);
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();
// 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<mlir::Attribute> attrs;
- llvm::SmallVector<mlir::OpAsmParser::OperandType> opers;
+ llvm::SmallVector<mlir::OpAsmParser::UnresolvedOperand> opers;
llvm::SmallVector<mlir::Block *> dests;
llvm::SmallVector<llvm::SmallVector<mlir::Value>> destArgs;
llvm::SmallVector<int32_t> argOffs;
if (attr.dyn_cast_or_null<mlir::UnitAttr>()) {
argOffs.push_back(0);
} else if (attr.dyn_cast_or_null<fir::ClosedIntervalAttr>()) {
- 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();
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);
}
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();
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) ||
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))
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())
- Single: `<Attribute-Storage-Type>(e.g. Attribute) &`
- Optional: `<Attribute-Storage-Type>(e.g. Attribute) &`
* Operand Variables
- - Single: `OpAsmParser::OperandType &`
- - Optional: `Optional<OpAsmParser::OperandType> &`
- - Variadic: `SmallVectorImpl<OpAsmParser::OperandType> &`
+ - Single: `OpAsmParser::UnresolvedOperand &`
+ - Optional: `Optional<OpAsmParser::UnresolvedOperand> &`
+ - Variadic: `SmallVectorImpl<OpAsmParser::UnresolvedOperand> &`
- VariadicOfVariadic:
- `SmallVectorImpl<SmallVector<OpAsmParser::OperandType>> &`
+ `SmallVectorImpl<SmallVector<OpAsmParser::UnresolvedOperand>> &`
* 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
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() ||
/// of 'printBinaryOp' below.
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
+ SmallVector<mlir::OpAsmParser::UnresolvedOperand, 2> operands;
SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
/// of 'printBinaryOp' below.
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
+ SmallVector<mlir::OpAsmParser::UnresolvedOperand, 2> operands;
SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
/// of 'printBinaryOp' below.
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
+ SmallVector<mlir::OpAsmParser::UnresolvedOperand, 2> operands;
SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
/// of 'printBinaryOp' below.
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
+ SmallVector<mlir::OpAsmParser::UnresolvedOperand, 2> operands;
SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
/// of 'printBinaryOp' below.
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
+ SmallVector<mlir::OpAsmParser::UnresolvedOperand, 2> operands;
SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
/// of 'printBinaryOp' below.
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
+ SmallVector<mlir::OpAsmParser::UnresolvedOperand, 2> operands;
SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
/// attributes and locations of the arguments.
ParseResult parseFunctionArgumentList(
OpAsmParser &parser, bool allowAttributes, bool allowVariadic,
- SmallVectorImpl<OpAsmParser::OperandType> &argNames,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &argNames,
SmallVectorImpl<Type> &argTypes, SmallVectorImpl<NamedAttrList> &argAttrs,
SmallVectorImpl<Location> &argLocations, bool &isVariadic);
/// 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<OpAsmParser::OperandType> &argNames,
- SmallVectorImpl<Type> &argTypes,
- SmallVectorImpl<NamedAttrList> &argAttrs,
- SmallVectorImpl<Location> &argLocations,
- bool &isVariadic, SmallVectorImpl<Type> &resultTypes,
- SmallVectorImpl<NamedAttrList> &resultAttrs);
+ParseResult parseFunctionSignature(
+ OpAsmParser &parser, bool allowVariadic,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &argNames,
+ SmallVectorImpl<Type> &argTypes, SmallVectorImpl<NamedAttrList> &argAttrs,
+ SmallVectorImpl<Location> &argLocations, bool &isVariadic,
+ SmallVectorImpl<Type> &resultTypes,
+ SmallVectorImpl<NamedAttrList> &resultAttrs);
/// Parser implementation for function-like operations. Uses
/// `funcTypeBuilder` to construct the custom function type given lists of
//===--------------------------------------------------------------------===//
/// 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),
/// skip parsing that component.
virtual ParseResult parseGenericOperationAfterOpName(
OperationState &result,
- Optional<ArrayRef<OperandType>> parsedOperandType = llvm::None,
+ Optional<ArrayRef<UnresolvedOperand>> parsedOperandType = llvm::None,
Optional<ArrayRef<Block *>> parsedSuccessors = llvm::None,
Optional<MutableArrayRef<std::unique_ptr<Region>>> parsedRegions =
llvm::None,
Optional<FunctionType> 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<OperandType> &result,
+ parseOperandList(SmallVectorImpl<UnresolvedOperand> &result,
int requiredOperandCount = -1,
Delimiter delimiter = Delimiter::None) = 0;
- ParseResult parseOperandList(SmallVectorImpl<OperandType> &result,
+ ParseResult parseOperandList(SmallVectorImpl<UnresolvedOperand> &result,
Delimiter delimiter) {
return parseOperandList(result, /*requiredOperandCount=*/-1, delimiter);
}
/// references with a specified surrounding delimiter, and an optional
/// required operand count. A leading comma is expected before the operands.
virtual ParseResult
- parseTrailingOperandList(SmallVectorImpl<OperandType> &result,
+ parseTrailingOperandList(SmallVectorImpl<UnresolvedOperand> &result,
int requiredOperandCount = -1,
Delimiter delimiter = Delimiter::None) = 0;
- ParseResult parseTrailingOperandList(SmallVectorImpl<OperandType> &result,
- Delimiter delimiter) {
+ ParseResult
+ parseTrailingOperandList(SmallVectorImpl<UnresolvedOperand> &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<Value> &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<OperandType> operands, Type type,
+ ParseResult resolveOperands(ArrayRef<UnresolvedOperand> operands, Type type,
SmallVectorImpl<Value> &result) {
for (auto elt : operands)
if (resolveOperand(elt, type, result))
/// 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<OperandType> operands,
+ ParseResult resolveOperands(ArrayRef<UnresolvedOperand> operands,
ArrayRef<Type> types, SMLoc loc,
SmallVectorImpl<Value> &result) {
if (operands.size() != types.size())
/// Operand values must come from single-result sources, and be valid
/// dimensions/symbol identifiers according to mlir::isValidDim/Symbol.
virtual ParseResult
- parseAffineMapOfSSAIds(SmallVectorImpl<OperandType> &operands, Attribute &map,
- StringRef attrName, NamedAttrList &attrs,
+ parseAffineMapOfSSAIds(SmallVectorImpl<UnresolvedOperand> &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<OperandType> &dimOperands,
- SmallVectorImpl<OperandType> &symbOperands,
+ parseAffineExprOfSSAIds(SmallVectorImpl<UnresolvedOperand> &dimOperands,
+ SmallVectorImpl<UnresolvedOperand> &symbOperands,
AffineExpr &expr) = 0;
//===--------------------------------------------------------------------===//
/// scope. 'enableNameShadowing' can only be set to true for regions attached
/// to operations that are 'IsolatedFromAbove'.
virtual ParseResult parseRegion(Region ®ion,
- ArrayRef<OperandType> arguments = {},
+ ArrayRef<UnresolvedOperand> arguments = {},
ArrayRef<Type> argTypes = {},
ArrayRef<Location> argLocations = {},
bool enableNameShadowing = false) = 0;
/// Parses a region if present.
- virtual OptionalParseResult
- parseOptionalRegion(Region ®ion, ArrayRef<OperandType> arguments = {},
- ArrayRef<Type> argTypes = {},
- ArrayRef<Location> argLocations = {},
- bool enableNameShadowing = false) = 0;
+ virtual OptionalParseResult parseOptionalRegion(
+ Region ®ion, ArrayRef<UnresolvedOperand> arguments = {},
+ ArrayRef<Type> argTypes = {}, ArrayRef<Location> 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<Region> ®ion, ArrayRef<OperandType> arguments = {},
- ArrayRef<Type> argTypes = {}, bool enableNameShadowing = false) = 0;
+ virtual OptionalParseResult
+ parseOptionalRegion(std::unique_ptr<Region> ®ion,
+ ArrayRef<UnresolvedOperand> arguments = {},
+ ArrayRef<Type> 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<OperandType> &result,
+ parseRegionArgumentList(SmallVectorImpl<UnresolvedOperand> &result,
int requiredOperandCount = -1,
Delimiter delimiter = Delimiter::None) = 0;
virtual ParseResult
- parseRegionArgumentList(SmallVectorImpl<OperandType> &result,
+ parseRegionArgumentList(SmallVectorImpl<UnresolvedOperand> &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
/// Parse a list of assignments of the form
/// (%x1 = %y1, %x2 = %y2, ...)
- ParseResult parseAssignmentList(SmallVectorImpl<OperandType> &lhs,
- SmallVectorImpl<OperandType> &rhs) {
+ ParseResult parseAssignmentList(SmallVectorImpl<UnresolvedOperand> &lhs,
+ SmallVectorImpl<UnresolvedOperand> &rhs) {
OptionalParseResult result = parseOptionalAssignmentList(lhs, rhs);
if (!result.hasValue())
return emitError(getCurrentLocation(), "expected '('");
}
virtual OptionalParseResult
- parseOptionalAssignmentList(SmallVectorImpl<OperandType> &lhs,
- SmallVectorImpl<OperandType> &rhs) = 0;
+ parseOptionalAssignmentList(SmallVectorImpl<UnresolvedOperand> &lhs,
+ SmallVectorImpl<UnresolvedOperand> &rhs) = 0;
/// Parse a list of assignments of the form
/// (%x1 = %y1 : type1, %x2 = %y2 : type2, ...)
- ParseResult parseAssignmentListWithTypes(SmallVectorImpl<OperandType> &lhs,
- SmallVectorImpl<OperandType> &rhs,
- SmallVectorImpl<Type> &types) {
+ ParseResult
+ parseAssignmentListWithTypes(SmallVectorImpl<UnresolvedOperand> &lhs,
+ SmallVectorImpl<UnresolvedOperand> &rhs,
+ SmallVectorImpl<Type> &types) {
OptionalParseResult result =
parseOptionalAssignmentListWithTypes(lhs, rhs, types);
if (!result.hasValue())
}
virtual OptionalParseResult
- parseOptionalAssignmentListWithTypes(SmallVectorImpl<OperandType> &lhs,
- SmallVectorImpl<OperandType> &rhs,
+ parseOptionalAssignmentListWithTypes(SmallVectorImpl<UnresolvedOperand> &lhs,
+ SmallVectorImpl<UnresolvedOperand> &rhs,
SmallVectorImpl<Type> &types) = 0;
private:
/// Parse either an operand list or a region argument list depending on
/// whether isOperandList is true.
- ParseResult parseOperandOrRegionArgList(SmallVectorImpl<OperandType> &result,
- bool isOperandList,
- int requiredOperandCount,
- Delimiter delimiter);
+ ParseResult
+ parseOperandOrRegionArgList(SmallVectorImpl<UnresolvedOperand> &result,
+ bool isOperandList, int requiredOperandCount,
+ Delimiter delimiter);
};
//===--------------------------------------------------------------------===//
/// 1. `result` is filled with the i64 ArrayAttr "[`dynVal`, 7, 42, `dynVal`]"
/// 2. `ssa` is filled with "[%arg0, %arg1]".
ParseResult parseOperandsOrIntegersOffsetsOrStridesList(
- OpAsmParser &parser, SmallVectorImpl<OpAsmParser::OperandType> &values,
+ OpAsmParser &parser,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
ArrayAttr &integers);
/// Pasrer hook for custom directive in assemblyFormat.
/// 1. `result` is filled with the i64 ArrayAttr "[`dynVal`, 7, 42, `dynVal`]"
/// 2. `ssa` is filled with "[%arg0, %arg1]".
ParseResult parseOperandsOrIntegersSizesList(
- OpAsmParser &parser, SmallVectorImpl<OpAsmParser::OperandType> &values,
+ OpAsmParser &parser,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
ArrayAttr &integers);
/// Verify that a the `values` has as many elements as the number of entries in
ParseResult mlir::parseDimAndSymbolList(OpAsmParser &parser,
SmallVectorImpl<Value> &operands,
unsigned &numDims) {
- SmallVector<OpAsmParser::OperandType, 8> opInfos;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> opInfos;
if (parser.parseOperandList(opInfos, OpAsmParser::Delimiter::Paren))
return failure();
// Store number of dimensions for validation by caller.
//
ParseResult AffineDmaStartOp::parse(OpAsmParser &parser,
OperationState &result) {
- OpAsmParser::OperandType srcMemRefInfo;
+ OpAsmParser::UnresolvedOperand srcMemRefInfo;
AffineMapAttr srcMapAttr;
- SmallVector<OpAsmParser::OperandType, 4> srcMapOperands;
- OpAsmParser::OperandType dstMemRefInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> srcMapOperands;
+ OpAsmParser::UnresolvedOperand dstMemRefInfo;
AffineMapAttr dstMapAttr;
- SmallVector<OpAsmParser::OperandType, 4> dstMapOperands;
- OpAsmParser::OperandType tagMemRefInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> dstMapOperands;
+ OpAsmParser::UnresolvedOperand tagMemRefInfo;
AffineMapAttr tagMapAttr;
- SmallVector<OpAsmParser::OperandType, 4> tagMapOperands;
- OpAsmParser::OperandType numElementsInfo;
- SmallVector<OpAsmParser::OperandType, 2> strideInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> tagMapOperands;
+ OpAsmParser::UnresolvedOperand numElementsInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> strideInfo;
SmallVector<Type, 3> types;
auto indexType = parser.getBuilder().getIndexType();
//
ParseResult AffineDmaWaitOp::parse(OpAsmParser &parser,
OperationState &result) {
- OpAsmParser::OperandType tagMemRefInfo;
+ OpAsmParser::UnresolvedOperand tagMemRefInfo;
AffineMapAttr tagMapAttr;
- SmallVector<OpAsmParser::OperandType, 2> tagMapOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> 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) ||
: AffineForOp::getUpperBoundAttrName();
// Parse ssa-id as identity map.
- SmallVector<OpAsmParser::OperandType, 1> boundOpInfos;
+ SmallVector<OpAsmParser::UnresolvedOperand, 1> boundOpInfos;
if (p.parseOperandList(boundOpInfos))
return failure();
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();
}
// Parse the optional initial iteration arguments.
- SmallVector<OpAsmParser::OperandType, 4> regionArgs, operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> regionArgs, operands;
SmallVector<Type, 4> argTypes;
regionArgs.push_back(inductionVariable);
auto indexTy = builder.getIndexType();
MemRefType type;
- OpAsmParser::OperandType memrefInfo;
+ OpAsmParser::UnresolvedOperand memrefInfo;
AffineMapAttr mapAttr;
- SmallVector<OpAsmParser::OperandType, 1> mapOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 1> mapOperands;
return failure(
parser.parseOperand(memrefInfo) ||
parser.parseAffineMapOfSSAIds(mapOperands, mapAttr,
auto indexTy = parser.getBuilder().getIndexType();
MemRefType type;
- OpAsmParser::OperandType storeValueInfo;
- OpAsmParser::OperandType memrefInfo;
+ OpAsmParser::UnresolvedOperand storeValueInfo;
+ OpAsmParser::UnresolvedOperand memrefInfo;
AffineMapAttr mapAttr;
- SmallVector<OpAsmParser::OperandType, 1> mapOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 1> mapOperands;
return failure(parser.parseOperand(storeValueInfo) || parser.parseComma() ||
parser.parseOperand(memrefInfo) ||
parser.parseAffineMapOfSSAIds(mapOperands, mapAttr,
OperationState &result) {
auto &builder = parser.getBuilder();
auto indexType = builder.getIndexType();
- SmallVector<OpAsmParser::OperandType, 8> dimInfos;
- SmallVector<OpAsmParser::OperandType, 8> symInfos;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> dimInfos;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> symInfos;
AffineMapAttr mapAttr;
return failure(
parser.parseAttribute(mapAttr, T::getMapAttrName(), result.attributes) ||
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<OpAsmParser::OperandType, 1> mapOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 1> mapOperands;
if (parser.parseOperand(memrefInfo) ||
parser.parseAffineMapOfSSAIds(mapOperands, mapAttr,
AffinePrefetchOp::getMapAttrName(),
/// `operands` to accept `uniqueOperands` instead.
static void deduplicateAndResolveOperands(
OpAsmParser &parser,
- ArrayRef<SmallVector<OpAsmParser::OperandType>> operands,
+ ArrayRef<SmallVector<OpAsmParser::UnresolvedOperand>> operands,
SmallVectorImpl<Value> &uniqueOperands,
SmallVectorImpl<AffineExpr> &replacements, AffineExprKind kind) {
assert((kind == AffineExprKind::DimId || kind == AffineExprKind::SymbolId) &&
}
SmallVector<AffineExpr> flatExprs;
- SmallVector<SmallVector<OpAsmParser::OperandType>> flatDimOperands;
- SmallVector<SmallVector<OpAsmParser::OperandType>> flatSymOperands;
+ SmallVector<SmallVector<OpAsmParser::UnresolvedOperand>> flatDimOperands;
+ SmallVector<SmallVector<OpAsmParser::UnresolvedOperand>> flatSymOperands;
SmallVector<int32_t> numMapsPerGroup;
- SmallVector<OpAsmParser::OperandType> mapOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand> mapOperands;
do {
if (succeeded(parser.parseOptionalKeyword(
kind == MinMaxKind::Min ? "min" : "max"))) {
llvm::append_range(flatExprs, map.getValue().getResults());
auto operandsRef = llvm::makeArrayRef(mapOperands);
auto dimsRef = operandsRef.take_front(map.getValue().getNumDims());
- SmallVector<OpAsmParser::OperandType> dims(dimsRef.begin(),
- dimsRef.end());
+ SmallVector<OpAsmParser::UnresolvedOperand> dims(dimsRef.begin(),
+ dimsRef.end());
auto symsRef = operandsRef.drop_front(map.getValue().getNumDims());
- SmallVector<OpAsmParser::OperandType> syms(symsRef.begin(),
- symsRef.end());
+ SmallVector<OpAsmParser::UnresolvedOperand> syms(symsRef.begin(),
+ symsRef.end());
flatDimOperands.append(map.getValue().getNumResults(), dims);
flatSymOperands.append(map.getValue().getNumResults(), syms);
numMapsPerGroup.push_back(map.getValue().getNumResults());
OperationState &result) {
auto &builder = parser.getBuilder();
auto indexType = builder.getIndexType();
- SmallVector<OpAsmParser::OperandType, 4> ivs;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> ivs;
if (parser.parseRegionArgumentList(ivs, /*requiredOperandCount=*/-1,
OpAsmParser::Delimiter::Paren) ||
parser.parseEqual() ||
AffineMapAttr stepsMapAttr;
NamedAttrList stepsAttrs;
- SmallVector<OpAsmParser::OperandType, 4> stepsMapOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> stepsMapOperands;
if (failed(parser.parseOptionalKeyword("step"))) {
SmallVector<int64_t, 4> steps(ivs.size(), 1);
result.addAttribute(AffineParallelOp::getStepsAttrName(),
MemRefType memrefType;
VectorType resultType;
- OpAsmParser::OperandType memrefInfo;
+ OpAsmParser::UnresolvedOperand memrefInfo;
AffineMapAttr mapAttr;
- SmallVector<OpAsmParser::OperandType, 1> mapOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 1> mapOperands;
return failure(
parser.parseOperand(memrefInfo) ||
parser.parseAffineMapOfSSAIds(mapOperands, mapAttr,
MemRefType memrefType;
VectorType resultType;
- OpAsmParser::OperandType storeValueInfo;
- OpAsmParser::OperandType memrefInfo;
+ OpAsmParser::UnresolvedOperand storeValueInfo;
+ OpAsmParser::UnresolvedOperand memrefInfo;
AffineMapAttr mapAttr;
- SmallVector<OpAsmParser::OperandType, 1> mapOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 1> mapOperands;
return failure(
parser.parseOperand(storeValueInfo) || parser.parseComma() ||
parser.parseOperand(memrefInfo) ||
ParseResult SelectOp::parse(OpAsmParser &parser, OperationState &result) {
Type conditionType, resultType;
- SmallVector<OpAsmParser::OperandType, 3> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 3> operands;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/3) ||
parser.parseOptionalAttrDict(result.attributes) ||
parser.parseColonType(resultType))
// Parse dependency tokens.
if (succeeded(parser.parseOptionalLSquare())) {
- SmallVector<OpAsmParser::OperandType, 4> tokenArgs;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> tokenArgs;
if (parser.parseOperandList(tokenArgs) ||
parser.resolveOperands(tokenArgs, tokenTy, result.operands) ||
parser.parseRSquare())
}
// Parse async value operands (%value as %unwrapped : !async.value<!type>).
- SmallVector<OpAsmParser::OperandType, 4> valueArgs;
- SmallVector<OpAsmParser::OperandType, 4> unwrappedArgs;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> valueArgs;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> unwrappedArgs;
SmallVector<Type, 4> valueTypes;
SmallVector<Type, 4> unwrappedTypes;
/// ( `,` integer `:` bb-id (`(` ssa-use-and-type-list `)`)? )*
static ParseResult parseSwitchOpCases(
OpAsmParser &parser, Type &flagType, Block *&defaultDestination,
- SmallVectorImpl<OpAsmParser::OperandType> &defaultOperands,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &defaultOperands,
SmallVectorImpl<Type> &defaultOperandTypes,
DenseIntElementsAttr &caseValues,
SmallVectorImpl<Block *> &caseDestinations,
- SmallVectorImpl<SmallVector<OpAsmParser::OperandType>> &caseOperands,
+ SmallVectorImpl<SmallVector<OpAsmParser::UnresolvedOperand>> &caseOperands,
SmallVectorImpl<SmallVector<Type>> &caseOperandTypes) {
if (parser.parseKeyword("default") || parser.parseColon() ||
parser.parseSuccessor(defaultDestination))
values.push_back(APInt(bitWidth, value));
Block *destination;
- SmallVector<OpAsmParser::OperandType> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand> operands;
SmallVector<Type> operandTypes;
if (failed(parser.parseColon()) ||
failed(parser.parseSuccessor(destination)))
// SSA value uses.
static ParseResult
parseSizeAssignment(OpAsmParser &parser,
- MutableArrayRef<OpAsmParser::OperandType> sizes,
- MutableArrayRef<OpAsmParser::OperandType> regionSizes,
- MutableArrayRef<OpAsmParser::OperandType> indices) {
+ MutableArrayRef<OpAsmParser::UnresolvedOperand> sizes,
+ MutableArrayRef<OpAsmParser::UnresolvedOperand> regionSizes,
+ MutableArrayRef<OpAsmParser::UnresolvedOperand> indices) {
assert(indices.size() == 3 && "space for three indices expected");
- SmallVector<OpAsmParser::OperandType, 3> args;
+ SmallVector<OpAsmParser::UnresolvedOperand, 3> args;
if (parser.parseRegionArgumentList(args, /*requiredOperandCount=*/3,
OpAsmParser::Delimiter::Paren) ||
parser.parseKeyword("in") || parser.parseLParen())
/// ssa-reassignment ::= `(` ssa-id `=` ssa-use (`,` ssa-id `=` ssa-use)* `)`
ParseResult LaunchOp::parse(OpAsmParser &parser, OperationState &result) {
// Sizes of the grid and block.
- SmallVector<OpAsmParser::OperandType, LaunchOp::kNumConfigOperands> sizes(
- LaunchOp::kNumConfigOperands);
- MutableArrayRef<OpAsmParser::OperandType> sizesRef(sizes);
+ SmallVector<OpAsmParser::UnresolvedOperand, LaunchOp::kNumConfigOperands>
+ sizes(LaunchOp::kNumConfigOperands);
+ MutableArrayRef<OpAsmParser::UnresolvedOperand> sizesRef(sizes);
// Actual (data) operands passed to the kernel.
- SmallVector<OpAsmParser::OperandType, 4> dataOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> dataOperands;
// Region arguments to be created.
- SmallVector<OpAsmParser::OperandType, 16> regionArgs(
+ SmallVector<OpAsmParser::UnresolvedOperand, 16> regionArgs(
LaunchOp::kNumConfigRegionAttributes);
- MutableArrayRef<OpAsmParser::OperandType> regionArgsRef(regionArgs);
+ MutableArrayRef<OpAsmParser::UnresolvedOperand> regionArgsRef(regionArgs);
// Parse the size assignment segments: the first segment assigns grid sizes
// and defines values for block identifiers; the second segment assigns block
result.operands))
return failure();
- OpAsmParser::OperandType dynamicSharedMemorySize;
+ OpAsmParser::UnresolvedOperand dynamicSharedMemorySize;
if (!parser.parseOptionalKeyword(
LaunchOp::getDynamicSharedMemorySizeKeyword()))
if (parser.parseOperand(dynamicSharedMemorySize) ||
return success();
}
-static ParseResult
-parseLaunchFuncOperands(OpAsmParser &parser,
- SmallVectorImpl<OpAsmParser::OperandType> &argNames,
- SmallVectorImpl<Type> &argTypes) {
+static ParseResult parseLaunchFuncOperands(
+ OpAsmParser &parser,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &argNames,
+ SmallVectorImpl<Type> &argTypes) {
if (parser.parseOptionalKeyword("args"))
return success();
SmallVector<NamedAttrList> argAttrs;
/// keyword provided as argument.
static ParseResult
parseAttributions(OpAsmParser &parser, StringRef keyword,
- SmallVectorImpl<OpAsmParser::OperandType> &args,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &args,
SmallVectorImpl<Type> &argTypes) {
// If we could not parse the keyword, just assume empty list and succeed.
if (failed(parser.parseOptionalKeyword(keyword)))
return success();
do {
- OpAsmParser::OperandType arg;
+ OpAsmParser::UnresolvedOperand arg;
Type type;
if (parser.parseRegionArgument(arg) || parser.parseColonType(type))
/// (`->` function-result-list)? memory-attribution `kernel`?
/// function-attributes? region
ParseResult GPUFuncOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType> entryArgs;
+ SmallVector<OpAsmParser::UnresolvedOperand> entryArgs;
SmallVector<NamedAttrList> argAttrs;
SmallVector<NamedAttrList> resultAttrs;
SmallVector<Type> argTypes;
static ParseResult parseAsyncDependencies(
OpAsmParser &parser, Type &asyncTokenType,
- SmallVectorImpl<OpAsmParser::OperandType> &asyncDependencies) {
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &asyncDependencies) {
auto loc = parser.getCurrentLocation();
if (succeeded(parser.parseOptionalKeyword("async"))) {
if (parser.getNumResults() == 0)
Builder &builder = parser.getBuilder();
StringAttr predicateAttr;
- OpAsmParser::OperandType lhs, rhs;
+ OpAsmParser::UnresolvedOperand lhs, rhs;
Type type;
SMLoc predicateLoc, trailingTypeLoc;
if (parser.getCurrentLocation(&predicateLoc) ||
// <operation> ::= `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") ||
static ParseResult parseSwitchOpCases(
OpAsmParser &parser, Type flagType, ElementsAttr &caseValues,
SmallVectorImpl<Block *> &caseDestinations,
- SmallVectorImpl<SmallVector<OpAsmParser::OperandType>> &caseOperands,
+ SmallVectorImpl<SmallVector<OpAsmParser::UnresolvedOperand>> &caseOperands,
SmallVectorImpl<SmallVector<Type>> &caseOperandTypes) {
SmallVector<APInt> values;
unsigned bitWidth = flagType.getIntOrFloatBitWidth();
values.push_back(APInt(bitWidth, value));
Block *destination;
- SmallVector<OpAsmParser::OperandType> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand> operands;
SmallVector<Type> operandTypes;
if (parser.parseColon() || parser.parseSuccessor(destination))
return failure();
static ParseResult
parseGEPIndices(OpAsmParser &parser,
- SmallVectorImpl<OpAsmParser::OperandType> &indices,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &indices,
DenseIntElementsAttr &structIndices) {
SmallVector<int32_t> constantIndices;
do {
// <operation> ::= `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;
// <operation> ::= `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;
/// `unwind` bb-id (`[` ssa-use-and-type-list `]`)?
/// attribute-dict? `:` function-type
ParseResult InvokeOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 8> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> operands;
FunctionType funcType;
SymbolRefAttr funcAttr;
SMLoc trailingTypeLoc;
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) ||
// <operation> ::= `llvm.call` (function-id | ssa-use) `(` ssa-use-list `)`
// attribute-dict? `:` function-type
ParseResult CallOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 8> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> operands;
Type type;
SymbolRefAttr funcAttr;
SMLoc trailingTypeLoc;
auto wrappedFuncType = LLVM::LLVMPointerType::get(llvmFuncType);
auto funcArguments =
- ArrayRef<OpAsmParser::OperandType>(operands).drop_front();
+ ArrayRef<OpAsmParser::UnresolvedOperand>(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
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) ||
// `[` 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;
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) ||
// `[` 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;
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) ||
parser, result, LLVM::Linkage::External)));
StringAttr nameAttr;
- SmallVector<OpAsmParser::OperandType> entryArgs;
+ SmallVector<OpAsmParser::UnresolvedOperand> entryArgs;
SmallVector<NamedAttrList> argAttrs;
SmallVector<NamedAttrList> resultAttrs;
SmallVector<Type> argTypes;
// 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") ||
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) ||
auto int32Ty = IntegerType::get(context, 32);
auto int1Ty = IntegerType::get(context, 1);
- SmallVector<OpAsmParser::OperandType, 8> ops;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> ops;
Type type;
return failure(parser.parseOperandList(ops) ||
parser.parseOptionalAttrDict(result.attributes) ||
// `llvm.amdgcn.buffer.load.* %rsrc, %vindex, %offset, %glc, %slc :
// result_type`
ParseResult MubufLoadOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 8> ops;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> ops;
Type type;
if (parser.parseOperandList(ops, 5) || parser.parseColonType(type) ||
parser.addTypeToList(type, result.types))
// `llvm.amdgcn.buffer.store.* %vdata, %rsrc, %vindex, %offset, %glc, %slc :
// result_type`
ParseResult MubufStoreOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 8> ops;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> ops;
Type type;
if (parser.parseOperandList(ops, 6) || parser.parseColonType(type))
return failure();
failed(parser.parseOptionalAttrDict(result.attributes)))
return failure();
- SmallVector<OpAsmParser::OperandType, 8> regionOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> regionOperands;
std::unique_ptr<Region> region = std::make_unique<Region>();
SmallVector<Type, 8> operandTypes, regionTypes;
if (parser.parseRegion(*region, regionOperands, regionTypes))
}
ParseResult YieldOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 2> opInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> opInfo;
SmallVector<Type, 2> types;
SMLoc loc = parser.getCurrentLocation();
return failure(parser.parseOperandList(opInfo) ||
SmallVectorImpl<Type> &inputTypes,
SmallVectorImpl<Type> &outputTypes) {
SMLoc inputsOperandsLoc, outputsOperandsLoc;
- SmallVector<OpAsmParser::OperandType, 4> inputsOperands, outputsOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> inputsOperands,
+ outputsOperands;
parser.parseOptionalAttrDict(result.attributes);
// memref<1 x i32>
//
ParseResult DmaStartOp::parse(OpAsmParser &parser, OperationState &result) {
- OpAsmParser::OperandType srcMemRefInfo;
- SmallVector<OpAsmParser::OperandType, 4> srcIndexInfos;
- OpAsmParser::OperandType dstMemRefInfo;
- SmallVector<OpAsmParser::OperandType, 4> dstIndexInfos;
- OpAsmParser::OperandType numElementsInfo;
- OpAsmParser::OperandType tagMemrefInfo;
- SmallVector<OpAsmParser::OperandType, 4> tagIndexInfos;
- SmallVector<OpAsmParser::OperandType, 2> strideInfo;
+ OpAsmParser::UnresolvedOperand srcMemRefInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> srcIndexInfos;
+ OpAsmParser::UnresolvedOperand dstMemRefInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> dstIndexInfos;
+ OpAsmParser::UnresolvedOperand numElementsInfo;
+ OpAsmParser::UnresolvedOperand tagMemrefInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> tagIndexInfos;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> strideInfo;
SmallVector<Type, 3> types;
auto indexType = parser.getBuilder().getIndexType();
ParseResult GenericAtomicRMWOp::parse(OpAsmParser &parser,
OperationState &result) {
- OpAsmParser::OperandType memref;
+ OpAsmParser::UnresolvedOperand memref;
Type memrefType;
- SmallVector<OpAsmParser::OperandType, 4> ivs;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> ivs;
Type indexType = parser.getBuilder().getIndexType();
if (parser.parseOperand(memref) ||
}
ParseResult PrefetchOp::parse(OpAsmParser &parser, OperationState &result) {
- OpAsmParser::OperandType memrefInfo;
- SmallVector<OpAsmParser::OperandType, 4> indexInfo;
+ OpAsmParser::UnresolvedOperand memrefInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> indexInfo;
IntegerAttr localityHint;
MemRefType type;
StringRef readOrWrite, cacheType;
}
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) ||
static ParseResult
parseOperandList(OpAsmParser &parser, StringRef keyword,
- SmallVectorImpl<OpAsmParser::OperandType> &args,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &args,
SmallVectorImpl<Type> &argTypes, OperationState &result) {
if (failed(parser.parseOptionalKeyword(keyword)))
return success();
return success();
do {
- OpAsmParser::OperandType arg;
+ OpAsmParser::UnresolvedOperand arg;
Type type;
if (parser.parseRegionArgument(arg) || parser.parseColonType(type))
}
static ParseResult parseOptionalOperand(OpAsmParser &parser, StringRef keyword,
- OpAsmParser::OperandType &operand,
+ OpAsmParser::UnresolvedOperand &operand,
Type type, bool &hasOptional,
OperationState &result) {
hasOptional = false;
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))
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());
/// region attr-dict?
ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) {
Builder &builder = parser.getBuilder();
- SmallVector<OpAsmParser::OperandType, 8> privateOperands,
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> privateOperands,
firstprivateOperands, copyOperands, copyinOperands,
copyinReadonlyOperands, copyoutOperands, copyoutZeroOperands,
createOperands, createZeroOperands, noCreateOperands, presentOperands,
firstprivateOperandTypes;
SmallVector<Type, 8> operandTypes;
- OpAsmParser::OperandType ifCond, selfCond;
+ OpAsmParser::UnresolvedOperand ifCond, selfCond;
bool hasIfCond = false, hasSelfCond = false;
OptionalParseResult async, numGangs, numWorkers, vectorLength;
Type i1Type = builder.getI1Type();
Builder &builder = parser.getBuilder();
unsigned executionMapping = OpenACCExecMapping::NONE;
SmallVector<Type, 8> operandTypes;
- SmallVector<OpAsmParser::OperandType, 8> privateOperands, reductionOperands;
- SmallVector<OpAsmParser::OperandType, 8> tileOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> privateOperands,
+ reductionOperands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> tileOperands;
OptionalParseResult gangNum, gangStatic, worker, vector;
// gang?
/// ssa-id-and-type ::= ssa-id `:` type
static ParseResult parseAllocateAndAllocator(
OpAsmParser &parser,
- SmallVectorImpl<OpAsmParser::OperandType> &operandsAllocate,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &operandsAllocate,
SmallVectorImpl<Type> &typesAllocate,
- SmallVectorImpl<OpAsmParser::OperandType> &operandsAllocator,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &operandsAllocator,
SmallVectorImpl<Type> &typesAllocator) {
return parser.parseCommaSeparatedList([&]() -> ParseResult {
- OpAsmParser::OperandType operand;
+ OpAsmParser::UnresolvedOperand operand;
Type type;
if (parser.parseOperand(operand) || parser.parseColonType(type))
return failure();
/// linear-val := ssa-id-and-type `=` ssa-id-and-type
static ParseResult
parseLinearClause(OpAsmParser &parser,
- SmallVectorImpl<OpAsmParser::OperandType> &vars,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &vars,
SmallVectorImpl<Type> &types,
- SmallVectorImpl<OpAsmParser::OperandType> &stepVars) {
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &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();
static ParseResult
parseScheduleClause(OpAsmParser &parser, SmallString<8> &schedule,
SmallVectorImpl<SmallString<12>> &modifiers,
- Optional<OpAsmParser::OperandType> &chunkSize,
+ Optional<OpAsmParser::UnresolvedOperand> &chunkSize,
Type &chunkType) {
if (parser.parseLParen())
return failure();
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 {
/// reduction-entry-list ::= reduction-entry
/// | reduction-entry-list `,` reduction-entry
/// reduction-entry ::= symbol-ref `->` ssa-id `:` type
-static ParseResult parseReductionVarList(
- OpAsmParser &parser, SmallVectorImpl<OpAsmParser::OperandType> &operands,
- SmallVectorImpl<Type> &types, ArrayAttr &redcuctionSymbols) {
+static ParseResult
+parseReductionVarList(OpAsmParser &parser,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &operands,
+ SmallVectorImpl<Type> &types,
+ ArrayAttr &redcuctionSymbols) {
SmallVector<SymbolRefAttr> reductionVec;
do {
if (parser.parseAttribute(reductionVec.emplace_back()) ||
StringRef opName = result.name.getStringRef();
// Containers for storing operands, types and attributes for various clauses
- SmallVector<OpAsmParser::OperandType> allocates, allocators;
+ SmallVector<OpAsmParser::UnresolvedOperand> allocates, allocators;
SmallVector<Type> allocateTypes, allocatorTypes;
ArrayAttr reductions;
- SmallVector<OpAsmParser::OperandType> reductionVars;
+ SmallVector<OpAsmParser::UnresolvedOperand> reductionVars;
SmallVector<Type> reductionVarTypes;
- SmallVector<OpAsmParser::OperandType> linears;
+ SmallVector<OpAsmParser::UnresolvedOperand> linears;
SmallVector<Type> linearTypes;
- SmallVector<OpAsmParser::OperandType> linearSteps;
+ SmallVector<OpAsmParser::UnresolvedOperand> linearSteps;
SmallString<8> schedule;
SmallVector<SmallString<12>> modifiers;
- Optional<OpAsmParser::OperandType> scheduleChunkSize;
+ Optional<OpAsmParser::UnresolvedOperand> scheduleChunkSize;
Type scheduleChunkType;
// Compute the position of clauses in operand segments
/// | reduction
ParseResult WsLoopOp::parse(OpAsmParser &parser, OperationState &result) {
// Parse an opening `(` followed by induction variables followed by `)`
- SmallVector<OpAsmParser::OperandType> ivs;
+ SmallVector<OpAsmParser::UnresolvedOperand> ivs;
if (parser.parseRegionArgumentList(ivs, /*requiredOperandCount=*/-1,
OpAsmParser::Delimiter::Paren))
return failure();
return failure();
// Parse loop bounds.
- SmallVector<OpAsmParser::OperandType> lower;
+ SmallVector<OpAsmParser::UnresolvedOperand> lower;
if (parser.parseEqual() ||
parser.parseOperandList(lower, numIVs, OpAsmParser::Delimiter::Paren) ||
parser.resolveOperands(lower, loopVarType, result.operands))
return failure();
- SmallVector<OpAsmParser::OperandType> upper;
+ SmallVector<OpAsmParser::UnresolvedOperand> upper;
if (parser.parseKeyword("to") ||
parser.parseOperandList(upper, numIVs, OpAsmParser::Delimiter::Paren) ||
parser.resolveOperands(upper, loopVarType, result.operands))
}
// Parse step values.
- SmallVector<OpAsmParser::OperandType> steps;
+ SmallVector<OpAsmParser::UnresolvedOperand> steps;
if (parser.parseKeyword("step") ||
parser.parseOperandList(steps, numIVs, OpAsmParser::Delimiter::Paren) ||
parser.resolveOperands(steps, loopVarType, result.operands))
// Now parse the body.
Region *body = result.addRegion();
SmallVector<Type> ivTypes(numIVs, loopVarType);
- SmallVector<OpAsmParser::OperandType> blockArgs(ivs);
+ SmallVector<OpAsmParser::UnresolvedOperand> blockArgs(ivs);
if (parser.parseRegion(*body, blockArgs, ivTypes))
return failure();
return success();
/// clause ::= TODO
ParseResult SimdLoopOp::parse(OpAsmParser &parser, OperationState &result) {
// Parse an opening `(` followed by induction variables followed by `)`
- SmallVector<OpAsmParser::OperandType> ivs;
+ SmallVector<OpAsmParser::UnresolvedOperand> ivs;
if (parser.parseRegionArgumentList(ivs, /*requiredOperandCount=*/-1,
OpAsmParser::Delimiter::Paren))
return failure();
if (parser.parseColonType(loopVarType))
return failure();
// Parse loop bounds.
- SmallVector<OpAsmParser::OperandType> lower;
+ SmallVector<OpAsmParser::UnresolvedOperand> lower;
if (parser.parseEqual() ||
parser.parseOperandList(lower, numIVs, OpAsmParser::Delimiter::Paren) ||
parser.resolveOperands(lower, loopVarType, result.operands))
return failure();
- SmallVector<OpAsmParser::OperandType> upper;
+ SmallVector<OpAsmParser::UnresolvedOperand> upper;
if (parser.parseKeyword("to") ||
parser.parseOperandList(upper, numIVs, OpAsmParser::Delimiter::Paren) ||
parser.resolveOperands(upper, loopVarType, result.operands))
return failure();
// Parse step values.
- SmallVector<OpAsmParser::OperandType> steps;
+ SmallVector<OpAsmParser::UnresolvedOperand> steps;
if (parser.parseKeyword("step") ||
parser.parseOperandList(steps, numIVs, OpAsmParser::Delimiter::Paren) ||
parser.resolveOperands(steps, loopVarType, result.operands))
// Now parse the body.
Region *body = result.addRegion();
SmallVector<Type> ivTypes(numIVs, loopVarType);
- SmallVector<OpAsmParser::OperandType> blockArgs(ivs);
+ SmallVector<OpAsmParser::UnresolvedOperand> blockArgs(ivs);
if (parser.parseRegion(*body, blockArgs, ivTypes))
return failure();
return success();
//===----------------------------------------------------------------------===//
static ParseResult parseOperationOpAttributes(
- OpAsmParser &p, SmallVectorImpl<OpAsmParser::OperandType> &attrOperands,
+ OpAsmParser &p,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &attrOperands,
ArrayAttr &attrNamesAttr) {
Builder &builder = p.getBuilder();
SmallVector<Attribute, 4> 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();
//===----------------------------------------------------------------------===//
static ParseResult parseCreateOperationOpAttributes(
- OpAsmParser &p, SmallVectorImpl<OpAsmParser::OperandType> &attrOperands,
+ OpAsmParser &p,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &attrOperands,
ArrayAttr &attrNamesAttr) {
Builder &builder = p.getBuilder();
SmallVector<Attribute, 4> 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();
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))
return failure();
// Parse the operand (value range).
- OpAsmParser::OperandType operandInfo;
+ OpAsmParser::UnresolvedOperand operandInfo;
if (parser.parseOperand(operandInfo))
return failure();
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();
return failure();
// Parse the optional initial iteration arguments.
- SmallVector<OpAsmParser::OperandType, 4> regionArgs, operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> regionArgs, operands;
SmallVector<Type, 4> argTypes;
regionArgs.push_back(inductionVariable);
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))
ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) {
auto &builder = parser.getBuilder();
// Parse an opening `(` followed by induction variables followed by `)`
- SmallVector<OpAsmParser::OperandType, 4> ivs;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> ivs;
if (parser.parseRegionArgumentList(ivs, /*requiredOperandCount=*/-1,
OpAsmParser::Delimiter::Paren))
return failure();
// Parse loop bounds.
- SmallVector<OpAsmParser::OperandType, 4> lower;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> lower;
if (parser.parseEqual() ||
parser.parseOperandList(lower, ivs.size(),
OpAsmParser::Delimiter::Paren) ||
parser.resolveOperands(lower, builder.getIndexType(), result.operands))
return failure();
- SmallVector<OpAsmParser::OperandType, 4> upper;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> upper;
if (parser.parseKeyword("to") ||
parser.parseOperandList(upper, ivs.size(),
OpAsmParser::Delimiter::Paren) ||
return failure();
// Parse step values.
- SmallVector<OpAsmParser::OperandType, 4> steps;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> steps;
if (parser.parseKeyword("step") ||
parser.parseOperandList(steps, ivs.size(),
OpAsmParser::Delimiter::Paren) ||
return failure();
// Parse init values.
- SmallVector<OpAsmParser::OperandType, 4> initVals;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> initVals;
if (succeeded(parser.parseOptionalKeyword("init"))) {
if (parser.parseOperandList(initVals, /*requiredOperandCount=*/-1,
OpAsmParser::Delimiter::Paren))
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();
/// assignment-list ::= assignment | assignment `,` assignment-list
/// assignment ::= ssa-value `=` ssa-value
ParseResult scf::WhileOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 4> regionArgs, operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> regionArgs, operands;
Region *before = result.addRegion();
Region *after = result.addRegion();
static ParseResult parseOneResultSameOperandTypeOp(OpAsmParser &parser,
OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 2> ops;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> ops;
Type type;
// If the operand list is in-between parentheses, then we have a generic form.
// (see the fallback in `printOneResultOp`).
OperationState &state, bool hasValue) {
spirv::Scope scope;
spirv::MemorySemantics memoryScope;
- SmallVector<OpAsmParser::OperandType, 2> operandInfo;
- OpAsmParser::OperandType ptrInfo, valueInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> operandInfo;
+ OpAsmParser::UnresolvedOperand ptrInfo, valueInfo;
Type type;
SMLoc loc;
if (parseEnumStrAttr(scope, parser, state, kMemoryScopeAttrName) ||
OperationState &state) {
spirv::Scope executionScope;
spirv::GroupOperation groupOperation;
- OpAsmParser::OperandType valueInfo;
+ OpAsmParser::UnresolvedOperand valueInfo;
if (parseEnumStrAttr(executionScope, parser, state,
kExecutionScopeAttrName) ||
parseEnumStrAttr(groupOperation, parser, state,
parser.parseOperand(valueInfo))
return failure();
- Optional<OpAsmParser::OperandType> clusterSizeInfo;
+ Optional<OpAsmParser::UnresolvedOperand> clusterSizeInfo;
if (succeeded(parser.parseOptionalKeyword(kClusterSize))) {
- clusterSizeInfo = OpAsmParser::OperandType();
+ clusterSizeInfo = OpAsmParser::UnresolvedOperand();
if (parser.parseLParen() || parser.parseOperand(*clusterSizeInfo) ||
parser.parseRParen())
return failure();
ParseResult spirv::AccessChainOp::parse(OpAsmParser &parser,
OperationState &state) {
- OpAsmParser::OperandType ptrInfo;
- SmallVector<OpAsmParser::OperandType, 4> indicesInfo;
+ OpAsmParser::UnresolvedOperand ptrInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> indicesInfo;
Type type;
auto loc = parser.getCurrentLocation();
SmallVector<Type, 4> indicesTypes;
OperationState &state) {
spirv::Scope memoryScope;
spirv::MemorySemantics equalSemantics, unequalSemantics;
- SmallVector<OpAsmParser::OperandType, 3> operandInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 3> operandInfo;
Type type;
if (parseEnumStrAttr(memoryScope, parser, state, kMemoryScopeAttrName) ||
parseEnumStrAttr(equalSemantics, parser, state,
OperationState &state) {
spirv::Scope memoryScope;
spirv::MemorySemantics semantics;
- SmallVector<OpAsmParser::OperandType, 2> operandInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> operandInfo;
Type type;
if (parseEnumStrAttr(memoryScope, parser, state, kMemoryScopeAttrName) ||
parseEnumStrAttr(semantics, parser, state, kSemanticsAttrName) ||
ParseResult spirv::BranchConditionalOp::parse(OpAsmParser &parser,
OperationState &state) {
auto &builder = parser.getBuilder();
- OpAsmParser::OperandType condInfo;
+ OpAsmParser::UnresolvedOperand condInfo;
Block *dest;
// Parse the condition.
ParseResult spirv::CompositeConstructOp::parse(OpAsmParser &parser,
OperationState &state) {
- SmallVector<OpAsmParser::OperandType, 4> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> operands;
Type type;
auto loc = parser.getCurrentLocation();
ParseResult spirv::CompositeExtractOp::parse(OpAsmParser &parser,
OperationState &state) {
- OpAsmParser::OperandType compositeInfo;
+ OpAsmParser::UnresolvedOperand compositeInfo;
Attribute indicesAttr;
Type compositeType;
SMLoc attrLocation;
ParseResult spirv::CompositeInsertOp::parse(OpAsmParser &parser,
OperationState &state) {
- SmallVector<OpAsmParser::OperandType, 2> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> operands;
Type objectType, compositeType;
Attribute indicesAttr;
auto loc = parser.getCurrentLocation();
ParseResult spirv::EntryPointOp::parse(OpAsmParser &parser,
OperationState &state) {
spirv::ExecutionModel execModel;
- SmallVector<OpAsmParser::OperandType, 0> identifiers;
+ SmallVector<OpAsmParser::UnresolvedOperand, 0> identifiers;
SmallVector<Type, 0> idTypes;
SmallVector<Attribute, 4> interfaceVars;
//===----------------------------------------------------------------------===//
ParseResult spirv::FuncOp::parse(OpAsmParser &parser, OperationState &state) {
- SmallVector<OpAsmParser::OperandType> entryArgs;
+ SmallVector<OpAsmParser::UnresolvedOperand> entryArgs;
SmallVector<NamedAttrList> argAttrs;
SmallVector<NamedAttrList> resultAttrs;
SmallVector<Type> argTypes;
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)) {
OperationState &state) {
// Parse the storage class specification
spirv::StorageClass storageClass;
- SmallVector<OpAsmParser::OperandType, 2> operandInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> operandInfo;
auto loc = parser.getCurrentLocation();
Type elementType;
if (parseEnumStrAttr(storageClass, parser) ||
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) ||
ParseResult spirv::StoreOp::parse(OpAsmParser &parser, OperationState &state) {
// Parse the storage class specification
spirv::StorageClass storageClass;
- SmallVector<OpAsmParser::OperandType, 2> operandInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> operandInfo;
auto loc = parser.getCurrentLocation();
Type elementType;
if (parseEnumStrAttr(storageClass, parser) ||
ParseResult spirv::VariableOp::parse(OpAsmParser &parser,
OperationState &state) {
// Parse optional initializer
- Optional<OpAsmParser::OperandType> initInfo;
+ Optional<OpAsmParser::UnresolvedOperand> initInfo;
if (succeeded(parser.parseOptionalKeyword("init"))) {
- initInfo = OpAsmParser::OperandType();
+ initInfo = OpAsmParser::UnresolvedOperand();
if (parser.parseLParen() || parser.parseOperand(*initInfo) ||
parser.parseRParen())
return failure();
ParseResult spirv::CooperativeMatrixLoadNVOp::parse(OpAsmParser &parser,
OperationState &state) {
- SmallVector<OpAsmParser::OperandType, 3> operandInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 3> operandInfo;
Type strideType = parser.getBuilder().getIntegerType(32);
Type columnMajorType = parser.getBuilder().getIntegerType(1);
Type ptrType;
ParseResult spirv::CooperativeMatrixStoreNVOp::parse(OpAsmParser &parser,
OperationState &state) {
- SmallVector<OpAsmParser::OperandType, 4> operandInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> operandInfo;
Type strideType = parser.getBuilder().getIntegerType(32);
Type columnMajorType = parser.getBuilder().getIntegerType(1);
Type ptrType;
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;
static ParseResult parsePtrAccessChainOpImpl(StringRef opName,
OpAsmParser &parser,
OperationState &state) {
- OpAsmParser::OperandType ptrInfo;
- SmallVector<OpAsmParser::OperandType, 4> indicesInfo;
+ OpAsmParser::UnresolvedOperand ptrInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> indicesInfo;
Type type;
auto loc = parser.getCurrentLocation();
SmallVector<Type, 4> indicesTypes;
Region *doRegion = result.addRegion();
auto &builder = parser.getBuilder();
- OpAsmParser::OperandType cond;
+ OpAsmParser::UnresolvedOperand cond;
if (parser.parseOperand(cond) ||
parser.resolveOperand(cond, builder.getType<WitnessType>(),
result.operands))
ParseResult ReduceOp::parse(OpAsmParser &parser, OperationState &result) {
// Parse operands.
- SmallVector<OpAsmParser::OperandType, 3> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 3> operands;
Type shapeOrExtentTensorType;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/-1,
OpAsmParser::Delimiter::Paren) ||
Type typeToInfer, Type typeToInferFrom) {}
ParseResult parseInferType(OpAsmParser &parser,
- Optional<OpAsmParser::OperandType> optOperand,
+ Optional<OpAsmParser::UnresolvedOperand> optOperand,
Type &typeToInfer, Type typeToInferFrom) {
if (optOperand)
typeToInfer = typeToInferFrom;
}
ParseResult ReductionOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 2> operandsInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> operandsInfo;
Type redType;
Type resType;
CombiningKindAttr kindAttr;
}
ParseResult ContractionOp::parse(OpAsmParser &parser, OperationState &result) {
- OpAsmParser::OperandType lhsInfo;
- OpAsmParser::OperandType rhsInfo;
- OpAsmParser::OperandType accInfo;
- SmallVector<OpAsmParser::OperandType, 2> masksInfo;
+ OpAsmParser::UnresolvedOperand lhsInfo;
+ OpAsmParser::UnresolvedOperand rhsInfo;
+ OpAsmParser::UnresolvedOperand accInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> masksInfo;
SmallVector<Type, 2> types;
Type resultType;
auto loc = parser.getCurrentLocation();
}
ParseResult OuterProductOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 3> operandsInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 3> operandsInfo;
Type tLHS, tRHS;
if (parser.parseOperandList(operandsInfo) ||
parser.parseOptionalAttrDict(result.attributes) ||
ParseResult TransferReadOp::parse(OpAsmParser &parser, OperationState &result) {
auto &builder = parser.getBuilder();
SMLoc typesLoc;
- OpAsmParser::OperandType sourceInfo;
- SmallVector<OpAsmParser::OperandType, 8> indexInfo;
- OpAsmParser::OperandType paddingInfo;
+ OpAsmParser::UnresolvedOperand sourceInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> indexInfo;
+ OpAsmParser::UnresolvedOperand paddingInfo;
SmallVector<Type, 2> types;
- OpAsmParser::OperandType maskInfo;
+ OpAsmParser::UnresolvedOperand maskInfo;
// Parsing with support for paddingValue.
if (parser.parseOperand(sourceInfo) ||
parser.parseOperandList(indexInfo, OpAsmParser::Delimiter::Square) ||
OperationState &result) {
auto &builder = parser.getBuilder();
SMLoc typesLoc;
- OpAsmParser::OperandType vectorInfo, sourceInfo;
- SmallVector<OpAsmParser::OperandType, 8> indexInfo;
+ OpAsmParser::UnresolvedOperand vectorInfo, sourceInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 8> indexInfo;
SmallVector<Type, 2> types;
- OpAsmParser::OperandType maskInfo;
+ OpAsmParser::UnresolvedOperand maskInfo;
if (parser.parseOperand(vectorInfo) || parser.parseComma() ||
parser.parseOperand(sourceInfo) ||
parser.parseOperandList(indexInfo, OpAsmParser::Delimiter::Square))
ParseResult mlir::function_interface_impl::parseFunctionArgumentList(
OpAsmParser &parser, bool allowAttributes, bool allowVariadic,
- SmallVectorImpl<OpAsmParser::OperandType> &argNames,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &argNames,
SmallVectorImpl<Type> &argTypes, SmallVectorImpl<NamedAttrList> &argAttrs,
SmallVectorImpl<Location> &argLocations, bool &isVariadic) {
if (parser.parseLParen())
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()) {
ParseResult mlir::function_interface_impl::parseFunctionSignature(
OpAsmParser &parser, bool allowVariadic,
- SmallVectorImpl<OpAsmParser::OperandType> &argNames,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &argNames,
SmallVectorImpl<Type> &argTypes, SmallVectorImpl<NamedAttrList> &argAttrs,
SmallVectorImpl<Location> &argLocations, bool &isVariadic,
SmallVectorImpl<Type> &resultTypes,
ParseResult mlir::function_interface_impl::parseFunctionOp(
OpAsmParser &parser, OperationState &result, bool allowVariadic,
FuncTypeBuilder funcTypeBuilder) {
- SmallVector<OpAsmParser::OperandType> entryArgs;
+ SmallVector<OpAsmParser::UnresolvedOperand> entryArgs;
SmallVector<NamedAttrList> argAttrs;
SmallVector<NamedAttrList> resultAttrs;
SmallVector<Type> argTypes;
}
template <int64_t dynVal>
-static ParseResult
-parseOperandsOrIntegersImpl(OpAsmParser &parser,
- SmallVectorImpl<OpAsmParser::OperandType> &values,
- ArrayAttr &integers) {
+static ParseResult parseOperandsOrIntegersImpl(
+ OpAsmParser &parser,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
+ ArrayAttr &integers) {
if (failed(parser.parseLSquare()))
return failure();
// 0-D.
SmallVector<int64_t, 4> attrVals;
while (true) {
- OpAsmParser::OperandType operand;
+ OpAsmParser::UnresolvedOperand operand;
auto res = parser.parseOptionalOperand(operand);
if (res.hasValue() && succeeded(res.getValue())) {
values.push_back(operand);
}
ParseResult mlir::parseOperandsOrIntegersOffsetsOrStridesList(
- OpAsmParser &parser, SmallVectorImpl<OpAsmParser::OperandType> &values,
+ OpAsmParser &parser,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
ArrayAttr &integers) {
return parseOperandsOrIntegersImpl<ShapedType::kDynamicStrideOrOffset>(
parser, values, integers);
}
ParseResult mlir::parseOperandsOrIntegersSizesList(
- OpAsmParser &parser, SmallVectorImpl<OpAsmParser::OperandType> &values,
+ OpAsmParser &parser,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &values,
ArrayAttr &integers) {
return parseOperandsOrIntegersImpl<ShapedType::kDynamicSize>(parser, values,
integers);
using OpOrArgument = llvm::PointerUnion<Operation *, BlockArgument>;
/// 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))?
///
ParseResult parseGenericOperationAfterOpName(
OperationState &result,
- Optional<ArrayRef<OperandType>> parsedOperandTypes,
+ Optional<ArrayRef<UnresolvedOperand>> parsedUnresolvedOperands,
Optional<ArrayRef<Block *>> parsedSuccessors,
Optional<MutableArrayRef<std::unique_ptr<Region>>> parsedRegions,
Optional<ArrayRef<NamedAttribute>> parsedAttributes,
Optional<FunctionType> 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<OperationParser::SSAUseInfo> 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);
}
//===--------------------------------------------------------------------===//
//===--------------------------------------------------------------------===//
/// Parse a single operand.
- ParseResult parseOperand(OperandType &result) override {
+ ParseResult parseOperand(UnresolvedOperand &result) override {
OperationParser::SSAUseInfo useInfo;
if (parser.parseSSAUse(useInfo))
return failure();
}
/// 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;
/// Parse zero or more SSA comma-separated operand references with a specified
/// surrounding delimiter, and an optional required operand count.
- ParseResult parseOperandList(SmallVectorImpl<OperandType> &result,
+ ParseResult parseOperandList(SmallVectorImpl<UnresolvedOperand> &result,
int requiredOperandCount = -1,
Delimiter delimiter = Delimiter::None) override {
return parseOperandOrRegionArgList(result, /*isOperandList=*/true,
/// Parse zero or more SSA comma-separated operand or region arguments with
/// optional surrounding delimiter and required operand count.
ParseResult
- parseOperandOrRegionArgList(SmallVectorImpl<OperandType> &result,
+ parseOperandOrRegionArgList(SmallVectorImpl<UnresolvedOperand> &result,
bool isOperandList, int requiredOperandCount = -1,
Delimiter delimiter = Delimiter::None) {
auto startLoc = parser.getToken().getLoc();
}
auto parseOneOperand = [&]() -> ParseResult {
- OperandType operandOrArg;
+ UnresolvedOperand operandOrArg;
if (isOperandList ? parseOperand(operandOrArg)
: parseRegionArgument(operandOrArg))
return failure();
/// 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<OperandType> &result,
- int requiredOperandCount,
- Delimiter delimiter) override {
+ ParseResult
+ parseTrailingOperandList(SmallVectorImpl<UnresolvedOperand> &result,
+ int requiredOperandCount,
+ Delimiter delimiter) override {
if (parser.getToken().is(Token::comma)) {
parseComma();
return parseOperandList(result, requiredOperandCount, delimiter);
}
/// 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<Value> &result) override {
OperationParser::SSAUseInfo operandInfo = {operand.name, operand.number,
operand.location};
}
/// Parse an AffineMap of SSA ids.
- ParseResult parseAffineMapOfSSAIds(SmallVectorImpl<OperandType> &operands,
- Attribute &mapAttr, StringRef attrName,
- NamedAttrList &attrs,
- Delimiter delimiter) override {
- SmallVector<OperandType, 2> dimOperands;
- SmallVector<OperandType, 1> symOperands;
+ ParseResult
+ parseAffineMapOfSSAIds(SmallVectorImpl<UnresolvedOperand> &operands,
+ Attribute &mapAttr, StringRef attrName,
+ NamedAttrList &attrs, Delimiter delimiter) override {
+ SmallVector<UnresolvedOperand, 2> dimOperands;
+ SmallVector<UnresolvedOperand, 1> symOperands;
auto parseElement = [&](bool isSymbol) -> ParseResult {
- OperandType operand;
+ UnresolvedOperand operand;
if (parseOperand(operand))
return failure();
if (isSymbol)
/// Parse an AffineExpr of SSA ids.
ParseResult
- parseAffineExprOfSSAIds(SmallVectorImpl<OperandType> &dimOperands,
- SmallVectorImpl<OperandType> &symbOperands,
+ parseAffineExprOfSSAIds(SmallVectorImpl<UnresolvedOperand> &dimOperands,
+ SmallVectorImpl<UnresolvedOperand> &symbOperands,
AffineExpr &expr) override {
auto parseElement = [&](bool isSymbol) -> ParseResult {
- OperandType operand;
+ UnresolvedOperand operand;
if (parseOperand(operand))
return failure();
if (isSymbol)
/// 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<OperandType> arguments,
+ ParseResult parseRegion(Region ®ion, ArrayRef<UnresolvedOperand> arguments,
ArrayRef<Type> argTypes,
ArrayRef<Location> argLocations,
bool enableNameShadowing) override {
SmallVector<std::pair<OperationParser::SSAUseInfo, Type>, 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};
/// Parses a region if present.
OptionalParseResult parseOptionalRegion(Region ®ion,
- ArrayRef<OperandType> arguments,
+ ArrayRef<UnresolvedOperand> arguments,
ArrayRef<Type> argTypes,
ArrayRef<Location> argLocations,
bool enableNameShadowing) override {
/// 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<Region> ®ion,
- ArrayRef<OperandType> arguments, ArrayRef<Type> argTypes,
- bool enableNameShadowing = false) override {
+ OptionalParseResult parseOptionalRegion(
+ std::unique_ptr<Region> ®ion, ArrayRef<UnresolvedOperand> arguments,
+ ArrayRef<Type> argTypes, bool enableNameShadowing = false) override {
if (parser.getToken().isNot(Token::l_brace))
return llvm::None;
std::unique_ptr<Region> newRegion = std::make_unique<Region>();
/// 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<OperandType> &result,
+ parseRegionArgumentList(SmallVectorImpl<UnresolvedOperand> &result,
int requiredOperandCount = -1,
Delimiter delimiter = Delimiter::None) override {
return parseOperandOrRegionArgList(result, /*isOperandList=*/false,
/// Parse a list of assignments of the form
/// (%x1 = %y1, %x2 = %y2, ...).
- OptionalParseResult
- parseOptionalAssignmentList(SmallVectorImpl<OperandType> &lhs,
- SmallVectorImpl<OperandType> &rhs) override {
+ OptionalParseResult parseOptionalAssignmentList(
+ SmallVectorImpl<UnresolvedOperand> &lhs,
+ SmallVectorImpl<UnresolvedOperand> &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();
/// Parse a list of assignments of the form
/// (%x1 = %y1 : type1, %x2 = %y2 : type2, ...).
OptionalParseResult
- parseOptionalAssignmentListWithTypes(SmallVectorImpl<OperandType> &lhs,
- SmallVectorImpl<OperandType> &rhs,
+ parseOptionalAssignmentListWithTypes(SmallVectorImpl<UnresolvedOperand> &lhs,
+ SmallVectorImpl<UnresolvedOperand> &rhs,
SmallVectorImpl<Type> &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))
//===----------------------------------------------------------------------===//
// Parsing
-static ParseResult
-parseCustomOptionalOperand(OpAsmParser &parser,
- Optional<OpAsmParser::OperandType> &optOperand) {
+static ParseResult parseCustomOptionalOperand(
+ OpAsmParser &parser, Optional<OpAsmParser::UnresolvedOperand> &optOperand) {
if (succeeded(parser.parseOptionalLParen())) {
optOperand.emplace();
if (parser.parseOperand(*optOperand) || parser.parseRParen())
}
static ParseResult parseCustomDirectiveOperands(
- OpAsmParser &parser, OpAsmParser::OperandType &operand,
- Optional<OpAsmParser::OperandType> &optOperand,
- SmallVectorImpl<OpAsmParser::OperandType> &varOperands) {
+ OpAsmParser &parser, OpAsmParser::UnresolvedOperand &operand,
+ Optional<OpAsmParser::UnresolvedOperand> &optOperand,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &varOperands) {
if (parser.parseOperand(operand))
return failure();
if (succeeded(parser.parseOptionalComma())) {
return success();
}
static ParseResult parseCustomDirectiveOperandsAndTypes(
- OpAsmParser &parser, OpAsmParser::OperandType &operand,
- Optional<OpAsmParser::OperandType> &optOperand,
- SmallVectorImpl<OpAsmParser::OperandType> &varOperands, Type &operandType,
- Type &optOperandType, SmallVectorImpl<Type> &varOperandTypes) {
+ OpAsmParser &parser, OpAsmParser::UnresolvedOperand &operand,
+ Optional<OpAsmParser::UnresolvedOperand> &optOperand,
+ SmallVectorImpl<OpAsmParser::UnresolvedOperand> &varOperands,
+ Type &operandType, Type &optOperandType,
+ SmallVectorImpl<Type> &varOperandTypes) {
if (parseCustomDirectiveOperands(parser, operand, optOperand, varOperands) ||
parseCustomDirectiveResults(parser, operandType, optOperandType,
varOperandTypes))
return parser.parseOptionalAttrDict(attrs);
}
static ParseResult parseCustomDirectiveOptionalOperandRef(
- OpAsmParser &parser, Optional<OpAsmParser::OperandType> &optOperand) {
+ OpAsmParser &parser, Optional<OpAsmParser::UnresolvedOperand> &optOperand) {
int64_t operandCount = 0;
if (parser.parseInteger(operandCount))
return failure();
ParseResult IsolatedRegionOp::parse(OpAsmParser &parser,
OperationState &result) {
- OpAsmParser::OperandType argInfo;
+ OpAsmParser::UnresolvedOperand argInfo;
Type argType = parser.getBuilder().getIndexType();
// Parse the input operand.
Location currLocation = parser.getEncodedSourceLoc(loc);
// Parse the operands.
- SmallVector<OpAsmParser::OperandType, 2> operands;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> operands;
if (parser.parseOperandList(operands))
return failure();
//===----------------------------------------------------------------------===//
ParseResult PolyForOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 4> ivsInfo;
+ SmallVector<OpAsmParser::UnresolvedOperand, 4> ivsInfo;
// Parse list of region arguments without a delimiter.
if (parser.parseRegionArgumentList(ivsInfo))
return failure();
}
ParseResult RegionIfOp::parse(OpAsmParser &parser, OperationState &result) {
- SmallVector<OpAsmParser::OperandType, 2> operandInfos;
+ SmallVector<OpAsmParser::UnresolvedOperand, 2> operandInfos;
SmallVector<Type, 2> operandTypes;
result.regions.reserve(3);
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()) {
genElementParserStorage(paramElement, op, body);
} else if (isa<OperandsDirective>(element)) {
- body << " ::mlir::SmallVector<::mlir::OpAsmParser::OperandType, 4> "
+ body << " ::mlir::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> "
"allOperands;\n";
} else if (isa<RegionsDirective>(element)) {
} else if (auto *operand = dyn_cast<OperandVariable>(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<int32_t> " << 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",
<< "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);
}
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<TypeDirective>(input)) {
// 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<const ::mlir::OpAsmParser::OperandType>(";
+ body << "::llvm::concat<const ::mlir::OpAsmParser::UnresolvedOperand>(";
llvm::interleaveComma(op.getOperands(), body, [&](auto &operand) {
body << operand.name << "Operands";
});