MLIR 22.0.0git
mlir::AsmParser Class Referenceabstract

This base class exposes generic asm parser hooks, usable across the various derived parsers. More...

#include "mlir/IR/OpImplementation.h"

Inheritance diagram for mlir::AsmParser:

Classes

class  CyclicParseReset
 Class used to automatically end a cyclic region on destruction. More...
class  KeywordSwitch
 This class represents a StringSwitch like class that is useful for parsing expected keywords. More...

Public Types

enum class  Delimiter {
  None , Paren , Square , LessGreater ,
  Braces , OptionalParen , OptionalSquare , OptionalLessGreater ,
  OptionalBraces
}
 These are the supported delimiters around operand lists and region argument lists, used by parseOperandList. More...
template<typename AttrType>
using has_parse_method
 Trait to check if AttrType provides a parse method.
template<typename AttrType>
using detect_has_parse_method = llvm::is_detected<has_parse_method, AttrType>
template<typename TypeT>
using type_has_parse_method
 Trait to check if TypeT provides a parse method.
template<typename TypeT>
using detect_type_has_parse_method

Public Member Functions

 AsmParser ()=default
virtual ~AsmParser ()
MLIRContextgetContext () const
virtual SMLoc getNameLoc () const =0
 Return the location of the original name token.
virtual InFlightDiagnostic emitError (SMLoc loc, const Twine &message={})=0
 Emit a diagnostic at the specified location and return failure.
virtual BuildergetBuilder () const =0
 Return a builder which provides useful access to MLIRContext, global objects like types and attributes.
virtual SMLoc getCurrentLocation ()=0
 Get the location of the next token and store it into the argument.
ParseResult getCurrentLocation (SMLoc *loc)
virtual Location getEncodedSourceLoc (SMLoc loc)=0
 Re-encode the given source location as an MLIR location and return it.
virtual ParseResult parseArrow ()=0
 Parse a '->' token.
virtual ParseResult parseOptionalArrow ()=0
 Parse a '->' token if present.
virtual ParseResult parseLBrace ()=0
 Parse a { token.
virtual ParseResult parseOptionalLBrace ()=0
 Parse a { token if present.
virtual ParseResult parseRBrace ()=0
 Parse a } token.
virtual ParseResult parseOptionalRBrace ()=0
 Parse a } token if present.
virtual ParseResult parseColon ()=0
 Parse a : token.
virtual ParseResult parseOptionalColon ()=0
 Parse a : token if present.
virtual ParseResult parseComma ()=0
 Parse a , token.
virtual ParseResult parseOptionalComma ()=0
 Parse a , token if present.
virtual ParseResult parseEqual ()=0
 Parse a = token.
virtual ParseResult parseOptionalEqual ()=0
 Parse a = token if present.
virtual ParseResult parseLess ()=0
 Parse a '<' token.
virtual ParseResult parseOptionalLess ()=0
 Parse a '<' token if present.
virtual ParseResult parseGreater ()=0
 Parse a '>' token.
virtual ParseResult parseOptionalGreater ()=0
 Parse a '>' token if present.
virtual ParseResult parseQuestion ()=0
 Parse a '?' token.
virtual ParseResult parseOptionalQuestion ()=0
 Parse a '?' token if present.
virtual ParseResult parsePlus ()=0
 Parse a '+' token.
virtual ParseResult parseOptionalPlus ()=0
 Parse a '+' token if present.
virtual ParseResult parseSlash ()=0
 Parse a '/' token.
virtual ParseResult parseOptionalSlash ()=0
 Parse a '/' token if present.
virtual ParseResult parseMinus ()=0
 Parse a '-' token.
virtual ParseResult parseOptionalMinus ()=0
 Parse a '-' token if present.
virtual ParseResult parseStar ()=0
 Parse a '*' token.
virtual ParseResult parseOptionalStar ()=0
 Parse a '*' token if present.
virtual ParseResult parseVerticalBar ()=0
 Parse a '|' token.
virtual ParseResult parseOptionalVerticalBar ()=0
 Parse a '|' token if present.
ParseResult parseString (std::string *string)
 Parse a quoted string token.
virtual ParseResult parseOptionalString (std::string *string)=0
 Parse a quoted string token if present.
virtual ParseResult parseBase64Bytes (std::vector< char > *bytes)=0
 Parses a Base64 encoded string of bytes.
virtual ParseResult parseLParen ()=0
 Parse a ( token.
virtual ParseResult parseOptionalLParen ()=0
 Parse a ( token if present.
virtual ParseResult parseRParen ()=0
 Parse a ) token.
virtual ParseResult parseOptionalRParen ()=0
 Parse a ) token if present.
virtual ParseResult parseLSquare ()=0
 Parse a [ token.
virtual ParseResult parseOptionalLSquare ()=0
 Parse a [ token if present.
virtual ParseResult parseRSquare ()=0
 Parse a ] token.
virtual ParseResult parseOptionalRSquare ()=0
 Parse a ] token if present.
virtual ParseResult parseEllipsis ()=0
 Parse a ... token.
virtual ParseResult parseOptionalEllipsis ()=0
 Parse a ... token if present;.
virtual ParseResult parseFloat (double &result)=0
 Parse a floating point value from the stream.
virtual ParseResult parseFloat (const llvm::fltSemantics &semantics, APFloat &result)=0
 Parse a floating point value into APFloat from the stream.
template<typename IntT>
ParseResult parseInteger (IntT &result)
 Parse an integer value from the stream.
template<typename IntT>
ParseResult parseDecimalInteger (IntT &result)
 Parse a decimal integer value from the stream.
virtual OptionalParseResult parseOptionalInteger (APInt &result)=0
 Parse an optional integer value from the stream.
virtual OptionalParseResult parseOptionalDecimalInteger (APInt &result)=0
template<typename IntT>
OptionalParseResult parseOptionalInteger (IntT &result)
template<typename IntT>
OptionalParseResult parseOptionalDecimalInteger (IntT &result)
virtual ParseResult parseCommaSeparatedList (Delimiter delimiter, function_ref< ParseResult()> parseElementFn, StringRef contextMessage=StringRef())=0
 Parse a list of comma-separated items with an optional delimiter.
ParseResult parseCommaSeparatedList (function_ref< ParseResult()> parseElementFn)
 Parse a comma separated list of elements that must have at least one entry in it.
ParseResult parseKeyword (StringRef keyword)
 Parse a given keyword.
virtual ParseResult parseKeyword (StringRef keyword, const Twine &msg)=0
ParseResult parseKeyword (StringRef *keyword)
 Parse a keyword into 'keyword'.
virtual ParseResult parseOptionalKeyword (StringRef keyword)=0
 Parse the given keyword if present.
virtual ParseResult parseOptionalKeyword (StringRef *keyword)=0
 Parse a keyword, if present, into 'keyword'.
virtual ParseResult parseOptionalKeyword (StringRef *keyword, ArrayRef< StringRef > allowedValues)=0
 Parse a keyword, if present, and if one of the 'allowedValues', into 'keyword'.
ParseResult parseKeywordOrString (std::string *result)
 Parse a keyword or a quoted string.
virtual ParseResult parseOptionalKeywordOrString (std::string *result)=0
 Parse an optional keyword or string.
