12#include "llvm/Config/llvm-config.h"
28 cl::desc(
"The maximum nesting depth allowed for assembly macros."));
33 : Ctx(Ctx), Out(Out),
SrcMgr(SM), MAI(MAI), Lexer(MAI) {}
38 assert(!TargetParser &&
"Target parser is already initialized!");
54 return Error(
getTok().getLoc(),
"expected newline");
96 return Error(Loc, Msg);
148 int64_t &IntegerValue) {
168#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
const AsmToken & getTok() const
Get the current (last) lexed token.
const AsmToken & Lex()
Consume the next token from the input stream and return it.
Target independent representation for an assembler token.
LLVM_ABI SMLoc getLoc() const
int64_t getIntVal() const
bool isNot(TokenKind K) const
TokenKind getKind() const
Lightweight error class with error context and mandatory checking.
This class is intended to be used as a base class for asm properties and features specific to the tar...
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
bool parseMany(function_ref< bool()> parseOne, bool hasComma=true)
bool parseToken(AsmToken::TokenKind T, const Twine &Msg="unexpected token")
bool addErrorSuffix(const Twine &Suffix)
bool check(bool P, const Twine &Msg)
bool parseIntToken(int64_t &V, const Twine &ErrMsg="expected integer")
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
const AsmToken & getTok() const
Get the current AsmToken from the stream.
SmallVector< MCPendingError, 0 > PendingErrors
MCAsmParser(MCContext &, MCStreamer &, SourceMgr &, const MCAsmInfo &)
bool parseOptionalToken(AsmToken::TokenKind T)
Attempt to parse and consume token, returning true on success.
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
bool TokError(const Twine &Msg, SMRange Range=std::nullopt)
Report an error at the current lexer location.
bool parseTokenLoc(SMLoc &Loc)
bool parseGNUAttribute(SMLoc L, int64_t &Tag, int64_t &IntegerValue)
Parse a .gnu_attribute.
void setTargetParser(MCTargetAsmParser &P)
bool Error(SMLoc L, const Twine &Msg, SMRange Range=std::nullopt)
Return an error at the location L, with the message Msg.
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
virtual void dump() const
dump - Print to the debug stream.
virtual void print(raw_ostream &, const MCAsmInfo &) const =0
print - Print a debug representation of the operand to the given stream.
Streaming machine code generation interface.
MCTargetAsmParser - Generic interface to target specific assembly parsers.
Represents a location in source code.
Represents a range in source code.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_ABI void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
An efficient, type-erasing, non-owning reference to a callable.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
cl::opt< unsigned > AsmMacroMaxNestingDepth
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.