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:124

Member Variables

private llvm::MCTargetAsmParser* TargetParser = nullptr
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:225

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:250

MCAsmParser(const llvm::MCAsmParser&)

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

Parameters

const llvm::MCAsmParser&

MCAsmParser()

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

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:213

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:181

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:256

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:218

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:157

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:154

Parameters

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

bool addErrorSuffix(const llvm::Twine& Suffix)

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

Parameters

const llvm::Twine& Suffix

bool check(bool P,
           llvm::SMLoc Loc,
           const llvm::Twine& Msg)

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

Parameters

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

bool check(bool P, const llvm::Twine& Msg)

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

Parameters

bool P
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:330

Returns

- False on success.

void clearPendingErrors()

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

virtual bool defineMacro(llvm::StringRef Name,
                         llvm::StringRef Value)

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

Parameters

llvm::StringRef Name
llvm::StringRef Value

virtual bool discardLTOSymbol(
    llvm::StringRef) const

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

Parameters

llvm::StringRef

virtual void eatToEndOfStatement()

Description

Skip to the end of the current statement, for error recovery.

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

virtual unsigned int getAssemblerDialect()

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

virtual llvm::MCContext& getContext()

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

virtual llvm::MCAsmLexer& getLexer()

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

const llvm::MCAsmLexer& getLexer() const

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

bool getShowParsedOperands() const

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

virtual llvm::SourceMgr& getSourceManager()

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

virtual llvm::MCStreamer& getStreamer()

Description

Return the output streamer for the assembler.

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

llvm::MCTargetAsmParser& getTargetParser() const

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

const llvm::AsmToken& getTok() const

Description

Get the current AsmToken from the stream.

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

bool hasPendingError()

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

virtual bool isParsingMSInlineAsm()

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

virtual bool isParsingMasm() const

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

virtual bool lookUpField(
    llvm::StringRef Base,
    llvm::StringRef Member,
    llvm::AsmFieldInfo& Info) const

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

Parameters

llvm::StringRef Base
llvm::StringRef Member
llvm::AsmFieldInfo& Info

virtual bool lookUpField(
    llvm::StringRef Name,
    llvm::AsmFieldInfo& Info) const

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

Parameters

llvm::StringRef Name
llvm::AsmFieldInfo& Info

virtual bool lookUpType(
    llvm::StringRef Name,
    llvm::AsmTypeInfo& Info) const

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

Parameters

llvm::StringRef Name
llvm::AsmTypeInfo& Info

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:325

Parameters

int64_t& Res
- The value of the absolute expression. The result is undefined on error.

Returns

- False on success.

virtual bool parseAngleBracketString(
    std::string& Data)

Description

Parse an angle-bracket delimited string at the current position if one is present, returning the string contents.

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

Parameters

std::string& Data

bool parseComma()

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

bool parseEOL(const llvm::Twine& ErrMsg)

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

Parameters

const llvm::Twine& ErrMsg

bool parseEOL()

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

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:287

Parameters

std::string& Data

bool parseExpression(const llvm::MCExpr*& Res)

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

Parameters

const llvm::MCExpr*& Res

virtual bool parseExpression(
    const llvm::MCExpr*& Res,
    llvm::SMLoc& EndLoc)

Description

Parse an arbitrary expression.

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

Parameters

const llvm::MCExpr*& Res
- The value of the expression. The result is undefined on error.
llvm::SMLoc& EndLoc

Returns

- False on success.

bool parseGNUAttribute(llvm::SMLoc L,
                       int64_t& Tag,
                       int64_t& IntegerValue)

Description

Parse a .gnu_attribute.

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

Parameters

llvm::SMLoc L
int64_t& Tag
int64_t& IntegerValue

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:278

Parameters

llvm::StringRef& Res

bool parseIntToken(int64_t& V,
                   const llvm::Twine& ErrMsg)

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

Parameters

int64_t& V
const llvm::Twine& ErrMsg

virtual bool parseMSInlineAsm(
    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:205

Parameters

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:269

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:262

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:340

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:318

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,
    llvm::AsmTypeInfo* TypeInfo)

Description

Parse a primary expression.

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

Parameters

const llvm::MCExpr*& Res
- The value of the expression. The result is undefined on error.
llvm::SMLoc& EndLoc
llvm::AsmTypeInfo* TypeInfo

Returns

- False on success.

bool parseRParen()

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

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:283

bool parseToken(
    AsmToken::TokenKind T,
    const llvm::Twine& Msg = "unexpected token")

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

Parameters

AsmToken::TokenKind T
const llvm::Twine& Msg = "unexpected token"

bool parseTokenLoc(llvm::SMLoc& Loc)

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

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:231

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:235

virtual void setAssemblerDialect(unsigned int i)

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

Parameters

unsigned int i

virtual void setParsingMSInlineAsm(bool V)

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

Parameters

bool V

void setShowParsedOperands(bool Value)

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

Parameters

bool Value

void setTargetParser(llvm::MCTargetAsmParser& P)

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

Parameters

llvm::MCTargetAsmParser& P

virtual ~MCAsmParser()

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