template<typename T, typename... ParamsT>
auto getChecked (SMLoc loc, ParamsT &&...params)
 Invoke the getChecked method of the given Attribute or Type class, using the provided location to emit errors in the case of failure.
template<typename T, typename... ParamsT>
auto getChecked (ParamsT &&...params)
 A variant of getChecked that uses the result of getNameLoc to emit errors.
virtual ParseResult parseAttribute (Attribute &result, Type type={})=0
 Parse an arbitrary attribute of a given type and return it in result.
virtual ParseResult parseCustomAttributeWithFallback (Attribute &result, Type type, function_ref< ParseResult(Attribute &result, Type type)> parseAttribute)=0
 Parse a custom attribute with the provided callback, unless the next token is #, in which case the generic parser is invoked.
template<typename AttrType>
ParseResult parseAttribute (AttrType &result, Type type={})
 Parse an attribute of a specific kind and type.
ParseResult parseAttribute (Attribute &result, StringRef attrName, NamedAttrList &attrs)
 Parse an arbitrary attribute and return it in result.
template<typename AttrType>
ParseResult parseAttribute (AttrType &result, StringRef attrName, NamedAttrList &attrs)
 Parse an attribute of a specific kind and type.
template<typename AttrType>
ParseResult parseAttribute (AttrType &result, Type type, StringRef attrName, NamedAttrList &attrs)
 Parse an arbitrary attribute of a given type and populate it in result.
template<typename AttrType>
std::enable_if_t< detect_has_parse_method< AttrType >::value, ParseResult > parseCustomAttributeWithFallback (AttrType &result, Type type, StringRef attrName, NamedAttrList &attrs)
 Parse a custom attribute of a given type unless the next token is #, in which case the generic parser is invoked.
template<typename AttrType>
std::enable_if_t<!detect_has_parse_method< AttrType >::value, ParseResult > parseCustomAttributeWithFallback (AttrType &result, Type type, StringRef attrName, NamedAttrList &attrs)
 SFINAE parsing method for Attribute that don't implement a parse method.
template<typename AttrType>
std::enable_if_t< detect_has_parse_method< AttrType >::value, ParseResult > parseCustomAttributeWithFallback (AttrType &result, Type type={})
 Parse a custom attribute of a given type unless the next token is #, in which case the generic parser is invoked.
template<typename AttrType>
std::enable_if_t<!detect_has_parse_method< AttrType >::value, ParseResult > parseCustomAttributeWithFallback (AttrType &result, Type type={})
 SFINAE parsing method for Attribute that don't implement a parse method.
virtual OptionalParseResult parseOptionalAttribute (Attribute &result, Type type={})=0
 Parse an arbitrary optional attribute of a given type and return it in result.
virtual OptionalParseResult parseOptionalAttribute (ArrayAttr &result, Type type={})=0
 Parse an optional array attribute and return it in result.
virtual OptionalParseResult parseOptionalAttribute (StringAttr &result, Type type={})=0
 Parse an optional string attribute and return it in result.
virtual OptionalParseResult parseOptionalAttribute (SymbolRefAttr &result, Type type={})=0
 Parse an optional symbol ref attribute and return it in result.
template<typename AttrType>
OptionalParseResult parseOptionalAttribute (AttrType &result, StringRef attrName, NamedAttrList &attrs)
 Parse an optional attribute of a specific type and add it to the list with the specified name.
template<typename AttrType>
OptionalParseResult parseOptionalAttribute (AttrType &result, Type type, StringRef attrName, NamedAttrList &attrs)
 Parse an optional attribute of a specific type and add it to the list with the specified name.
virtual ParseResult parseOptionalAttrDict (NamedAttrList &result)=0
 Parse a named dictionary into 'result' if it is present.
virtual ParseResult parseOptionalAttrDictWithKeyword (NamedAttrList &result)=0
 Parse a named dictionary into 'result' if the attributes keyword is present.
virtual ParseResult parseAffineMap (AffineMap &map)=0
 Parse an affine map instance into 'map'.
virtual ParseResult parseAffineExpr (ArrayRef< std::pair< StringRef, AffineExpr > > symbolSet, AffineExpr &expr)=0
 Parse an affine expr instance into 'expr' using the already computed mapping from symbols to affine expressions in 'symbolSet'.
virtual ParseResult parseIntegerSet (IntegerSet &set)=0
 Parse an integer set instance into 'set'.
ParseResult parseSymbolName (StringAttr &result)
 Parse an -identifier and store it (without the '@' symbol) in a string attribute.
ParseResult parseSymbolName (StringAttr &result, StringRef attrName, NamedAttrList &attrs)
 Parse an -identifier and store it (without the '@' symbol) in a string attribute named 'attrName'.
virtual ParseResult parseOptionalSymbolName (StringAttr &result)=0
 Parse an optional -identifier and store it (without the '@' symbol) in a string attribute.
ParseResult parseOptionalSymbolName (StringAttr &result, StringRef attrName, NamedAttrList &attrs)
 Parse an optional -identifier and store it (without the '@' symbol) in a string attribute named 'attrName'.
template<typename ResourceT>
FailureOr< ResourceT > parseResourceHandle ()
 Parse a handle to a resource within the assembly format.
virtual ParseResult parseType (Type &result)=0
 Parse a type.
virtual ParseResult parseCustomTypeWithFallback (Type &result, function_ref< ParseResult(Type &result)> parseType)=0
 Parse a custom type with the provided callback, unless the next token is #, in which case the generic parser is invoked.
virtual OptionalParseResult parseOptionalType (Type &result)=0
 Parse an optional type.
template<typename TypeT>
ParseResult parseType (TypeT &result)
 Parse a type of a specific type.
template<typename TypeT>
std::enable_if_t< detect_type_has_parse_method< TypeT >::value, ParseResult > parseCustomTypeWithFallback (TypeT &result)
 Parse a custom Type of a given type unless the next token is #, in which case the generic parser is invoked.
template<typename TypeT>
std::enable_if_t<!detect_type_has_parse_method< TypeT >::value, ParseResult > parseCustomTypeWithFallback (TypeT &result)
 SFINAE parsing method for Type that don't implement a parse method.
ParseResult parseTypeList (SmallVectorImpl< Type > &result)
 Parse a type list.
virtual ParseResult parseArrowTypeList (SmallVectorImpl< Type > &result)=0
 Parse an arrow followed by a type list.
virtual ParseResult parseOptionalArrowTypeList (SmallVectorImpl< Type > &result)=0
 Parse an optional arrow followed by a type list.
virtual ParseResult parseColonType (Type &result)=0
 Parse a colon followed by a type.
template<typename TypeType>
ParseResult parseColonType (TypeType &result)
 Parse a colon followed by a type of a specific kind, e.g. a FunctionType.
virtual ParseResult parseColonTypeList (SmallVectorImpl< Type > &result)=0
 Parse a colon followed by a type list, which must have at least one type.
virtual ParseResult parseOptionalColonTypeList (SmallVectorImpl< Type > &result)=0
 Parse an optional colon followed by a type list, which if present must have at least one type.
ParseResult parseKeywordType (const char *keyword, Type &result)
 Parse a keyword followed by a type.
ParseResult addTypeToList (Type type, SmallVectorImpl< Type > &result)
 Add the specified type to the end of the specified type list and return success.
