10 #ifndef LLVM_MC_MCPARSER_MCASMPARSER_H
11 #define LLVM_MC_MCPARSER_MCASMPARSER_H
18 #include "llvm/Support/DataTypes.h"
23 class MCAsmParserExtension;
29 class MCTargetAsmParser;
56 bool IsUnevaluatedContext) = 0;
58 SMLoc Location,
bool Create) = 0;
69 typedef std::pair<MCAsmParserExtension*, DirectiveHandler>
84 unsigned ShowParsedOperands : 1;
124 virtual bool Run(
bool NoInitialTextSection,
bool NoFinalize =
false) = 0;
131 void *AsmLoc, std::string &AsmString,
unsigned &NumOutputs,
132 unsigned &NumInputs,
SmallVectorImpl<std::pair<void *, bool>> &OpDecls,
165 PendingErrors.clear();
Represents a range in source code.
bool addErrorSuffix(const Twine &Suffix)
virtual ~MCAsmParserSemaCallback()
virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range=None)=0
Emit a warning at the location L, with the message Msg.
Generic assembler parser interface, for use by target specific assembly parsers.
virtual void setAssemblerDialect(unsigned i)
MCTargetAsmParser - Generic interface to target specific assembly parsers.
virtual bool checkForValidSection()=0
Ensure that we have a valid section set in the streamer.
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
virtual SourceMgr & getSourceManager()=0
bool parseIntToken(int64_t &V, const Twine &ErrMsg)
virtual void * LookupInlineAsmIdentifier(StringRef &LineBuf, InlineAsmIdentifierInfo &Info, bool IsUnevaluatedContext)=0
MCTargetAsmParser & getTargetParser() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Generic assembler lexer interface, for use by target specific assembly lexers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range=None)=0
Emit an error at the location L, with the message Msg.
Base class for the full range of assembler expressions which are needed for parsing.
bool printPendingErrors()
Target independent representation for an assembler token.
virtual void addDirectiveHandler(StringRef Directive, ExtensionDirectiveHandler Handler)=0
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
Context object for machine code objects.
void setShowParsedOperands(bool Value)
bool parseMany(std::function< bool()> parseOne, bool hasComma=true)
virtual bool parseEscapedString(std::string &Data)=0
Parse the current token as a string which may include escaped characters and return the string conten...
const AsmToken & getTok() const
Get the current AsmToken from the stream.
virtual void eatToEndOfStatement()=0
Skip to the end of the current statement, for error recovery.
virtual void addAliasForDirective(StringRef Directive, StringRef Alias)=0
bool parseToken(AsmToken::TokenKind T, const Twine &Msg="unexpected token")
virtual MCContext & getContext()=0
Streaming machine code generation interface.
virtual ~MCAsmParser()
Flag tracking whether any errors have been encountered.
The instances of the Type class are immutable: once they are created, they are never changed...
virtual bool isParsingInlineAsm()=0
virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse a primary expression.
const MCAsmLexer & getLexer() const
Interface to description of machine instruction set.
virtual bool Run(bool NoInitialTextSection, bool NoFinalize=false)=0
Run the parser on the input source buffer.
virtual MCAsmLexer & getLexer()=0
MCAsmParser * createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &, const MCAsmInfo &)
Create an MCAsmParser instance.
bool parseTokenLoc(SMLoc &Loc)
Generic Sema callback for assembly parser.
bool Error(SMLoc L, const Twine &Msg, SMRange Range=None)
Return an error at the location L, with the message Msg.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
std::pair< MCAsmParserExtension *, DirectiveHandler > ExtensionDirectiveHandler
virtual StringRef parseStringToEndOfStatement()=0
Parse up to the end of statement and return the contents from the current token until the end of the ...
virtual bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset)=0
virtual void setParsingInlineAsm(bool V)=0
virtual MCStreamer & getStreamer()=0
Return the output streamer for the assembler.
virtual bool parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression of a specified parenthesis depth, assuming that the initial '(' charact...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
SmallVector< MCPendingError, 1 > PendingErrors
bool check(bool P, const llvm::Twine &Msg)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
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.
virtual StringRef LookupInlineAsmLabel(StringRef Identifier, SourceMgr &SM, SMLoc Location, bool Create)=0
bool(* DirectiveHandler)(MCAsmParserExtension *, StringRef, SMLoc)
virtual bool parseAbsoluteExpression(int64_t &Res)=0
Parse an expression which must evaluate to an absolute value.
virtual unsigned getAssemblerDialect()
virtual void Note(SMLoc L, const Twine &Msg, SMRange Range=None)=0
Emit a note at the location L, with the message Msg.
bool TokError(const Twine &Msg, SMRange Range=None)
Report an error at the current lexer location.
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
LLVM Value Representation.
bool parseEOL(const Twine &ErrMsg)
void setTargetParser(MCTargetAsmParser &P)
bool parseOptionalToken(AsmToken::TokenKind T)
Attempt to parse and consume token, returning true on success.
print Print MemDeps of function
StringRef - Represent a constant reference to a string, i.e.
virtual bool parseIdentifier(StringRef &Res)=0
Parse an identifier or string (as a quoted identifier) and set Res to the identifier contents...
bool getShowParsedOperands() const
Represents a location in source code.
virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression, assuming that an initial '(' has already been consumed.