9 #ifndef LLVM_MC_MCPARSER_MCTARGETASMPARSER_H 10 #define LLVM_MC_MCPARSER_MCTARGETASMPARSER_H 27 class MCParsedAsmOperand;
29 class MCSubtargetInfo;
30 template <
typename T>
class SmallVectorImpl;
77 StringRef offsetName, int64_t imm,
bool needBracs)
78 : NeedBracs(needBracs), Imm(imm), BaseReg(baseReg), IndexReg(indexReg),
79 OffsetName(offsetName), Scale(1) {
91 return (Scale == 1) ||
92 (
hasIndexReg() && (Scale == 2 || Scale == 4 || Scale == 8));
107 : Kind(kind), Loc(loc), Len(len), Done(
false), Val(val) {}
109 :
AsmRewrite(kind, loc, len) { Label = label; }
119 : AsmRewrites(rewrites) {}
200 Result.Kind = NearMissFeature;
210 Result.Kind = NearMissPredicate;
221 unsigned OperandClass,
unsigned Opcode,
222 unsigned OperandIndex) {
224 Result.Kind = NearMissOperand;
238 Result.Kind = NearMissTooFewOperands;
244 operator bool()
const {
return Kind != NoNearMiss; }
258 return PredicateError;
262 assert(
Kind == NearMissOperand ||
Kind == NearMissTooFewOperands);
263 return MissedOperand.Class;
267 assert(
Kind == NearMissOperand ||
Kind == NearMissTooFewOperands);
268 return MissedOperand.Opcode;
273 return MissedOperand.Error;
279 return MissedOperand.Index;
287 struct MissedOpInfo {
294 struct TooFewOperandsInfo {
319 FIRST_TARGET_MATCH_RESULT_TY
333 bool ParsingInlineAsm =
false;
356 return AvailableFeatures;
359 AvailableFeatures =
Value;
368 SemaCallback = Callback;
373 return getParser().parsePrimaryExpr(Res, EndLoc);
376 virtual bool ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
409 virtual bool ParseDirective(
AsmToken DirectiveID) = 0;
417 virtual bool MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
420 bool MatchingInlineAsm) = 0;
431 return Match_InvalidOperand;
438 return Match_Success;
444 return Match_Success;
447 virtual void convertToMapAndConstraints(
unsigned Kind,
493 #endif // LLVM_MC_MCPARSER_MCTARGETASMPARSER_H virtual bool isLabel(AsmToken &Token)
MCAsmParserSemaCallback * SemaCallback
SemaCallback - The Sema callback implementation.
This class represents lattice values for constants.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
virtual unsigned checkEarlyTargetMatchPredicate(MCInst &Inst, const OperandVector &Operands)
Validate the instruction match against any complex target predicates before rendering any operands to...
virtual bool regsEqual(const MCParsedAsmOperand &Op1, const MCParsedAsmOperand &Op2) const
Returns whether two registers are equal and is used by the tied-operands checks in the AsmMatcher...
const FeatureBitset & getFeatures() const
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
MCTargetAsmParser - Generic interface to target specific assembly parsers.
const MCSubtargetInfo * STI
Current STI.
static NearMissInfo getMissedOperand(unsigned OperandError, unsigned OperandClass, unsigned Opcode, unsigned OperandIndex)
ParseInstructionInfo(SmallVectorImpl< AsmRewrite > *rewrites)
virtual void onLabelParsed(MCSymbol *Symbol)
static NearMissInfo getMissedFeature(const FeatureBitset &MissingFeatures)
unsigned getOperandClass() const
AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len, StringRef label)
MCTargetOptions MCOptions
Set of options which affects instrumentation of inline assembly.
unsigned getOpcode() const
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...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
DiagnosticPredicate(DiagnosticPredicateTy T)
DiagnosticPredicate(bool Match)
Target independent representation for an assembler token.
mir Rename Register Operands
const FeatureBitset & getAvailableFeatures() const
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
static NearMissInfo getTooFewOperands(unsigned OperandClass, unsigned Opcode)
Context object for machine code objects.
unsigned getPredicateError() const
Instances of this class represent a single low-level machine instruction.
Analysis containing CSE Info
Streaming machine code generation interface.
virtual bool OmitRegisterFromClobberLists(unsigned RegNo)
Allows targets to let registers opt out of clobber lists.
Container class for subtarget features.
void setAvailableFeatures(const FeatureBitset &Value)
MissedOpInfo MissedOperand
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static NearMissInfo getMissedPredicate(unsigned FailureCode)
void setSemaCallback(MCAsmParserSemaCallback *Callback)
Interface to description of machine instruction set.
virtual void onEndOfFile()
virtual unsigned checkTargetMatchPredicate(MCInst &Inst)
checkTargetMatchPredicate - Validate the instruction match against any complex target predicates not ...
void setParsingInlineAsm(bool Value)
static uint64_t scale(uint64_t Num, uint32_t N, uint32_t D)
Generic Sema callback for assembly parser.
virtual bool starIsStartOfStatement()
virtual unsigned getReg() const =0
virtual bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name, AsmToken Token, OperandVector &Operands)
virtual bool equalIsAsmAssignment()
virtual const MCExpr * createTargetUnaryExpr(const MCExpr *E, AsmToken::TokenKind OperatorToken, MCContext &Ctx)
DiagnosticPredicateTy Type
static NearMissInfo getSuccess()
AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len=0, int64_t val=0)
Base class for user error types.
virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc)
FeatureBitset AvailableFeatures
AvailableFeatures - The current set of available features.
Generic base class for all target subtargets.
unsigned getOperandError() const
virtual const MCExpr * applyModifierToExpr(const MCExpr *E, MCSymbolRefExpr::VariantKind, MCContext &Ctx)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
NearMissKind getKind() const
unsigned getOperandIndex() const
virtual void flushPendingInstructions(MCStreamer &Out)
Ensure that all previously parsed instructions have been emitted to the output streamer, if the target does not emit them immediately.
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
const char AsmRewritePrecedence[]
TooFewOperandsInfo TooFewOperands
LLVM Value Representation.
virtual void doBeforeLabelEmit(MCSymbol *Symbol)
IntelExpr(StringRef baseReg, StringRef indexReg, unsigned scale, StringRef offsetName, int64_t imm, bool needBracs)
StringRef - Represent a constant reference to a string, i.e.
AsmRewrite(SMLoc loc, unsigned len, IntelExpr exp)
Represents a location in source code.
MCTargetOptions getTargetOptions() const
virtual bool isReg() const =0
isReg - Is this a register operand?
bool isParsingInlineAsm()