ParseResult addTypesToList (ArrayRef< Type > types, SmallVectorImpl< Type > &result)
 Add the specified types to the end of the specified type list and return success.
virtual ParseResult parseDimensionList (SmallVectorImpl< int64_t > &dimensions, bool allowDynamic=true, bool withTrailingX=true)=0
 Parse a dimension list of a tensor or memref type.
virtual ParseResult parseXInDimensionList ()=0
 Parse an 'x' token in a dimension list, handling the case where the x is juxtaposed with an element type, as in "xf32", leaving the "f32" as the next token.
template<class AttrOrTypeT>
FailureOr< CyclicParseResettryStartCyclicParse (AttrOrTypeT attrOrType)
 Attempts to start a cyclic parsing region for attrOrType.

Protected Member Functions

virtual FailureOr< AsmDialectResourceHandleparseResourceHandle (Dialect *dialect)=0
 Parse a handle to a resource within the assembly format for the given dialect.
virtual LogicalResult pushCyclicParsing (const void *opaquePointer)=0
 Pushes a new attribute or type in the form of a type erased pointer into an internal set.
virtual void popCyclicParsing ()=0
 Removes the element that was last inserted with a successful call to pushCyclicParsing.
virtual ParseResult parseKeywordOrCompletion (StringRef *keyword)=0
 Parse a keyword, or an empty string if the current location signals a code completion.
virtual void codeCompleteExpectedTokens (ArrayRef< StringRef > tokens)=0
 Signal the code completion of a set of expected tokens.

Detailed Description

This base class exposes generic asm parser hooks, usable across the various derived parsers.

Definition at line 576 of file OpImplementation.h.

Member Typedef Documentation

◆ detect_has_parse_method

template<typename AttrType>
using mlir::AsmParser::detect_has_parse_method = llvm::is_detected<has_parse_method, AttrType>

Definition at line 1055 of file OpImplementation.h.

◆ detect_type_has_parse_method

template<typename TypeT>
using mlir::AsmParser::detect_type_has_parse_method
Initial value:
llvm::is_detected<type_has_parse_method, TypeT>

Definition at line 1292 of file OpImplementation.h.

◆ has_parse_method

template<typename AttrType>
using mlir::AsmParser::has_parse_method
Initial value:
decltype(AttrType::parse(std::declval<AsmParser &>(),
std::declval<Type>()))

Trait to check if AttrType provides a parse method.

Definition at line 1052 of file OpImplementation.h.

◆ type_has_parse_method

template<typename TypeT>
using mlir::AsmParser::type_has_parse_method
Initial value:
decltype(TypeT::parse(std::declval<AsmParser &>()))

Trait to check if TypeT provides a parse method.

Definition at line 1289 of file OpImplementation.h.

Member Enumeration Documentation

◆ Delimiter

enum class mlir::AsmParser::Delimiter
strong

These are the supported delimiters around operand lists and region argument lists, used by parseOperandList.

Enumerator
None 

Zero or more operands with no delimiters.

Paren 

Parens surrounding zero or more operands.

Square 

Square brackets surrounding zero or more operands.

LessGreater 

<> brackets surrounding zero or more operands.

Braces 

{} brackets surrounding zero or more operands.

OptionalParen 

Parens supporting zero or more operands, or nothing.

OptionalSquare 

Square brackets supporting zero or more ops, or nothing.

OptionalLessGreater 

<> brackets supporting zero or more ops, or nothing.

OptionalBraces 

{} brackets surrounding zero or more operands, or nothing.

Definition at line 812 of file OpImplementation.h.

Constructor & Destructor Documentation

◆ AsmParser()

◆ ~AsmParser()

AsmParser::~AsmParser ( )
virtualdefault

Member Function Documentation

◆ addTypesToList()

ParseResult mlir::AsmParser::addTypesToList ( ArrayRef< Type > types,
SmallVectorImpl< Type > & result )
inline

Add the specified types to the end of the specified type list and return success.

This is a helper designed to allow parse methods to be simple and chain through || operators.

Definition at line 1390 of file OpImplementation.h.

References result, and success().

◆ addTypeToList()

ParseResult mlir::AsmParser::addTypeToList ( Type type,
SmallVectorImpl< Type > & result )
inline

Add the specified type to the end of the specified type list and return success.

This is a helper designed to allow parse methods to be simple and chain through || operators.

Definition at line 1382 of file OpImplementation.h.

References result, and success().

Referenced by parseAffineMinMaxOp(), parseOneResultSameOperandTypeOp(), and parseTargetAllocMemOp().

◆ codeCompleteExpectedTokens()

virtual void mlir::AsmParser::codeCompleteExpectedTokens ( ArrayRef< StringRef > tokens)
protectedpure virtual

Signal the code completion of a set of expected tokens.

References AsmParser().

◆ emitError()

virtual InFlightDiagnostic mlir::AsmParser::emitError ( SMLoc loc,
const Twine & message = {} )
pure virtual

Emit a diagnostic at the specified location and return failure.

Referenced by buildLLVMFunctionType(), dispatchParse(), mlir::sparse_tensor::ir_detail::VarEnv::emitErrorIfAnyUnbound(), mlir::DynamicOpDefinition::get(), getChecked(), getChecked(), getElementType(), mlir::affine::AffineDmaStartOp::parse(), mlir::affine::AffineDmaWaitOp::parse(), mlir::OpState::parse(), parseAllReduceOperation(), parseAlternativesOpSelectedRegion(), parseAndVerify(), parseAndVerifyMatrixType(), parseAndVerifySampledImageType(), parseAndVerifyType(), parseAngleBracketedEntries(), parseApplyRegisteredPassOptions(), parseArithmeticExtendedBinaryOp(), parseArrayType(), mlir::OpAsmParser::parseAssignmentList(), parseAsyncDependencies(), parseAttribute(), mlir::Dialect::parseAttribute(), mlir::DynamicDialect::parseAttribute(), parseBlockArgRegion(), parseBound(), parseCallTypeAndResolveOperands(), parseClauseAttr(), parseCmpOp(), parseColonType(), parseCombinedConstructsLoop(), parseContinuousTileSizeTypes(), parseCooperativeMatrixType(), parseCustomAttributeWithFallback(), parseCustomTypeWithFallback(), parseDecimalInteger(), mlir::parseDimensionList(), mlir::parseDynamicIndexList(), parseEmitCFieldOpTypeAndInitialValue(), parseEmitCGlobalOpTypeAndInitialValue(), mlir::spirv::parseEnumStrAttr(), parseExpressedTypeAndRange(), parseExpressionArg(), parseExtTypeParams(), parseFunctionArgumentList(), mlir::function_interface_impl::parseFunctionOp(), parseGangClause(), parseGlobalMemrefOpTypeAndInitialValue(), parseGranularityClause(), mlir::linalg::parseIndexingMapsAttr(), parseInsertExtractValueElementType(), parseInteger(), parseInterfaceVarABIAttr(), parseKeyValuePair(), parseKeyword(), parseKeywordOrString(), parseLevelRange(), mlir::sparse_tensor::ir_detail::LvlTypeParser::parseLvlType(), parseMatrixType(), mlir::amdgpu::parseMNKDimensionList(), parseMultitileSizesTypes(), parseNamedStructuredOpRegion(), parseOneOpBundle(), parseOneResultSameOperandTypeOp(), parseOptionalArrayStride(), parseOptionalDecimalInteger(), parseOptionalDefinedList(), parseOptionalDynamicIndexList(), parseOptionalStaticSlice(), parseOrderClause(), parsePDLType(), parsePointerType(), parseQuantParamListUntilRBrace(), parseQuantParams(), parseResourceHandle(), parseScheduleClause(), parseSequenceOpOperands(), parseShuffleType(), parseSparseCoIterateLoop(), parseSparseIterateLoop(), parseStorageRange(), parseStorageType(), parseString(), parseStructMemberDecorations(), parseStructType(), parseSymbolName(), parseSymbolVisibility(), parseSynchronizationHint(), parseTargetAllocMemOp(), parseTargetEnvAttr(), parseTensorArmType(), parseType(), mlir::Dialect::parseType(), mlir::DynamicDialect::parseType(), mlir::LLVM::detail::parseType(), mlir::tosa::parseVariableOpTypeOrInitialValue(), parseVerCapExtAttr(), resolveOpBundleOperands(), mlir::OpAsmParser::resolveOperands(), trySetStructBody(), and verifyScheduleModifiers().

