9#ifndef LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
10#define LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
32template <
typename T>
class SmallVectorImpl;
77 StringRef offsetName, int64_t imm,
bool needBracs)
91 return (
Scale == 1) ||
108 bool Restricted =
false)
128 enum class StatusTy {
135#if __cplusplus >= 202002L
138 static constexpr StatusTy
Success = StatusTy::Success;
139 static constexpr StatusTy
Failure = StatusTy::Failure;
140 static constexpr StatusTy
NoMatch = StatusTy::NoMatch;
226 Result.Features = MissingFeatures;
236 Result.PredicateError = FailureCode;
246 unsigned OperandClass,
unsigned Opcode,
247 unsigned OperandIndex) {
250 Result.MissedOperand.Error = OperandError;
251 Result.MissedOperand.Class = OperandClass;
252 Result.MissedOperand.Opcode = Opcode;
253 Result.MissedOperand.Index = OperandIndex;
264 Result.TooFewOperands.Class = OperandClass;
265 Result.TooFewOperands.Opcode = Opcode;
312 struct MissedOpInfo {
319 struct TooFewOperandsInfo {
344 FIRST_TARGET_MATCH_RESULT_TY
358 bool ParsingMSInlineAsm =
false;
381 return AvailableFeatures;
384 AvailableFeatures =
Value;
393 SemaCallback = Callback;
398 return getParser().parsePrimaryExpr(Res, EndLoc,
nullptr);
404 return getParser().parseExpression(Res, EndLoc);
472 bool MatchingInlineAsm) = 0;
483 return Match_InvalidOperand;
490 return Match_Success;
496 return Match_Success;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static uint64_t scale(uint64_t Num, uint32_t N, uint32_t D)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Analysis containing CSE Info
mir Rename Register Operands
Target independent representation for an assembler token.
LLVM_ABI SMLoc getLoc() const
This class represents an Operation in the Expression.
Base class for user error types.
Lightweight error class with error context and mandatory checking.
Container class for subtarget features.
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
Generic Sema callback for assembly parser.
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
Instances of this class represent a single low-level machine instruction.
Interface to description of machine instruction set.
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand.
Wrapper class representing physical registers. Should be passed by value.
Streaming machine code generation interface.
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MCTargetAsmParser - Generic interface to target specific assembly parsers.
virtual bool tokenIsStartOfStatement(AsmToken::TokenKind Token)
virtual void onLabelParsed(MCSymbol *Symbol)
virtual bool parseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc, OperandVector &Operands)=0
Parse one assembly instruction.
const FeatureBitset & getAvailableFeatures() const
virtual void convertToMapAndConstraints(unsigned Kind, const OperandVector &Operands)=0
MCTargetOptions MCOptions
Set of options which affects instrumentation of inline assembly.
virtual const MCExpr * applySpecifier(const MCExpr *E, uint32_t, MCContext &Ctx)
virtual bool equalIsAsmAssignment()
@ Match_InvalidTiedOperand
virtual bool parseRegister(MCRegister &Reg, SMLoc &StartLoc, SMLoc &EndLoc)=0
virtual bool ParseDirective(AsmToken DirectiveID)
ParseDirective - Parse a target specific assembler directive This method is deprecated,...
void setParsingMSInlineAsm(bool Value)
virtual void onBeginOfFile()
virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc)
virtual bool omitRegisterFromClobberLists(MCRegister Reg)
Allows targets to let registers opt out of clobber lists.
virtual unsigned checkEarlyTargetMatchPredicate(MCInst &Inst, const OperandVector &Operands)
Validate the instruction match against any complex target predicates before rendering any operands to...
virtual bool parseDataExpr(const MCExpr *&Res)
virtual ParseStatus tryParseRegister(MCRegister &Reg, SMLoc &StartLoc, SMLoc &EndLoc)=0
tryParseRegister - parse one register if possible
virtual bool matchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, OperandVector &Operands, MCStreamer &Out, uint64_t &ErrorInfo, bool MatchingInlineAsm)=0
Recognize a series of operands of a parsed instruction as an actual MCInst and emit it to the specifi...
virtual void flushPendingInstructions(MCStreamer &Out)
Ensure that all previously parsed instructions have been emitted to the output streamer,...
bool isParsingMSInlineAsm()
virtual void onEndOfFile()
virtual bool isLabel(AsmToken &Token)
void setAvailableFeatures(const FeatureBitset &Value)
virtual bool parseInstruction(ParseInstructionInfo &Info, StringRef Name, AsmToken Token, OperandVector &Operands)
virtual void doBeforeLabelEmit(MCSymbol *Symbol, SMLoc IDLoc)
FeatureBitset AvailableFeatures
AvailableFeatures - The current set of available features.
void setSemaCallback(MCAsmParserSemaCallback *Callback)
MCTargetAsmParser(const MCTargetAsmParser &)=delete
virtual unsigned validateTargetOperandClass(MCParsedAsmOperand &Op, unsigned Kind)
Allow a target to add special case operand matching for things that tblgen doesn't/can't handle effec...
~MCTargetAsmParser() override
MCTargetAsmParser & operator=(const MCTargetAsmParser &)=delete
virtual unsigned checkTargetMatchPredicate(MCInst &Inst)
checkTargetMatchPredicate - Validate the instruction match against any complex target predicates not ...
MCTargetOptions getTargetOptions() const
const MCSubtargetInfo * STI
Current STI.
static NearMissInfo getMissedPredicate(unsigned FailureCode)
unsigned getOperandClass() const
static NearMissInfo getTooFewOperands(unsigned OperandClass, unsigned Opcode)
static NearMissInfo getMissedOperand(unsigned OperandError, unsigned OperandClass, unsigned Opcode, unsigned OperandIndex)
unsigned getOperandIndex() const
const FeatureBitset & getFeatures() const
NearMissKind getKind() const
static NearMissInfo getMissedFeature(const FeatureBitset &MissingFeatures)
TooFewOperandsInfo TooFewOperands
unsigned getOperandError() const
static NearMissInfo getSuccess()
unsigned getOpcode() const
unsigned getPredicateError() const
MissedOpInfo MissedOperand
Ternary parse status returned by various parse* methods.
constexpr bool isFailure() const
static constexpr StatusTy Failure
constexpr ParseStatus(bool Error)
constexpr ParseStatus(StatusTy Status)
constexpr bool isSuccess() const
static constexpr StatusTy Success
static constexpr StatusTy NoMatch
constexpr bool isNoMatch() const
constexpr ParseStatus(T)=delete
Represents a location in source code.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
const char AsmRewritePrecedence[]
AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len=0, int64_t val=0, bool Restricted=false)
AsmRewrite(SMLoc loc, unsigned len, IntelExpr exp)
AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len, StringRef label)
constexpr DiagnosticPredicate(bool Matches)
enum llvm::DiagnosticPredicate::PredicateTy Predicate
constexpr bool isMatch() const
constexpr DiagnosticPredicate(PredicateTy T)
constexpr bool isNoMatch() const
constexpr bool isNearMatch() const
IntelExpr(StringRef baseReg, StringRef indexReg, unsigned scale, StringRef offsetName, int64_t imm, bool needBracs)
ParseInstructionInfo(SmallVectorImpl< AsmRewrite > *rewrites)
ParseInstructionInfo()=default
SmallVectorImpl< AsmRewrite > * AsmRewrites