|
MLIR 22.0.0git
|
The DialectAsmParser has methods for interacting with the asm parser when parsing attributes and types. More...
#include "mlir/IR/DialectImplementation.h"
Public Member Functions | |
| ~DialectAsmParser () override | |
| virtual StringRef | getFullSymbolSpec () const =0 |
| Returns the full specification of the symbol being parsed. | |
| AsmParser ()=default | |
| Public Member Functions inherited from mlir::AsmParser | |
| AsmParser ()=default | |
| virtual | ~AsmParser () |
| MLIRContext * | getContext () 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 Builder & | getBuilder () 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< CyclicParseReset > | tryStartCyclicParse (AttrOrTypeT attrOrType) |
| Attempts to start a cyclic parsing region for attrOrType. | |
Additional Inherited Members | |
| Public Types inherited from mlir::AsmParser | |
| 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 |
| Protected Member Functions inherited from mlir::AsmParser | |
| virtual FailureOr< AsmDialectResourceHandle > | parseResourceHandle (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. | |
The DialectAsmParser has methods for interacting with the asm parser when parsing attributes and types.
Definition at line 56 of file DialectImplementation.h.
|
overridedefault |
|
default |
|
pure virtual |
Returns the full specification of the symbol being parsed.
This allows for using a separate parser if necessary.
Referenced by mlir::Dialect::parseType().