◆ getBuilder()

virtual Builder & mlir::AsmParser::getBuilder ( ) const
pure virtual

Return a builder which provides useful access to MLIRContext, global objects like types and attributes.

Referenced by buildLLVMFunctionType(), getContext(), mlir::affine::AffineDmaStartOp::parse(), mlir::affine::AffineDmaWaitOp::parse(), parseAffineMinMaxOp(), parseAlternativesOpSelectedRegion(), parseAsyncDependencies(), parseAttributesOp(), parseAttributions(), parseBound(), parseCmpOp(), parseCommonGlobalAndAlias(), parseCommonStructuredOpParts(), mlir::spirv::parseControlAttribute(), parseCreateOperationOpAttributes(), parseCreateOperationOpResults(), mlir::affine::parseDimAndSymbolList(), mlir::parseDynamicIndexList(), mlir::spirv::parseEnumKeywordAttr(), mlir::spirv::parseEnumStrAttr(), mlir::spirv::parseEnumStrAttr(), parseForeachMatchSymbols(), mlir::function_interface_impl::parseFunctionOp(), parseInterfaceVarABIAttr(), parseLevelRange(), mlir::spirv::parseMemoryAccessAttributes(), mlir::amdgpu::parseMNKDimensionList(), parseNamedValueListImpl(), parseOffloadingHandler(), parseOperationOpAttributes(), parseOptionalDynamicIndexList(), mlir::impl::parseOptionalVisibilityKeyword(), mlir::transform::parsePackedOrDynamicIndexList(), parseResultsValueType(), parseScheduleClause(), mlir::spirv::parseSourceMemoryAccessAttributes(), parseStorageType(), parseSwitchCases(), parseSwitchCases(), parseSymbolVisibility(), parseSynchronizationHint(), parseTargetAllocMemOp(), mlir::transform::parseTransformMatchDims(), parseUsedCoordList(), parseValueWithVariadicity(), mlir::spirv::parseVariableDecorations(), and parseVerCapExtAttr().

◆ getChecked() [1/2]

template<typename T, typename... ParamsT>
auto mlir::AsmParser::getChecked ( ParamsT &&... params)
inline

A variant of getChecked that uses the result of getNameLoc to emit errors.

Definition at line 978 of file OpImplementation.h.

References emitError(), and getNameLoc().

◆ getChecked() [2/2]

template<typename T, typename... ParamsT>
auto mlir::AsmParser::getChecked ( SMLoc loc,
ParamsT &&... params )
inline

Invoke the getChecked method of the given Attribute or Type class, using the provided location to emit errors in the case of failure.

Note that unlike OpBuilder::getType, this method does not implicitly insert a context parameter.

Definition at line 971 of file OpImplementation.h.

References emitError().

Referenced by mlir::DynamicAttr::parse(), mlir::DynamicType::parse(), parseAnyType(), parseCalibratedType(), and parseUniformType().

◆ getContext()

MLIRContext * AsmParser::getContext ( ) const

Definition at line 72 of file AsmPrinter.cpp.

References getBuilder(), and mlir::Builder::getContext().

Referenced by addBodyWithPayloadOp(), dispatchParse(), mlir::detail::DenseArrayAttrImpl< T >::parse(), mlir::FieldParser< AttributeT, std::enable_if_t< std::is_base_of< Attribute, AttributeT >::value, AttributeT > >::parse(), mlir::FieldParser< std::optional< AttributeT >, std::enable_if_t< std::is_base_of< Attribute, AttributeT >::value, std::optional< AttributeT > > >::parse(), parseAllReduceOperation(), parseAngleBracketedEntries(), parseApplyRegisteredPassOptions(), parseCaptureType(), parseClauseAttr(), parseClauseWithRegionArgs(), parseCombinedConstructsLoop(), parseCommonGlobalAndAlias(), parseCommonStructuredOpParts(), parseCopyprivate(), parseDependVarList(), parseDeviceTypeArrayAttr(), parseDeviceTypeOperandsWithKeywordOnly(), parseDeviceTypeOperandsWithSegment(), mlir::parseDimensionList(), parseFunctionArgumentList(), parseGangClause(), parseGEPIndices(), parseGlobalMemrefOpTypeAndInitialValue(), parseGranularityClause(), mlir::spirv::parseImageOperands(), parseKeyValuePair(), parseLaunchDimType(), parseLLVMLinkage(), parseNamedStructuredOpRegion(), parseNumGangs(), parseOneOpBundle(), parseOpBundles(), parseOperandsWithKeywordOnly(), parseOperandWithKeywordOnly(), parseOrderClause(), parseResourceHandle(), parseRoutineGangClause(), parseSameOperandTypeVariadicToBoolOp(), parseScheduleClause(), parseSymOperandList(), parseTypeAndAttrList(), parseWaitClause(), mlir::detail::DenseArrayAttrImpl< T >::parseWithoutBraces(), and resolveOpBundleOperands().

◆ getCurrentLocation() [1/2]

virtual SMLoc mlir::AsmParser::getCurrentLocation ( )
pure virtual

Get the location of the next token and store it into the argument.

This always succeeds.

