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

Methods

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()

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&)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:135

Parameters

const llvm::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)

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)

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)

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)

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)

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)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:139

Parameters

llvm::StringRef Directive
llvm::MCAsmParser::ExtensionDirectiveHandler Handler

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)

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)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:238

Parameters

bool P
llvm::SMLoc Loc
const llvm::Twine& Msg

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()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:211

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()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:159

virtual llvm::MCContext& getContext()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:151

const llvm::MCAsmLexer& getLexer() const

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:147

virtual llvm::MCAsmLexer& getLexer()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:146

bool getShowParsedOperands() const

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:162

virtual llvm::SourceMgr& getSourceManager()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:144

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

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:156

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()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:200

virtual bool isParsingInlineAsm()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:169

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)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:231

Parameters

const llvm::Twine& ErrMsg

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)

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)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:262

Parameters

const llvm::MCExpr*& 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)

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)

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)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:233

Parameters

function_ref<bool()> parseOne
bool hasComma = true

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)

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)

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)

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()

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")

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)

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)

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()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:202

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)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:168

Parameters

bool V

void setShowParsedOperands(bool Value)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:163

Parameters

bool Value

void setTargetParser(llvm::MCTargetAsmParser& P)

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:157

Parameters

llvm::MCTargetAsmParser& P

virtual ~MCAsmParser()

Declared at: llvm/include/llvm/MC/MCParser/MCAsmParser.h:137