LLVM: llvm::MCAsmParser Class Reference (original) (raw)
Generic assembler parser interface, for use by target specific assembly parsers. More...
#include "[llvm/MC/MCParser/MCAsmParser.h](MCAsmParser%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| MCAsmParser (const MCAsmParser &)=delete | |
| MCAsmParser & | operator= (const MCAsmParser &)=delete |
| virtual | ~MCAsmParser () |
| virtual void | addDirectiveHandler (StringRef Directive, ExtensionDirectiveHandler Handler)=0 |
| virtual void | addAliasForDirective (StringRef Directive, StringRef Alias)=0 |
| MCContext & | getContext () |
| MCStreamer & | getStreamer () |
| SourceMgr & | getSourceManager () |
| AsmLexer & | getLexer () |
| const AsmLexer & | getLexer () const |
| MCTargetAsmParser & | getTargetParser () const |
| void | setTargetParser (MCTargetAsmParser &P) |
| virtual unsigned | getAssemblerDialect () |
| virtual void | setAssemblerDialect (unsigned i) |
| bool | getShowParsedOperands () const |
| void | setShowParsedOperands (bool Value) |
| virtual bool | Run (bool NoInitialTextSection, bool NoFinalize=false)=0 |
| Run the parser on the input source buffer. | |
| virtual void | setParsingMSInlineAsm (bool V)=0 |
| virtual bool | isParsingMSInlineAsm ()=0 |
| virtual bool | discardLTOSymbol (StringRef) const |
| virtual bool | isParsingMasm () const |
| virtual bool | defineMacro (StringRef Name, StringRef Value) |
| virtual bool | lookUpField (StringRef Name, AsmFieldInfo &Info) const |
| virtual bool | lookUpField (StringRef Base, StringRef Member, AsmFieldInfo &Info) const |
| virtual bool | lookUpType (StringRef Name, AsmTypeInfo &Info) const |
| virtual bool | parseMSInlineAsm (std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, SmallVectorImpl< std::pair< void *, bool > > &OpDecls, SmallVectorImpl< std::string > &Constraints, SmallVectorImpl< std::string > &Clobbers, const MCInstrInfo *MII, MCInstPrinter *IP, MCAsmParserSemaCallback &SI)=0 |
| Parse MS-style inline assembly. | |
| virtual void | Note (SMLoc L, const Twine &Msg, SMRange Range={})=0 |
| Emit a note at the location L, with the message Msg. | |
| virtual bool | Warning (SMLoc L, const Twine &Msg, SMRange Range={})=0 |
| Emit a warning at the location L, with the message Msg. | |
| bool | Error (SMLoc L, const Twine &Msg, SMRange Range={}) |
| Return an error at the location L, with the message Msg. | |
| virtual bool | printError (SMLoc L, const Twine &Msg, SMRange Range={})=0 |
| Emit an error at the location L, with the message Msg. | |
| bool | hasPendingError () |
| bool | printPendingErrors () |
| void | clearPendingErrors () |
| bool | addErrorSuffix (const Twine &Suffix) |
| virtual const AsmToken & | Lex ()=0 |
| Get the next AsmToken in the stream, possibly handling file inclusion first. | |
| const AsmToken & | getTok () const |
| Get the current AsmToken from the stream. | |
| bool | TokError (const Twine &Msg, SMRange Range={}) |
| Report an error at the current lexer location. | |
| bool | parseTokenLoc (SMLoc &Loc) |
| bool | parseToken (AsmToken::TokenKind T, const Twine &Msg="unexpected token") |
| bool | parseOptionalToken (AsmToken::TokenKind T) |
| Attempt to parse and consume token, returning true on success. | |
| bool | parseComma () |
| bool | parseRParen () |
| bool | parseEOL () |
| bool | parseEOL (const Twine &ErrMsg) |
| bool | parseMany (function_ref< bool()> parseOne, bool hasComma=true) |
| bool | parseIntToken (int64_t &V, const Twine &ErrMsg="expected integer") |
| bool | check (bool P, const Twine &Msg) |
| bool | check (bool P, SMLoc Loc, const Twine &Msg) |
| virtual bool | parseIdentifier (StringRef &Res)=0 |
| Parse an identifier or string (as a quoted identifier) and set Res to the identifier contents. | |
| bool | parseSymbol (MCSymbol *&Res) |
| Parse identifier and get or create symbol for it. | |
| virtual StringRef | parseStringToEndOfStatement ()=0 |
| Parse up to the end of statement and return the contents from the current token until the end of the statement; the current token on exit will be either the EndOfStatement or EOF. | |
| virtual bool | parseEscapedString (std::string &Data)=0 |
| Parse the current token as a string which may include escaped characters and return the string contents. | |
| virtual bool | parseAngleBracketString (std::string &Data)=0 |
| Parse an angle-bracket delimited string at the current position if one is present, returning the string contents. | |
| virtual void | eatToEndOfStatement ()=0 |
| Skip to the end of the current statement, for error recovery. | |
| virtual bool | parseExpression (const MCExpr *&Res, SMLoc &EndLoc)=0 |
| Parse an arbitrary expression. | |
| bool | parseExpression (const MCExpr *&Res) |
| virtual bool | parsePrimaryExpr (const MCExpr *&Res, SMLoc &EndLoc, AsmTypeInfo *TypeInfo=nullptr)=0 |
| Parse a primary expression. | |
| virtual bool | parseParenExpression (const MCExpr *&Res, SMLoc &EndLoc)=0 |
| Parse an arbitrary expression, assuming that an initial '(' has already been consumed. | |
| virtual bool | parseAbsoluteExpression (int64_t &Res)=0 |
| Parse an expression which must evaluate to an absolute value. | |
| virtual bool | checkForValidSection ()=0 |
| Ensure that we have a valid section set in the streamer. | |
| bool | parseGNUAttribute (SMLoc L, int64_t &Tag, int64_t &IntegerValue) |
| Parse a .gnu_attribute. | |
| bool | parseAtSpecifier (const MCExpr *&Res, SMLoc &EndLoc) |
| const MCExpr * | applySpecifier (const MCExpr *E, uint32_t Variant) |
| Protected Attributes | |
|---|---|
| MCContext & | Ctx |
| MCStreamer & | Out |
| SourceMgr & | SrcMgr |
| const MCAsmInfo & | MAI |
| AsmLexer | Lexer |
| SmallVector< MCPendingError, 0 > | PendingErrors |
| bool | HadError = false |
| Flag tracking whether any errors have been encountered. | |
| bool | ShowParsedOperands = false |
Generic assembler parser interface, for use by target specific assembly parsers.
Definition at line 124 of file MCAsmParser.h.
◆ DirectiveHandler
◆ ExtensionDirectiveHandler
Initial value:
std::pair<MCAsmParserExtension*, DirectiveHandler>
Definition at line 127 of file MCAsmParser.h.
◆ MCAsmParser() [2/2]
◆ ~MCAsmParser()
| MCAsmParser::~MCAsmParser ( ) | virtualdefault |
|---|
◆ addAliasForDirective()
| virtual void llvm::MCAsmParser::addAliasForDirective ( StringRef Directive, StringRef Alias ) | pure virtual |
|---|
◆ addDirectiveHandler()
| virtual void llvm::MCAsmParser::addDirectiveHandler ( StringRef Directive, ExtensionDirectiveHandler Handler ) | pure virtual |
|---|
◆ addErrorSuffix()
◆ applySpecifier()
Definition at line 1321 of file AsmParser.cpp.
References applySpecifier(), llvm::MCExpr::Binary, llvm::cast(), llvm::MCExpr::Constant, llvm::MCBinaryExpr::create(), llvm::MCSymbolRefExpr::create(), llvm::MCUnaryExpr::create(), Ctx, getContext(), llvm::MCBinaryExpr::getLHS(), llvm::MCExpr::getLoc(), llvm::MCBinaryExpr::getOpcode(), llvm::MCUnaryExpr::getOpcode(), llvm::MCBinaryExpr::getRHS(), llvm::MCSymbolRefExpr::getSpecifier(), llvm::MCUnaryExpr::getSubExpr(), llvm::MCSymbolRefExpr::getSymbol(), getTargetParser(), getTok(), llvm_unreachable, llvm::MCExpr::Specifier, llvm::Sub, llvm::MCExpr::SymbolRef, llvm::MCExpr::Target, TokError(), and llvm::MCExpr::Unary.
Referenced by applySpecifier(), checkForValidSection(), and parseAtSpecifier().
◆ check() [1/2]
◆ check() [2/2]
◆ checkForValidSection()
| virtual bool llvm::MCAsmParser::checkForValidSection ( ) | pure virtual |
|---|
◆ clearPendingErrors()
| void llvm::MCAsmParser::clearPendingErrors ( ) | inline |
|---|
◆ defineMacro()
◆ discardLTOSymbol()
| virtual bool llvm::MCAsmParser::discardLTOSymbol ( StringRef ) const | inlinevirtual |
|---|
◆ eatToEndOfStatement()
| virtual void llvm::MCAsmParser::eatToEndOfStatement ( ) | pure virtual |
|---|
Skip to the end of the current statement, for error recovery.
◆ Error()
Return an error at the location L, with the message Msg.
This may be modified before being emitted.
Returns
The return value is always true, as an idiomatic convenience to clients.
Definition at line 104 of file MCAsmParser.cpp.
References llvm::AsmToken::Error, getLexer(), getTok(), llvm::AsmLexer::Lex(), llvm::MCAsmParser::MCPendingError::Loc, llvm::MCAsmParser::MCPendingError::Msg, PendingErrors, llvm::MCAsmParser::MCPendingError::Range, Range, and llvm::Twine::toVector().
Referenced by llvm::MCParserUtils::parseAssignmentExpression().
◆ getAssemblerDialect()
| virtual unsigned llvm::MCAsmParser::getAssemblerDialect ( ) | inlinevirtual |
|---|
◆ getContext()
| MCContext & llvm::MCAsmParser::getContext ( ) | inline |
|---|
◆ getLexer() [1/2]
| AsmLexer & llvm::MCAsmParser::getLexer ( ) | inline |
|---|
◆ getLexer() [2/2]
◆ getShowParsedOperands()
| bool llvm::MCAsmParser::getShowParsedOperands ( ) const | inline |
|---|
◆ getSourceManager()
| SourceMgr & llvm::MCAsmParser::getSourceManager ( ) | inline |
|---|
◆ getStreamer()
| MCStreamer & llvm::MCAsmParser::getStreamer ( ) | inline |
|---|
◆ getTargetParser()
◆ getTok()
Get the current AsmToken from the stream.
Definition at line 43 of file MCAsmParser.cpp.
References getLexer(), and llvm::AsmLexer::getTok().
Referenced by addErrorSuffix(), applySpecifier(), check(), Error(), Lex(), llvm::MCParserUtils::parseAssignmentExpression(), parseAtSpecifier(), parseEOL(), parseEOL(), parseGNUAttribute(), parseIntToken(), parseOptionalToken(), parseToken(), and parseTokenLoc().
◆ hasPendingError()
| bool llvm::MCAsmParser::hasPendingError ( ) | inline |
|---|
◆ isParsingMasm()
| virtual bool llvm::MCAsmParser::isParsingMasm ( ) const | inlinevirtual |
|---|
◆ isParsingMSInlineAsm()
| virtual bool llvm::MCAsmParser::isParsingMSInlineAsm ( ) | pure virtual |
|---|
◆ Lex()
◆ lookUpField() [1/2]
◆ lookUpField() [2/2]
◆ lookUpType()
◆ Note()
Emit a note at the location L, with the message Msg.
References Range.
◆ operator=()
◆ parseAbsoluteExpression()
| virtual bool llvm::MCAsmParser::parseAbsoluteExpression ( int64_t & Res) | pure virtual |
|---|
Parse an expression which must evaluate to an absolute value.
Parameters
| Res | - The value of the absolute expression. The result is undefined on error. |
|---|
Returns
- False on success.
Referenced by expectAbsExpression().
◆ parseAngleBracketString()
| virtual bool llvm::MCAsmParser::parseAngleBracketString ( std::string & Data) | pure virtual |
|---|
Parse an angle-bracket delimited string at the current position if one is present, returning the string contents.
References llvm::Data.
◆ parseAtSpecifier()
◆ parseComma()
| bool llvm::MCAsmParser::parseComma ( ) | inline |
|---|
◆ parseEOL() [1/2]
| bool MCAsmParser::parseEOL | ( | ) |
|---|
◆ parseEOL() [2/2]
◆ parseEscapedString()
| virtual bool llvm::MCAsmParser::parseEscapedString ( std::string & Data) | pure virtual |
|---|
Parse the current token as a string which may include escaped characters and return the string contents.
References llvm::Data.
◆ parseExpression() [1/2]
◆ parseExpression() [2/2]
◆ parseGNUAttribute()
| bool MCAsmParser::parseGNUAttribute | ( | SMLoc | L, |
|---|---|---|---|
| int64_t & | Tag, | ||
| int64_t & | IntegerValue ) |
◆ parseIdentifier()
| virtual bool llvm::MCAsmParser::parseIdentifier ( StringRef & Res) | pure virtual |
|---|
Parse an identifier or string (as a quoted identifier) and set Res to the identifier contents.
References parseSymbol().
Referenced by parseSymbol().
◆ parseIntToken()
| bool MCAsmParser::parseIntToken | ( | int64_t & | V, |
|---|---|---|---|
| const Twine & | ErrMsg = "expected integer" ) |
◆ parseMany()
◆ parseMSInlineAsm()
Parse MS-style inline assembly.
◆ parseOptionalToken()
◆ parseParenExpression()
Parse an arbitrary expression, assuming that an initial '(' has already been consumed.
Parameters
| Res | - The value of the expression. The result is undefined on error. |
|---|
Returns
- False on success.
◆ parsePrimaryExpr()
Parse a primary expression.
Parameters
| Res | - The value of the expression. The result is undefined on error. |
|---|
Returns
- False on success.
◆ parseRParen()
| bool llvm::MCAsmParser::parseRParen ( ) | inline |
|---|
◆ parseStringToEndOfStatement()
| virtual StringRef llvm::MCAsmParser::parseStringToEndOfStatement ( ) | pure virtual |
|---|
Parse up to the end of statement and return the contents from the current token until the end of the statement; the current token on exit will be either the EndOfStatement or EOF.
◆ parseSymbol()
◆ parseToken()
◆ parseTokenLoc()
| bool MCAsmParser::parseTokenLoc | ( | SMLoc & | Loc | ) |
|---|
◆ printError()
Emit an error at the location L, with the message Msg.
Returns
The return value is always true, as an idiomatic convenience to clients.
References Range.
Referenced by printPendingErrors().
◆ printPendingErrors()
| bool llvm::MCAsmParser::printPendingErrors ( ) | inline |
|---|
◆ Run()
| virtual bool llvm::MCAsmParser::Run ( bool NoInitialTextSection, bool NoFinalize = false ) | pure virtual |
|---|
Run the parser on the input source buffer.
◆ setAssemblerDialect()
| virtual void llvm::MCAsmParser::setAssemblerDialect ( unsigned i) | inlinevirtual |
|---|
◆ setParsingMSInlineAsm()
| virtual void llvm::MCAsmParser::setParsingMSInlineAsm ( bool V) | pure virtual |
|---|
◆ setShowParsedOperands()
| void llvm::MCAsmParser::setShowParsedOperands ( bool Value) | inline |
|---|
◆ setTargetParser()
◆ TokError()
◆ Warning()
Emit a warning at the location L, with the message Msg.
Returns
The return value is true, if warnings are fatal.
References Range.
◆ Ctx
◆ HadError
| bool llvm::MCAsmParser::HadError = false | protected |
|---|
Flag tracking whether any errors have been encountered.
Definition at line 150 of file MCAsmParser.h.
◆ Lexer
◆ MAI
◆ Out
◆ PendingErrors
◆ ShowParsedOperands
| bool llvm::MCAsmParser::ShowParsedOperands = false | protected |
|---|
◆ SrcMgr
The documentation for this class was generated from the following files:
- include/llvm/MC/MCParser/MCAsmParser.h
- lib/MC/MCParser/AsmParser.cpp
- lib/MC/MCParser/MCAsmParser.cpp