Referenced by dispatchParse(), mlir::DynamicOpDefinition::get(), getCurrentLocation(), mlir::AsmParser::KeywordSwitch< ResultT >::KeywordSwitch(), parseAllReduceOperation(), parseAlternativesOpSelectedRegion(), parseAndVerify(), parseAndVerifyMatrixType(), parseAndVerifySampledImageType(), parseAndVerifyType(), parseApplyRegisteredPassOptions(), parseArithmeticExtendedBinaryOp(), parseArrayType(), mlir::OpAsmParser::parseAssignmentList(), parseAsyncDependencies(), parseAttribute(), mlir::DynamicDialect::parseAttribute(), parseBlockArgRegion(), parseBound(), parseCallTypeAndResolveOperands(), parseClauseAttr(), parseCmpOp(), parseColonType(), parseCombinedConstructsLoop(), parseCommonStructuredOpParts(), parseContinuousTileSizeTypes(), parseCooperativeMatrixType(), parseCustomAttributeWithFallback(), parseCustomTypeWithFallback(), parseDecimalInteger(), mlir::parseDimensionList(), mlir::spirv::parseEnumStrAttr(), parseExpressedTypeAndRange(), parseExpressionArg(), parseExtTypeParams(), parseFunctionArgumentList(), mlir::function_interface_impl::parseFunctionOp(), parseGangClause(), parseGranularityClause(), mlir::linalg::parseIndexingMapsAttr(), parseInsertExtractValueElementType(), parseInteger(), parseInterfaceVarABIAttr(), parseKeyValuePair(), parseKeyword(), parseKeywordOrString(), mlir::sparse_tensor::ir_detail::LvlTypeParser::parseLvlType(), parseMatrixType(), mlir::amdgpu::parseMNKDimensionList(), parseMultitileSizesTypes(), parseNamedStructuredOp(), parseNamedStructuredOpRegion(), parseOneOpBundle(), parseOneResultSameOperandTypeOp(), parseOptionalArrayStride(), parseOptionalDecimalInteger(), parseOptionalStaticSlice(), parseOrderClause(), parsePointerType(), parseQuantParamListUntilRBrace(), parseQuantParams(), parseResourceHandle(), parseSameOperandTypeVariadicToBoolOp(), parseScheduleClause(), parseShuffleType(), parseStorageRange(), parseStorageType(), parseString(), parseStructMemberDecorations(), parseSymbolName(), parseSymbolVisibility(), parseSynchronizationHint(), parseTargetEnvAttr(), parseTensorArmType(), parseType(), mlir::DynamicDialect::parseType(), mlir::LLVM::detail::parseType(), mlir::tosa::parseVariableOpTypeOrInitialValue(), and parseVerCapExtAttr().

◆ getCurrentLocation() [2/2]

ParseResult mlir::AsmParser::getCurrentLocation ( SMLoc * loc)
inline

Definition at line 601 of file OpImplementation.h.

References getCurrentLocation(), and success().

◆ getEncodedSourceLoc()

virtual Location mlir::AsmParser::getEncodedSourceLoc ( SMLoc loc)
pure virtual

Re-encode the given source location as an MLIR location and return it.

Note: This method should only be used when a Location is necessary, as the encoding process is not efficient.

Referenced by mlir::sparse_tensor::ir_detail::VarInfo::getLocation(), and minSMLoc().

◆ getNameLoc()

◆ parseAffineExpr()

virtual ParseResult mlir::AsmParser::parseAffineExpr ( ArrayRef< std::pair< StringRef, AffineExpr > > symbolSet,
AffineExpr & expr )
pure virtual

Parse an affine expr instance into 'expr' using the already computed mapping from symbols to affine expressions in 'symbolSet'.

◆ parseAffineMap()

virtual ParseResult mlir::AsmParser::parseAffineMap ( AffineMap & map)
pure virtual

Parse an affine map instance into 'map'.

Referenced by mlir::FieldParser< AffineMap >::parse().

◆ parseArrow()

virtual ParseResult mlir::AsmParser::parseArrow ( )
pure virtual

◆ parseArrowTypeList()

virtual ParseResult mlir::AsmParser::parseArrowTypeList ( SmallVectorImpl< Type > & result)
pure virtual

Parse an arrow followed by a type list.

References result.

Referenced by parseSparseCoIterateLoop(), and parseSparseIterateLoop().

◆ parseAttribute() [1/5]

ParseResult mlir::AsmParser::parseAttribute ( Attribute & result,
StringRef attrName,
NamedAttrList & attrs )
inline

Parse an arbitrary attribute and return it in result.

This also adds the attribute to the specified attribute list with the specified name.

Definition at line 1016 of file OpImplementation.h.

References parseAttribute(), and result.

◆ parseAttribute() [2/5]

◆ parseAttribute() [3/5]

template<typename AttrType>
ParseResult mlir::AsmParser::parseAttribute ( AttrType & result,
StringRef attrName,
NamedAttrList & attrs )
inline

Parse an attribute of a specific kind and type.

Definition at line 1023 of file OpImplementation.h.

References parseAttribute(), and result.

◆ parseAttribute() [4/5]

template<typename AttrType>
ParseResult mlir::AsmParser::parseAttribute ( AttrType & result,
Type type,
StringRef attrName,
NamedAttrList & attrs )
inline

Parse an arbitrary attribute of a given type and populate it in result.

This also adds the attribute to the specified attribute list with the specified name.

Definition at line 1032 of file OpImplementation.h.

References mlir::NamedAttrList::append(), emitError(), getCurrentLocation(), parseAttribute(), result, and success().

◆ parseAttribute() [5/5]

template<typename AttrType>
ParseResult mlir::AsmParser::parseAttribute ( AttrType & result,
Type type = {} )
inline

Parse an attribute of a specific kind and type.

Definition at line 999 of file OpImplementation.h.

References result.

◆ parseBase64Bytes()

virtual ParseResult mlir::AsmParser::parseBase64Bytes ( std::vector< char > * bytes)
pure virtual

Parses a Base64 encoded string of bytes.

◆ parseColon()

◆ parseColonType() [1/2]

◆ parseColonType() [2/2]

template<typename TypeType>
ParseResult mlir::AsmParser::parseColonType ( TypeType & result)
inline

Parse a colon followed by a type of a specific kind, e.g. a FunctionType.

Definition at line 1345 of file OpImplementation.h.

References diag(), emitError(), getCurrentLocation(), parseColonType(), result, and success().

◆ parseColonTypeList()

virtual ParseResult mlir::AsmParser::parseColonTypeList ( SmallVectorImpl< Type > & result)
pure virtual

◆ parseComma()

◆ parseCommaSeparatedList() [1/2]

virtual ParseResult mlir::AsmParser::parseCommaSeparatedList ( Delimiter delimiter,
function_ref< ParseResult()> parseElementFn,
StringRef contextMessage = StringRef() )
pure virtual

Parse a list of comma-separated items with an optional delimiter.

If a delimiter is provided, then an empty list is allowed. If not, then at least one element will be parsed.

contextMessage is an optional message appended to "expected '('" sorts of diagnostics when parsing the delimeters.

Referenced by mlir::FieldParser< ContainerT, std::enable_if_t< llvm::is_detected< detail::has_push_back_t, ContainerT >::value, ContainerT > >::parse(), parseAlignedClause(), parseAllocateAndAllocator(), parseAngleBracketedEntries(), parseApplyRegisteredPassOptions(), parseAttributesOp(), parseBindName(), parseBlockSizeInfoUntilRBrace(), parseClauseWithRegionArgs(), parseCommaSeparatedList(), parseCopyprivate(), parseCreateOperationOpAttributes(), parseDependVarList(), parseDeviceTypeArrayAttr(), parseDeviceTypeOperands(), parseDeviceTypeOperandsWithKeywordOnly(), parseDeviceTypeOperandsWithSegment(), mlir::parseDynamicIndexList(), parseExpressionArg(), parseExtTypeParams(), parseFunctionArgumentList(), parseGangClause(), parseGEPIndices(), parseIndirectBrOpSucessors(), parseKeywordList(), parseLaunchFuncOperands(), parseLinearClause(), mlir::sparse_tensor::ir_detail::LvlTypeParser::parseLvlType(), parseNamedValueListImpl(), parseNumGangs(), parseOpBundles(), parseOperandsWithKeywordOnly(), parseOperationOpAttributes(), parseOptionalDefinedList(), parseOptionalDynamicIndexList(), parseQuantParamListUntilRBrace(), parseRoutineGangClause(), parseStructMemberDecorations(), parseSwitchOpCases(), parseSymOperandList(), parseSynchronizationHint(), mlir::transform::parseTransformMatchDims(), parseTypeAndAttrList(), parseTypeList(), parseWaitClause(), and mlir::detail::DenseArrayAttrImpl< T >::parseWithoutBraces().

