|
LLVM
8.0.1
|
Generic assembler parser interface, for use by target specific assembly parsers. More...
#include "llvm/MC/MCParser/MCAsmParser.h"

Classes | |
| struct | MCPendingError |
Public Types | |
| using | DirectiveHandler = bool(*)(MCAsmParserExtension *, StringRef, SMLoc) |
| using | ExtensionDirectiveHandler = std::pair< MCAsmParserExtension *, DirectiveHandler > |
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 |
| virtual SourceMgr & | getSourceManager ()=0 |
| virtual MCAsmLexer & | getLexer ()=0 |
| const MCAsmLexer & | getLexer () const |
| virtual MCContext & | getContext ()=0 |
| virtual MCStreamer & | getStreamer ()=0 |
| Return the output streamer for the assembler. More... | |
| MCTargetAsmParser & | getTargetParser () const |
| void | setTargetParser (MCTargetAsmParser &P) |
| virtual unsigned | getAssemblerDialect () |
| virtual void | setAssemblerDialect (unsigned i) |
| bool | getShowParsedOperands () const |
| void | setShowParsedOperands (bool Value) |
| void | setEnablePrintSchedInfo (bool Value) |
| bool | shouldPrintSchedInfo () const |
| virtual bool | Run (bool NoInitialTextSection, bool NoFinalize=false)=0 |
| Run the parser on the input source buffer. More... | |
| virtual void | setParsingInlineAsm (bool V)=0 |
| virtual bool | isParsingInlineAsm ()=0 |
| virtual bool | parseMSInlineAsm (void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, SmallVectorImpl< std::pair< void *, bool >> &OpDecls, SmallVectorImpl< std::string > &Constraints, SmallVectorImpl< std::string > &Clobbers, const MCInstrInfo *MII, const MCInstPrinter *IP, MCAsmParserSemaCallback &SI)=0 |
| Parse MS-style inline assembly. More... | |
| virtual void | Note (SMLoc L, const Twine &Msg, SMRange Range=None)=0 |
Emit a note at the location L, with the message Msg. More... | |
| virtual bool | Warning (SMLoc L, const Twine &Msg, SMRange Range=None)=0 |
Emit a warning at the location L, with the message Msg. More... | |
| bool | Error (SMLoc L, const Twine &Msg, SMRange Range=None) |
Return an error at the location L, with the message Msg. More... | |
| virtual bool | printError (SMLoc L, const Twine &Msg, SMRange Range=None)=0 |
Emit an error at the location L, with the message Msg. More... | |
| 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. More... | |
| const AsmToken & | getTok () const |
| Get the current AsmToken from the stream. More... | |
| bool | TokError (const Twine &Msg, SMRange Range=None) |
| Report an error at the current lexer location. More... | |
| 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. More... | |
| bool | parseEOL (const Twine &ErrMsg) |
| bool | parseMany (function_ref< bool()> parseOne, bool hasComma=true) |
| bool | parseIntToken (int64_t &V, const Twine &ErrMsg) |
| 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. More... | |
| 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. More... | |
| virtual bool | parseEscapedString (std::string &Data)=0 |
| Parse the current token as a string which may include escaped characters and return the string contents. More... | |
| virtual void | eatToEndOfStatement ()=0 |
| Skip to the end of the current statement, for error recovery. More... | |
| virtual bool | parseExpression (const MCExpr *&Res, SMLoc &EndLoc)=0 |
| Parse an arbitrary expression. More... | |
| bool | parseExpression (const MCExpr *&Res) |
| virtual bool | parsePrimaryExpr (const MCExpr *&Res, SMLoc &EndLoc)=0 |
| Parse a primary expression. More... | |
| virtual bool | parseParenExpression (const MCExpr *&Res, SMLoc &EndLoc)=0 |
| Parse an arbitrary expression, assuming that an initial '(' has already been consumed. More... | |
| virtual bool | parseAbsoluteExpression (int64_t &Res)=0 |
| Parse an expression which must evaluate to an absolute value. More... | |
| virtual bool | checkForValidSection ()=0 |
| Ensure that we have a valid section set in the streamer. More... | |
| virtual bool | parseParenExprOfDepth (unsigned ParenDepth, const MCExpr *&Res, SMLoc &EndLoc)=0 |
| Parse an arbitrary expression of a specified parenthesis depth, assuming that the initial '(' characters have already been consumed. More... | |
Protected Member Functions | |
| MCAsmParser () | |
Protected Attributes | |
| SmallVector< MCPendingError, 0 > | PendingErrors |
| bool | HadError = false |
| Flag tracking whether any errors have been encountered. More... | |
| bool | EnablePrintSchedInfo = false |
| Enable print [latency:throughput] in output file. More... | |
| bool | ShowParsedOperands = false |
Generic assembler parser interface, for use by target specific assembly parsers.
Definition at line 110 of file MCAsmParser.h.
| using llvm::MCAsmParser::DirectiveHandler = bool (*)(MCAsmParserExtension*, StringRef, SMLoc) |
Definition at line 112 of file MCAsmParser.h.
| using llvm::MCAsmParser::ExtensionDirectiveHandler = std::pair<MCAsmParserExtension*, DirectiveHandler> |
Definition at line 114 of file MCAsmParser.h.
|
protected |
Definition at line 24 of file MCAsmParser.cpp.
References ~MCAsmParser().
|
delete |
|
virtualdefault |
Referenced by MCAsmParser().
|
pure virtual |
|
pure virtual |
Definition at line 104 of file MCAsmParser.cpp.
References llvm::AsmToken::Error, getTok(), Lex(), PendingErrors, and llvm::Twine::toVector().
Referenced by llvm::MCAsmParserExtension::addErrorSuffix().
Definition at line 74 of file MCAsmParser.cpp.
References getTok().
Referenced by llvm::MCAsmParserExtension::check().
Definition at line 78 of file MCAsmParser.cpp.
References Error().
|
pure virtual |
Ensure that we have a valid section set in the streamer.
Otherwise, report an error and switch to .text.
|
inline |
Definition at line 218 of file MCAsmParser.h.
References llvm::SmallVectorImpl< T >::clear(), llvm::createMCAsmParser(), llvm::Data, and llvm::None.
|
pure virtual |
Skip to the end of the current statement, for error recovery.
Referenced by checkScale(), convertFPR32ToFPR64(), and RefineErrorLoc().
Return an error at the location L, with the message Msg.
This may be modified before being emitted.
Definition at line 88 of file MCAsmParser.cpp.
References llvm::AsmToken::Error, getLexer(), getTok(), llvm::MCAsmLexer::Lex(), llvm::MCAsmParser::MCPendingError::Loc, llvm::MCAsmParser::MCPendingError::Msg, PendingErrors, llvm::MCAsmParser::MCPendingError::Range, and llvm::Twine::toVector().
Referenced by check(), checkScale(), llvm::MCAsmParserExtension::Error(), llvm::MCParserUtils::parseAssignmentExpression(), parseEOL(), parseToken(), and TokError().
|
inlinevirtual |
Definition at line 163 of file MCAsmParser.h.
|
pure virtual |
|
pure virtual |
Referenced by Error(), llvm::MCAsmParserExtension::getLexer(), getTok(), RefineErrorLoc(), and TokError().
|
inline |
Definition at line 151 of file MCAsmParser.h.
|
inline |
Definition at line 166 of file MCAsmParser.h.
|
pure virtual |
Referenced by llvm::MCAsmParserExtension::getSourceManager().
|
pure virtual |
Return the output streamer for the assembler.
Referenced by llvm::MCAsmParserExtension::getStreamer(), makeCombineInst(), llvm::MCParserUtils::parseAssignmentExpression(), and printMCExpr().
|
inline |
Definition at line 160 of file MCAsmParser.h.
References P.
Get the current AsmToken from the stream.
Definition at line 34 of file MCAsmParser.cpp.
References getLexer(), and llvm::MCAsmLexer::getTok().
Referenced by addErrorSuffix(), addNegOperand(), check(), CheckBaseRegAndIndexRegAndScale(), checkScale(), convertFPR32ToFPR64(), doesIgnoreDataTypeSuffix(), Error(), ExpandCryptoAEK(), getNextRegister(), getPrefixes(), llvm::MCAsmParserExtension::getTok(), hasGOTReference(), incrementLoc(), llvm::IsCPSRDead< MCInst >(), MatchCoprocessorOperandName(), matchSVEPredicateVectorRegName(), llvm::MCParserUtils::parseAssignmentExpression(), parseEOL(), parseIntToken(), parseOptionalToken(), parseToken(), parseTokenLoc(), printMCExpr(), RefineErrorLoc(), and setRequiredFeatureString().
|
inline |
Definition at line 207 of file MCAsmParser.h.
References llvm::SmallVectorBase::empty().
|
pure virtual |
Get the next AsmToken in the stream, possibly handling file inclusion first.
Referenced by addErrorSuffix(), addNegOperand(), CheckBaseRegAndIndexRegAndScale(), checkScale(), convertFPR32ToFPR64(), getNextRegister(), getPrefixes(), hasGOTReference(), incrementLoc(), llvm::IsCPSRDead< MCInst >(), llvm::MCAsmParserExtension::Lex(), MatchCoprocessorOperandName(), matchSVEPredicateVectorRegName(), parseEOL(), parseIntToken(), parseToken(), RefineErrorLoc(), and setRequiredFeatureString().
|
pure virtual |
Emit a note at the location L, with the message Msg.
Referenced by llvm::MCAsmParserExtension::Note().
|
delete |
|
pure virtual |
Parse an expression which must evaluate to an absolute value.
| Res | - The value of the absolute expression. The result is undefined on error. |
Definition at line 43 of file MCAsmParser.cpp.
References llvm::AsmToken::EndOfStatement, Error(), getTok(), and Lex().
Referenced by getPrefixes(), and parseToken().
|
pure virtual |
Parse the current token as a string which may include escaped characters and return the string contents.
|
pure virtual |
Parse an arbitrary expression.
| Res | - The value of the expression. The result is undefined on error. |
Referenced by llvm::IsCPSRDead< MCInst >(), llvm::MCParserUtils::parseAssignmentExpression(), parseExpression(), printMCExpr(), and RefineErrorLoc().
Definition at line 127 of file MCAsmParser.cpp.
References parseExpression().
Parse an identifier or string (as a quoted identifier) and set Res to the identifier contents.
Referenced by getPrefixes(), llvm::IsCPSRDead< MCInst >(), printMCExpr(), and RefineErrorLoc().
Definition at line 59 of file MCAsmParser.cpp.
References llvm::AsmToken::getIntVal(), getTok(), llvm::AsmToken::Integer, Lex(), and TokError().
Referenced by getPrefixes().
| bool MCAsmParser::parseMany | ( | function_ref< bool()> | parseOne, |
| bool | hasComma = true |
||
| ) |
Definition at line 113 of file MCAsmParser.cpp.
References llvm::AsmToken::Comma, llvm::AsmToken::EndOfStatement, parseOptionalToken(), and parseToken().
Referenced by llvm::MCAsmParserExtension::parseMany().
|
pure virtual |
Parse MS-style inline assembly.
| bool MCAsmParser::parseOptionalToken | ( | AsmToken::TokenKind | T | ) |
Attempt to parse and consume token, returning true on success.
Definition at line 67 of file MCAsmParser.cpp.
References llvm::AsmToken::getKind(), getTok(), parseToken(), and T.
Referenced by llvm::IsCPSRDead< MCInst >(), parseMany(), and llvm::MCAsmParserExtension::parseOptionalToken().
|
pure virtual |
Parse an arbitrary expression, assuming that an initial '(' has already been consumed.
| Res | - The value of the expression. The result is undefined on error. |
Referenced by hasGOTReference().
|
pure virtual |
Parse an arbitrary expression of a specified parenthesis depth, assuming that the initial '(' characters have already been consumed.
| ParenDepth | - Specifies how many trailing expressions outside the current parentheses we have to parse. |
| Res | - The value of the expression. The result is undefined on error. |
|
pure virtual |
Parse a primary expression.
| Res | - The value of the expression. The result is undefined on error. |
|
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.
| bool MCAsmParser::parseToken | ( | AsmToken::TokenKind | T, |
| const Twine & | Msg = "unexpected token" |
||
| ) |
Definition at line 50 of file MCAsmParser.cpp.
References llvm::AsmToken::EndOfStatement, Error(), getTok(), Lex(), and parseEOL().
Referenced by llvm::IsCPSRDead< MCInst >(), llvm::MCParserUtils::parseAssignmentExpression(), parseMany(), parseOptionalToken(), and llvm::MCAsmParserExtension::parseToken().
Definition at line 38 of file MCAsmParser.cpp.
References llvm::AsmToken::getLoc(), and getTok().
|
pure virtual |
Emit an error at the location L, with the message Msg.
Referenced by makeCombineInst().
|
inline |
Definition at line 209 of file MCAsmParser.h.
References llvm::SmallVectorBase::empty().
|
pure virtual |
Run the parser on the input source buffer.
|
inlinevirtual |
Definition at line 164 of file MCAsmParser.h.
|
inline |
Definition at line 169 of file MCAsmParser.h.
|
pure virtual |
|
inline |
Definition at line 167 of file MCAsmParser.h.
| void MCAsmParser::setTargetParser | ( | MCTargetAsmParser & | P | ) |
Definition at line 28 of file MCAsmParser.cpp.
References assert(), llvm::MCAsmParserExtension::Initialize(), and P.
|
inline |
Definition at line 170 of file MCAsmParser.h.
References llvm::Error, llvm::None, llvm::Note, SI, and llvm::Warning.
Report an error at the current lexer location.
Definition at line 84 of file MCAsmParser.cpp.
References Error(), and getLexer().
Referenced by getPrefixes(), llvm::MCParserUtils::parseAssignmentExpression(), parseIntToken(), and llvm::MCAsmParserExtension::TokError().
|
pure virtual |
Emit a warning at the location L, with the message Msg.
Referenced by llvm::MCAsmParserExtension::Warning().
Enable print [latency:throughput] in output file.
Definition at line 134 of file MCAsmParser.h.
Flag tracking whether any errors have been encountered.
Definition at line 131 of file MCAsmParser.h.
|
protected |
Definition at line 128 of file MCAsmParser.h.
Referenced by addErrorSuffix(), and Error().
Definition at line 136 of file MCAsmParser.h.
1.8.13