class MCAsmParser
Declaration
class MCAsmParser { /* full declaration omitted */ };
Description
Generic assembler parser interface, for use by target specific assembly parsers.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:109
Member Variables
- protected SmallVector<llvm::MCAsmParser::MCPendingError, 0> PendingErrors
- protected bool HadError = false
- Flag tracking whether any errors have been encountered.
- protected bool ShowParsedOperands = false
Method Overview
- public bool Error(llvm::SMLoc L, const llvm::Twine & Msg, llvm::SMRange Range = None)
- public virtual const llvm::AsmToken & Lex()
- public MCAsmParser(const llvm::MCAsmParser &)
- protected MCAsmParser()
- public virtual void Note(llvm::SMLoc L, const llvm::Twine & Msg, llvm::SMRange Range = None)
- public virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false)
- public bool TokError(const llvm::Twine & Msg, llvm::SMRange Range = None)
- public virtual bool Warning(llvm::SMLoc L, const llvm::Twine & Msg, llvm::SMRange Range = None)
- public virtual void addAliasForDirective(llvm::StringRef Directive, llvm::StringRef Alias)
- public virtual void addDirectiveHandler(llvm::StringRef Directive, llvm::MCAsmParser::ExtensionDirectiveHandler Handler)
- public bool addErrorSuffix(const llvm::Twine & Suffix)
- public bool check(bool P, const llvm::Twine & Msg)
- public bool check(bool P, llvm::SMLoc Loc, const llvm::Twine & Msg)
- public virtual bool checkForValidSection()
- public void clearPendingErrors()
- public virtual void eatToEndOfStatement()
- public virtual unsigned int getAssemblerDialect()
- public virtual llvm::MCContext & getContext()
- public const llvm::MCAsmLexer & getLexer() const
- public virtual llvm::MCAsmLexer & getLexer()
- public bool getShowParsedOperands() const
- public virtual llvm::SourceMgr & getSourceManager()
- public virtual llvm::MCStreamer & getStreamer()
- public llvm::MCTargetAsmParser & getTargetParser() const
- public const llvm::AsmToken & getTok() const
- public bool hasPendingError()
- public virtual bool isParsingInlineAsm()
- public virtual bool parseAbsoluteExpression(int64_t & Res)
- public bool parseEOL(const llvm::Twine & ErrMsg)
- public virtual bool parseEscapedString(std::string & Data)
- public virtual bool parseExpression(const llvm::MCExpr *& Res, llvm::SMLoc & EndLoc)
- public bool parseExpression(const llvm::MCExpr *& Res)
- public virtual bool parseIdentifier(llvm::StringRef & Res)
- public bool parseIntToken(int64_t & V, const llvm::Twine & ErrMsg)
- public virtual bool parseMSInlineAsm(void * AsmLoc, std::string & AsmString, unsigned int & NumOutputs, unsigned int & NumInputs, SmallVectorImpl<std::pair<void *, bool>> & OpDecls, SmallVectorImpl<std::string> & Constraints, SmallVectorImpl<std::string> & Clobbers, const llvm::MCInstrInfo * MII, const llvm::MCInstPrinter * IP, llvm::MCAsmParserSemaCallback & SI)
- public bool parseMany(function_ref<bool ()> parseOne, bool hasComma = true)
- public bool parseOptionalToken(AsmToken::TokenKind T)
- public virtual bool parseParenExprOfDepth(unsigned int ParenDepth, const llvm::MCExpr *& Res, llvm::SMLoc & EndLoc)
- public virtual bool parseParenExpression(const llvm::MCExpr *& Res, llvm::SMLoc & EndLoc)
- public virtual bool parsePrimaryExpr(const llvm::MCExpr *& Res, llvm::SMLoc & EndLoc)
- public virtual llvm::StringRef parseStringToEndOfStatement()
- public bool parseToken(AsmToken::TokenKind T, const llvm::Twine & Msg = "unexpected token")
- public bool parseTokenLoc(llvm::SMLoc & Loc)
- public virtual bool printError(llvm::SMLoc L, const llvm::Twine & Msg, llvm::SMRange Range = None)
- public bool printPendingErrors()
- public virtual void setAssemblerDialect(unsigned int i)
- public virtual void setParsingInlineAsm(bool V)
- public void setShowParsedOperands(bool Value)
- public void setTargetParser(llvm::MCTargetAsmParser & P)
- public virtual ~MCAsmParser()
Methods
¶bool Error(llvm::SMLoc L,
const llvm::Twine& Msg,
llvm::SMRange Range = None)
bool Error(llvm::SMLoc L,
const llvm::Twine& Msg,
llvm::SMRange Range = None)
Description
Return an error at the location \p L, with the message \p Msg. This may be modified before being emitted.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:192
Parameters
- llvm::SMLoc L
- const llvm::Twine& Msg
- llvm::SMRange Range = None
Returns
The return value is always true, as an idiomatic convenience to clients.
¶virtual const llvm::AsmToken& Lex()
virtual const llvm::AsmToken& Lex()
Description
Get the next AsmToken in the stream, possibly handling file inclusion first.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:217
¶MCAsmParser(const llvm::MCAsmParser&)
MCAsmParser(const llvm::MCAsmParser&)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:135
Parameters
- const llvm::MCAsmParser&
¶MCAsmParser()
MCAsmParser()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:125
¶virtual void Note(llvm::SMLoc L,
const llvm::Twine& Msg,
llvm::SMRange Range = None)
virtual void Note(llvm::SMLoc L,
const llvm::Twine& Msg,
llvm::SMRange Range = None)
Description
Emit a note at the location \p L, with the message \p Msg.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:180
Parameters
- llvm::SMLoc L
- const llvm::Twine& Msg
- llvm::SMRange Range = None
¶virtual bool Run(bool NoInitialTextSection,
bool NoFinalize = false)
virtual bool Run(bool NoInitialTextSection,
bool NoFinalize = false)
Description
Run the parser on the input source buffer.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:166
Parameters
- bool NoInitialTextSection
- bool NoFinalize = false
¶bool TokError(const llvm::Twine& Msg,
llvm::SMRange Range = None)
bool TokError(const llvm::Twine& Msg,
llvm::SMRange Range = None)
Description
Report an error at the current lexer location.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:223
Parameters
- const llvm::Twine& Msg
- llvm::SMRange Range = None
¶virtual bool Warning(llvm::SMLoc L,
const llvm::Twine& Msg,
llvm::SMRange Range = None)
virtual bool Warning(llvm::SMLoc L,
const llvm::Twine& Msg,
llvm::SMRange Range = None)
Description
Emit a warning at the location \p L, with the message \p Msg.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:185
Parameters
- llvm::SMLoc L
- const llvm::Twine& Msg
- llvm::SMRange Range = None
Returns
The return value is true, if warnings are fatal.
¶virtual void addAliasForDirective(
llvm::StringRef Directive,
llvm::StringRef Alias)
virtual void addAliasForDirective(
llvm::StringRef Directive,
llvm::StringRef Alias)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:142
Parameters
- llvm::StringRef Directive
- llvm::StringRef Alias
¶virtual void addDirectiveHandler(
llvm::StringRef Directive,
llvm::MCAsmParser::ExtensionDirectiveHandler
Handler)
virtual void addDirectiveHandler(
llvm::StringRef Directive,
llvm::MCAsmParser::ExtensionDirectiveHandler
Handler)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:139
Parameters
- llvm::StringRef Directive
- llvm::MCAsmParser::ExtensionDirectiveHandler Handler
¶bool addErrorSuffix(const llvm::Twine& Suffix)
bool addErrorSuffix(const llvm::Twine& Suffix)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:213
Parameters
- const llvm::Twine& Suffix
¶bool check(bool P, const llvm::Twine& Msg)
bool check(bool P, const llvm::Twine& Msg)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:237
Parameters
- bool P
- const llvm::Twine& Msg
¶bool check(bool P,
llvm::SMLoc Loc,
const llvm::Twine& Msg)
bool check(bool P,
llvm::SMLoc Loc,
const llvm::Twine& Msg)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:238
Parameters
- bool P
- llvm::SMLoc Loc
- const llvm::Twine& Msg
¶virtual bool checkForValidSection()
virtual bool checkForValidSection()
Description
Ensure that we have a valid section set in the streamer. Otherwise, report an error and switch to .text.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:289
Returns
- False on success.
¶void clearPendingErrors()
void clearPendingErrors()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:211
¶virtual void eatToEndOfStatement()
virtual void eatToEndOfStatement()
Description
Skip to the end of the current statement, for error recovery.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:254
¶virtual unsigned int getAssemblerDialect()
virtual unsigned int getAssemblerDialect()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:159
¶virtual llvm::MCContext& getContext()
virtual llvm::MCContext& getContext()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:151
¶const llvm::MCAsmLexer& getLexer() const
const llvm::MCAsmLexer& getLexer() const
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:147
¶virtual llvm::MCAsmLexer& getLexer()
virtual llvm::MCAsmLexer& getLexer()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:146
¶bool getShowParsedOperands() const
bool getShowParsedOperands() const
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:162
¶virtual llvm::SourceMgr& getSourceManager()
virtual llvm::SourceMgr& getSourceManager()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:144
¶virtual llvm::MCStreamer& getStreamer()
virtual llvm::MCStreamer& getStreamer()
Description
Return the output streamer for the assembler.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:154
¶llvm::MCTargetAsmParser& getTargetParser() const
llvm::MCTargetAsmParser& getTargetParser() const
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:156
¶const llvm::AsmToken& getTok() const
const llvm::AsmToken& getTok() const
Description
Get the current AsmToken from the stream.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:220
¶bool hasPendingError()
bool hasPendingError()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:200
¶virtual bool isParsingInlineAsm()
virtual bool isParsingInlineAsm()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:169
¶virtual bool parseAbsoluteExpression(int64_t& Res)
virtual bool parseAbsoluteExpression(int64_t& Res)
Description
Parse an expression which must evaluate to an absolute value.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:284
Parameters
- int64_t& Res
- - The value of the absolute expression. The result is undefined on error.
Returns
- False on success.
¶bool parseEOL(const llvm::Twine& ErrMsg)
bool parseEOL(const llvm::Twine& ErrMsg)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:231
Parameters
- const llvm::Twine& ErrMsg
¶virtual bool parseEscapedString(std::string& Data)
virtual bool parseEscapedString(std::string& Data)
Description
Parse the current token as a string which may include escaped characters and return the string contents.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:251
Parameters
- std::string& Data
¶virtual bool parseExpression(
const llvm::MCExpr*& Res,
llvm::SMLoc& EndLoc)
virtual bool parseExpression(
const llvm::MCExpr*& Res,
llvm::SMLoc& EndLoc)
Description
Parse an arbitrary expression.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:261
Parameters
- const llvm::MCExpr*& Res
- - The value of the expression. The result is undefined on error.
- llvm::SMLoc& EndLoc
Returns
- False on success.
¶bool parseExpression(const llvm::MCExpr*& Res)
bool parseExpression(const llvm::MCExpr*& Res)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:262
Parameters
- const llvm::MCExpr*& Res
¶virtual bool parseIdentifier(llvm::StringRef& Res)
virtual bool parseIdentifier(llvm::StringRef& Res)
Description
Parse an identifier or string (as a quoted identifier) and set \p Res to the identifier contents.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:242
Parameters
- llvm::StringRef& Res
¶bool parseIntToken(int64_t& V,
const llvm::Twine& ErrMsg)
bool parseIntToken(int64_t& V,
const llvm::Twine& ErrMsg)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:235
Parameters
- int64_t& V
- const llvm::Twine& ErrMsg
¶virtual bool parseMSInlineAsm(
void* AsmLoc,
std::string& AsmString,
unsigned int& NumOutputs,
unsigned int& NumInputs,
SmallVectorImpl<std::pair<void*, bool>>&
OpDecls,
SmallVectorImpl<std::string>& Constraints,
SmallVectorImpl<std::string>& Clobbers,
const llvm::MCInstrInfo* MII,
const llvm::MCInstPrinter* IP,
llvm::MCAsmParserSemaCallback& SI)
virtual bool parseMSInlineAsm(
void* AsmLoc,
std::string& AsmString,
unsigned int& NumOutputs,
unsigned int& NumInputs,
SmallVectorImpl<std::pair<void*, bool>>&
OpDecls,
SmallVectorImpl<std::string>& Constraints,
SmallVectorImpl<std::string>& Clobbers,
const llvm::MCInstrInfo* MII,
const llvm::MCInstPrinter* IP,
llvm::MCAsmParserSemaCallback& SI)
Description
Parse MS-style inline assembly.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:172
Parameters
- void* AsmLoc
- std::string& AsmString
- unsigned int& NumOutputs
- unsigned int& NumInputs
- SmallVectorImpl<std::pair<void*, bool>>& OpDecls
- SmallVectorImpl<std::string>& Constraints
- SmallVectorImpl<std::string>& Clobbers
- const llvm::MCInstrInfo* MII
- const llvm::MCInstPrinter* IP
- llvm::MCAsmParserSemaCallback& SI
¶bool parseMany(function_ref<bool()> parseOne,
bool hasComma = true)
bool parseMany(function_ref<bool()> parseOne,
bool hasComma = true)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:233
Parameters
- function_ref<bool()> parseOne
- bool hasComma = true
¶bool parseOptionalToken(AsmToken::TokenKind T)
bool parseOptionalToken(AsmToken::TokenKind T)
Description
Attempt to parse and consume token, returning true on success.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:229
Parameters
- AsmToken::TokenKind T
¶virtual bool parseParenExprOfDepth(
unsigned int ParenDepth,
const llvm::MCExpr*& Res,
llvm::SMLoc& EndLoc)
virtual bool parseParenExprOfDepth(
unsigned int ParenDepth,
const llvm::MCExpr*& Res,
llvm::SMLoc& EndLoc)
Description
Parse an arbitrary expression of a specified parenthesis depth, assuming that the initial '(' characters have already been consumed.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:299
Parameters
- unsigned int ParenDepth
- - Specifies how many trailing expressions outside the current parentheses we have to parse.
- const llvm::MCExpr*& Res
- - The value of the expression. The result is undefined on error.
- llvm::SMLoc& EndLoc
Returns
- False on success.
¶virtual bool parseParenExpression(
const llvm::MCExpr*& Res,
llvm::SMLoc& EndLoc)
virtual bool parseParenExpression(
const llvm::MCExpr*& Res,
llvm::SMLoc& EndLoc)
Description
Parse an arbitrary expression, assuming that an initial '(' has already been consumed.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:277
Parameters
- const llvm::MCExpr*& Res
- - The value of the expression. The result is undefined on error.
- llvm::SMLoc& EndLoc
Returns
- False on success.
¶virtual bool parsePrimaryExpr(
const llvm::MCExpr*& Res,
llvm::SMLoc& EndLoc)
virtual bool parsePrimaryExpr(
const llvm::MCExpr*& Res,
llvm::SMLoc& EndLoc)
Description
Parse a primary expression.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:269
Parameters
- const llvm::MCExpr*& Res
- - The value of the expression. The result is undefined on error.
- llvm::SMLoc& EndLoc
Returns
- False on success.
¶virtual llvm::StringRef
parseStringToEndOfStatement()
virtual llvm::StringRef
parseStringToEndOfStatement()
Description
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.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:247
¶bool parseToken(
AsmToken::TokenKind T,
const llvm::Twine& Msg = "unexpected token")
bool parseToken(
AsmToken::TokenKind T,
const llvm::Twine& Msg = "unexpected token")
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:226
Parameters
- AsmToken::TokenKind T
- const llvm::Twine& Msg = "unexpected token"
¶bool parseTokenLoc(llvm::SMLoc& Loc)
bool parseTokenLoc(llvm::SMLoc& Loc)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:225
Parameters
- llvm::SMLoc& Loc
¶virtual bool printError(
llvm::SMLoc L,
const llvm::Twine& Msg,
llvm::SMRange Range = None)
virtual bool printError(
llvm::SMLoc L,
const llvm::Twine& Msg,
llvm::SMRange Range = None)
Description
Emit an error at the location \p L, with the message \p Msg.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:198
Parameters
- llvm::SMLoc L
- const llvm::Twine& Msg
- llvm::SMRange Range = None
Returns
The return value is always true, as an idiomatic convenience to clients.
¶bool printPendingErrors()
bool printPendingErrors()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:202
¶virtual void setAssemblerDialect(unsigned int i)
virtual void setAssemblerDialect(unsigned int i)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:160
Parameters
- unsigned int i
¶virtual void setParsingInlineAsm(bool V)
virtual void setParsingInlineAsm(bool V)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:168
Parameters
- bool V
¶void setShowParsedOperands(bool Value)
void setShowParsedOperands(bool Value)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:163
Parameters
- bool Value
¶void setTargetParser(llvm::MCTargetAsmParser& P)
void setTargetParser(llvm::MCTargetAsmParser& P)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:157
Parameters
¶virtual ~MCAsmParser()
virtual ~MCAsmParser()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:137