◆ parseCommaSeparatedList() [2/2]

ParseResult mlir::AsmParser::parseCommaSeparatedList ( function_ref< ParseResult()> parseElementFn)
inline

Parse a comma separated list of elements that must have at least one entry in it.

Definition at line 847 of file OpImplementation.h.

References None, and parseCommaSeparatedList().

◆ parseCustomAttributeWithFallback() [1/5]

virtual ParseResult mlir::AsmParser::parseCustomAttributeWithFallback ( Attribute & result,
Type type,
function_ref< ParseResult(Attribute &result, Type type)> parseAttribute )
pure virtual

Parse a custom attribute with the provided callback, unless the next token is #, in which case the generic parser is invoked.

References parseAttribute(), and result.

Referenced by mlir::FieldParser< AttributeT, std::enable_if_t< std::is_base_of< Attribute, AttributeT >::value, AttributeT > >::parse(), and parseCustomAttributeWithFallback().

◆ parseCustomAttributeWithFallback() [2/5]

template<typename AttrType>
std::enable_if_t< detect_has_parse_method< AttrType >::value, ParseResult > mlir::AsmParser::parseCustomAttributeWithFallback ( AttrType & result,
Type type,
StringRef attrName,
NamedAttrList & attrs )
inline

Parse a custom attribute of a given type unless the next token is #, in which case the generic parser is invoked.

The parsed attribute is populated in result and also added to the specified attribute list with the specified name.

Definition at line 1063 of file OpImplementation.h.

References mlir::NamedAttrList::append(), emitError(), getCurrentLocation(), parseCustomAttributeWithFallback(), result, and success().

◆ parseCustomAttributeWithFallback() [3/5]

template<typename AttrType>
std::enable_if_t<!detect_has_parse_method< AttrType >::value, ParseResult > mlir::AsmParser::parseCustomAttributeWithFallback ( AttrType & result,
Type type,
StringRef attrName,
NamedAttrList & attrs )
inline

SFINAE parsing method for Attribute that don't implement a parse method.

Definition at line 1090 of file OpImplementation.h.

References parseAttribute(), and result.

◆ parseCustomAttributeWithFallback() [4/5]

template<typename AttrType>
std::enable_if_t< detect_has_parse_method< AttrType >::value, ParseResult > mlir::AsmParser::parseCustomAttributeWithFallback ( AttrType & result,
Type type = {} )
inline

Parse a custom attribute of a given type unless the next token is #, in which case the generic parser is invoked.

The parsed attribute is populated in result.

Definition at line 1100 of file OpImplementation.h.

References result.

◆ parseCustomAttributeWithFallback() [5/5]

template<typename AttrType>
std::enable_if_t<!detect_has_parse_method< AttrType >::value, ParseResult > mlir::AsmParser::parseCustomAttributeWithFallback ( AttrType & result,
Type type = {} )
inline

SFINAE parsing method for Attribute that don't implement a parse method.

Definition at line 1122 of file OpImplementation.h.

References result.

◆ parseCustomTypeWithFallback() [1/3]

virtual ParseResult mlir::AsmParser::parseCustomTypeWithFallback ( Type & result,
function_ref< ParseResult(Type &result)> parseType )
pure virtual

Parse a custom type with the provided callback, unless the next token is #, in which case the generic parser is invoked.

References parseType(), and result.

Referenced by mlir::FieldParser< TypeT, std::enable_if_t< std::is_base_of< Type, TypeT >::value, TypeT > >::parse(), and parseCustomTypeWithFallback().

◆ parseCustomTypeWithFallback() [2/3]

template<typename TypeT>
std::enable_if_t< detect_type_has_parse_method< TypeT >::value, ParseResult > mlir::AsmParser::parseCustomTypeWithFallback ( TypeT & result)
inline

Parse a custom Type of a given type unless the next token is #, in which case the generic parser is invoked.

The parsed Type is populated in result.

Definition at line 1300 of file OpImplementation.h.

References diag(), emitError(), getCurrentLocation(), parseCustomTypeWithFallback(), result, and success().

◆ parseCustomTypeWithFallback() [3/3]

template<typename TypeT>
std::enable_if_t<!detect_type_has_parse_method< TypeT >::value, ParseResult > mlir::AsmParser::parseCustomTypeWithFallback ( TypeT & result)
inline

SFINAE parsing method for Type that don't implement a parse method.

Definition at line 1326 of file OpImplementation.h.

References parseType(), and result.

◆ parseDecimalInteger()

template<typename IntT>
ParseResult mlir::AsmParser::parseDecimalInteger ( IntT & result)
inline

Parse a decimal integer value from the stream.

Definition at line 762 of file OpImplementation.h.

References emitError(), getCurrentLocation(), mlir::OptionalParseResult::has_value(), parseOptionalDecimalInteger(), and result.

◆ parseDimensionList()

virtual ParseResult mlir::AsmParser::parseDimensionList ( SmallVectorImpl< int64_t > & dimensions,
bool allowDynamic = true,
bool withTrailingX = true )
pure virtual

Parse a dimension list of a tensor or memref type.

This populates the dimension list, using ShapedType::kDynamic for the ? dimensions if allowDynamic is set and errors out on ? otherwise. Parsing the trailing x is configurable.

dimension-list ::= eps | dimension (x dimension)* dimension-list-with-trailing-x ::= (dimension x)* dimension ::= ? | decimal-literal

When allowDynamic is not set, this is used to parse:

static-dimension-list ::= eps | decimal-literal (x decimal-literal)* static-dimension-list-with-trailing-x ::= (dimension x)*

Referenced by parseArrayType(), parseCooperativeMatrixType(), mlir::parseDimensionList(), parseMatrixType(), mlir::amdgpu::parseMNKDimensionList(), and parseTensorArmType().

◆ parseEllipsis()

virtual ParseResult mlir::AsmParser::parseEllipsis ( )
pure virtual

Parse a ... token.

◆ parseEqual()

◆ parseFloat() [1/2]

virtual ParseResult mlir::AsmParser::parseFloat ( const llvm::fltSemantics & semantics,
APFloat & result )
pure virtual

Parse a floating point value into APFloat from the stream.

References result.

◆ parseFloat() [2/2]

virtual ParseResult mlir::AsmParser::parseFloat ( double & result)
pure virtual

Parse a floating point value from the stream.

References result.

Referenced by parseExpressedTypeAndRange(), and parseQuantParams().

◆ parseGreater()

◆ parseInteger()

◆ parseIntegerSet()

virtual ParseResult mlir::AsmParser::parseIntegerSet ( IntegerSet & set)
pure virtual

Parse an integer set instance into 'set'.

◆ parseKeyword() [1/3]

ParseResult mlir::AsmParser::parseKeyword ( StringRef * keyword)
inline

Parse a keyword into 'keyword'.

Definition at line 932 of file OpImplementation.h.

References emitError(), getCurrentLocation(), parseOptionalKeyword(), and success().

◆ parseKeyword() [2/3]

◆ parseKeyword() [3/3]

virtual ParseResult mlir::AsmParser::parseKeyword ( StringRef keyword,
const Twine & msg )
pure virtual

◆ parseKeywordOrCompletion()

virtual ParseResult mlir::AsmParser::parseKeywordOrCompletion ( StringRef * keyword)
protectedpure virtual

Parse a keyword, or an empty string if the current location signals a code completion.

◆ parseKeywordOrString()

ParseResult mlir::AsmParser::parseKeywordOrString ( std::string * result)
inline

Parse a keyword or a quoted string.

Definition at line 952 of file OpImplementation.h.

References emitError(), getCurrentLocation(), parseOptionalKeywordOrString(), result, and success().

◆ parseKeywordType()

ParseResult mlir::AsmParser::parseKeywordType ( const char * keyword,
Type & result )
inline

Parse a keyword followed by a type.

Definition at line 1375 of file OpImplementation.h.

References parseKeyword(), parseType(), and result.

◆ parseLBrace()

virtual ParseResult mlir::AsmParser::parseLBrace ( )
pure virtual

◆ parseLess()

◆ parseLParen()

◆ parseLSquare()

virtual ParseResult mlir::AsmParser::parseLSquare ( )
pure virtual

◆ parseMinus()

virtual ParseResult mlir::AsmParser::parseMinus ( )
pure virtual

Parse a '-' token.

Referenced by parseLoopTransformClis().

◆ parseOptionalArrow()

virtual ParseResult mlir::AsmParser::parseOptionalArrow ( )
pure virtual

◆ parseOptionalArrowTypeList()

virtual ParseResult mlir::AsmParser::parseOptionalArrowTypeList ( SmallVectorImpl< Type > & result)
pure virtual

Parse an optional arrow followed by a type list.

References result.

Referenced by parseNamedStructuredOpResults().

◆ parseOptionalAttrDict()

◆ parseOptionalAttrDictWithKeyword()

virtual ParseResult mlir::AsmParser::parseOptionalAttrDictWithKeyword ( NamedAttrList & result)
pure virtual

Parse a named dictionary into 'result' if the attributes keyword is present.

References result.

Referenced by mlir::function_interface_impl::parseFunctionOp().

◆ parseOptionalAttribute() [1/6]

virtual OptionalParseResult mlir::AsmParser::parseOptionalAttribute ( ArrayAttr & result,
Type type = {} )
pure virtual

Parse an optional array attribute and return it in result.

References ArrayAttr(), and result.

◆ parseOptionalAttribute() [2/6]

virtual OptionalParseResult mlir::AsmParser::parseOptionalAttribute ( Attribute & result,
Type type = {} )
pure virtual

◆ parseOptionalAttribute() [3/6]

template<typename AttrType>
OptionalParseResult mlir::AsmParser::parseOptionalAttribute ( AttrType & result,
StringRef attrName,
NamedAttrList & attrs )
inline

Parse an optional attribute of a specific type and add it to the list with the specified name.

Definition at line 1146 of file OpImplementation.h.

References parseOptionalAttribute(), and result.

◆ parseOptionalAttribute() [4/6]

template<typename AttrType>
OptionalParseResult mlir::AsmParser::parseOptionalAttribute ( AttrType & result,
Type type,
StringRef attrName,
NamedAttrList & attrs )
inline

Parse an optional attribute of a specific type and add it to the list with the specified name.

Definition at line 1155 of file OpImplementation.h.

References mlir::NamedAttrList::append(), mlir::OptionalParseResult::has_value(), parseOptionalAttribute(), and result.

◆ parseOptionalAttribute() [5/6]

virtual OptionalParseResult mlir::AsmParser::parseOptionalAttribute ( StringAttr & result,
Type type = {} )
pure virtual

Parse an optional string attribute and return it in result.

References result.

◆ parseOptionalAttribute() [6/6]

virtual OptionalParseResult mlir::AsmParser::parseOptionalAttribute ( SymbolRefAttr & result,
Type type = {} )
pure virtual

Parse an optional symbol ref attribute and return it in result.

References result.

◆ parseOptionalColon()

virtual ParseResult mlir::AsmParser::parseOptionalColon ( )
pure virtual

◆ parseOptionalColonTypeList()

virtual ParseResult mlir::AsmParser::parseOptionalColonTypeList ( SmallVectorImpl< Type > & result)
pure virtual

Parse an optional colon followed by a type list, which if present must have at least one type.

References result.

◆ parseOptionalComma()

◆ parseOptionalDecimalInteger() [1/2]

virtual OptionalParseResult mlir::AsmParser::parseOptionalDecimalInteger ( APInt & result)
pure virtual

◆ parseOptionalDecimalInteger() [2/2]

template<typename IntT>
OptionalParseResult mlir::AsmParser::parseOptionalDecimalInteger ( IntT & result)
inline

Definition at line 804 of file OpImplementation.h.

References parseOptionalDecimalInteger(), and result.

◆ parseOptionalEllipsis()

virtual ParseResult mlir::AsmParser::parseOptionalEllipsis ( )
pure virtual

Parse a ... token if present;.

Referenced by parseFunctionArgumentList(), and parseFunctionTypes().

◆ parseOptionalEqual()

◆ parseOptionalGreater()

virtual ParseResult mlir::AsmParser::parseOptionalGreater ( )
pure virtual

Parse a '>' token if present.

Referenced by parseStructType(), and typeOrAttrParser().

◆ parseOptionalInteger() [1/2]

◆ parseOptionalInteger() [2/2]

template<typename IntT>
OptionalParseResult mlir::AsmParser::parseOptionalInteger ( IntT & result)
inline

Definition at line 798 of file OpImplementation.h.

References parseOptionalInteger(), and result.

◆ parseOptionalKeyword() [1/3]

virtual ParseResult mlir::AsmParser::parseOptionalKeyword ( StringRef * keyword)
pure virtual

Parse a keyword, if present, into 'keyword'.

◆ parseOptionalKeyword() [2/3]

virtual ParseResult mlir::AsmParser::parseOptionalKeyword ( StringRef * keyword,
ArrayRef< StringRef > allowedValues )
pure virtual

Parse a keyword, if present, and if one of the 'allowedValues', into 'keyword'.

◆ parseOptionalKeyword() [3/3]

◆ parseOptionalKeywordOrString()

virtual ParseResult mlir::AsmParser::parseOptionalKeywordOrString ( std::string * result)
pure virtual

Parse an optional keyword or string.

References result.

Referenced by parseApplyRegisteredPassOptions(), and parseKeywordOrString().

◆ parseOptionalLBrace()

virtual ParseResult mlir::AsmParser::parseOptionalLBrace ( )
pure virtual

◆ parseOptionalLess()

virtual ParseResult mlir::AsmParser::parseOptionalLess ( )
pure virtual

◆ parseOptionalLParen()

◆ parseOptionalLSquare()

◆ parseOptionalMinus()

virtual ParseResult mlir::AsmParser::parseOptionalMinus ( )
pure virtual

Parse a '-' token if present.

◆ parseOptionalPlus()

virtual ParseResult mlir::AsmParser::parseOptionalPlus ( )
pure virtual

Parse a '+' token if present.

◆ parseOptionalQuestion()

virtual ParseResult mlir::AsmParser::parseOptionalQuestion ( )
pure virtual

Parse a '?' token if present.

◆ parseOptionalRBrace()

virtual ParseResult mlir::AsmParser::parseOptionalRBrace ( )
pure virtual

Parse a } token if present.

Referenced by parseBlockSizeInfoUntilRBrace().

◆ parseOptionalRParen()

virtual ParseResult mlir::AsmParser::parseOptionalRParen ( )
pure virtual

◆ parseOptionalRSquare()

virtual ParseResult mlir::AsmParser::parseOptionalRSquare ( )
pure virtual

◆ parseOptionalSlash()

virtual ParseResult mlir::AsmParser::parseOptionalSlash ( )
pure virtual

Parse a '/' token if present.

◆ parseOptionalStar()

virtual ParseResult mlir::AsmParser::parseOptionalStar ( )
pure virtual

Parse a '*' token if present.

Referenced by mlir::transform::parsePackedOrDynamicIndexList(), and parseTensorArmType().

◆ parseOptionalString()

virtual ParseResult mlir::AsmParser::parseOptionalString ( std::string * string)
pure virtual

Parse a quoted string token if present.

Referenced by parseKeyValuePair(), and parseString().

◆ parseOptionalSymbolName() [1/2]

virtual ParseResult mlir::AsmParser::parseOptionalSymbolName ( StringAttr & result)
pure virtual

Parse an optional -identifier and store it (without the '@' symbol) in a string attribute.

References result.

Referenced by parseOptionalSymbolName(), and parseSymbolName().

◆ parseOptionalSymbolName() [2/2]

ParseResult mlir::AsmParser::parseOptionalSymbolName ( StringAttr & result,
StringRef attrName,
NamedAttrList & attrs )
inline

Parse an optional -identifier and store it (without the '@' symbol) in a string attribute named 'attrName'.

Definition at line 1213 of file OpImplementation.h.

References mlir::NamedAttrList::append(), parseOptionalSymbolName(), result, and success().

◆ parseOptionalType()

virtual OptionalParseResult mlir::AsmParser::parseOptionalType ( Type & result)
pure virtual

Parse an optional type.

References result.

Referenced by dispatchParse(), parseKeyValuePair(), and parseStorageType().

◆ parseOptionalVerticalBar()

virtual ParseResult mlir::AsmParser::parseOptionalVerticalBar ( )
pure virtual

Parse a '|' token if present.

◆ parsePlus()

virtual ParseResult mlir::AsmParser::parsePlus ( )
pure virtual

Parse a '+' token.

◆ parseQuestion()

virtual ParseResult mlir::AsmParser::parseQuestion ( )
pure virtual

Parse a '?' token.

Referenced by parseOptionalStaticSlice().

◆ parseRBrace()

◆ parseResourceHandle() [1/2]

template<typename ResourceT>
FailureOr< ResourceT > mlir::AsmParser::parseResourceHandle ( )
inline

Parse a handle to a resource within the assembly format.

Definition at line 1228 of file OpImplementation.h.

References emitError(), getContext(), getCurrentLocation(), mlir::MLIRContext::getOrLoadDialect(), parseResourceHandle(), and result.

Referenced by parseResourceHandle().

◆ parseResourceHandle() [2/2]

virtual FailureOr< AsmDialectResourceHandle > mlir::AsmParser::parseResourceHandle ( Dialect * dialect)
protectedpure virtual

Parse a handle to a resource within the assembly format for the given dialect.

◆ parseRParen()

◆ parseRSquare()

◆ parseSlash()

virtual ParseResult mlir::AsmParser::parseSlash ( )
pure virtual

Parse a '/' token.

◆ parseStar()

virtual ParseResult mlir::AsmParser::parseStar ( )
pure virtual

Parse a '*' token.

◆ parseString()

ParseResult mlir::AsmParser::parseString ( std::string * string)
inline

Parse a quoted string token.

Definition at line 700 of file OpImplementation.h.

References emitError(), getCurrentLocation(), parseOptionalString(), and success().

Referenced by mlir::FieldParser< std::string >::parse(), and parseOneOpBundle().

◆ parseSymbolName() [1/2]

ParseResult mlir::AsmParser::parseSymbolName ( StringAttr & result)
inline

Parse an -identifier and store it (without the '@' symbol) in a string attribute.

Definition at line 1190 of file OpImplementation.h.

References emitError(), getCurrentLocation(), parseOptionalSymbolName(), result, and success().

Referenced by parseForeachMatchSymbols(), mlir::function_interface_impl::parseFunctionOp(), and parseSymbolName().

◆ parseSymbolName() [2/2]

ParseResult mlir::AsmParser::parseSymbolName ( StringAttr & result,
StringRef attrName,
NamedAttrList & attrs )
inline

Parse an -identifier and store it (without the '@' symbol) in a string attribute named 'attrName'.

Definition at line 1199 of file OpImplementation.h.

References mlir::NamedAttrList::append(), parseSymbolName(), result, and success().

◆ parseType() [1/2]

◆ parseType() [2/2]

template<typename TypeT>
ParseResult mlir::AsmParser::parseType ( TypeT & result)
inline

Parse a type of a specific type.

Definition at line 1266 of file OpImplementation.h.

References diag(), emitError(), getCurrentLocation(), parseType(), result, and success().

◆ parseTypeList()

ParseResult AsmParser::parseTypeList ( SmallVectorImpl< Type > & result)

◆ parseVerticalBar()

virtual ParseResult mlir::AsmParser::parseVerticalBar ( )
pure virtual

Parse a '|' token.

◆ parseXInDimensionList()

virtual ParseResult mlir::AsmParser::parseXInDimensionList ( )
pure virtual

Parse an 'x' token in a dimension list, handling the case where the x is juxtaposed with an element type, as in "xf32", leaving the "f32" as the next token.

Referenced by parseTensorArmType().

◆ popCyclicParsing()

virtual void mlir::AsmParser::popCyclicParsing ( )
protectedpure virtual

Removes the element that was last inserted with a successful call to pushCyclicParsing.

There must be exactly one popCyclicParsing call in reverse order of all successful pushCyclicParsing.

◆ pushCyclicParsing()

virtual LogicalResult mlir::AsmParser::pushCyclicParsing ( const void * opaquePointer)
protectedpure virtual

Pushes a new attribute or type in the form of a type erased pointer into an internal set.

Returns success if the type or attribute was inserted in the set or failure if it was already contained.

Referenced by tryStartCyclicParse().

◆ tryStartCyclicParse()

template<class AttrOrTypeT>
FailureOr< CyclicParseReset > mlir::AsmParser::tryStartCyclicParse ( AttrOrTypeT attrOrType)
inline

Attempts to start a cyclic parsing region for attrOrType.

A cyclic parsing region starts with this call and ends with the destruction of the returned CyclicParseReset. During this time, calling tryStartCyclicParse with the same attribute in any parser will lead to returning failure.

This makes it possible to parse cyclic attributes or types by parsing a short from if nested within itself.

Definition at line 1450 of file OpImplementation.h.

References pushCyclicParsing().

Referenced by parseStructType().


The documentation for this class was generated from the following files: