23#define DEBUG_TYPE "m68k-asm-parser"
29 cl::desc(
"Enable specifying registers without the % prefix"),
38#define GET_ASSEMBLER_HEADER
39#include "M68kGenAsmMatcher.inc"
62 MRI = getContext().getRegisterInfo();
64 setAvailableFeatures(ComputeAvailableFeatures(STI.
getFeatureBits()));
67 unsigned validateTargetOperandClass(MCParsedAsmOperand &
Op,
68 unsigned Kind)
override;
69 bool parseRegister(MCRegister &
Reg, SMLoc &StartLoc, SMLoc &EndLoc)
override;
70 ParseStatus tryParseRegister(MCRegister &
Reg, SMLoc &StartLoc,
71 SMLoc &EndLoc)
override;
72 bool parseInstruction(ParseInstructionInfo &Info, StringRef Name,
74 bool matchAndEmitInstruction(SMLoc IDLoc,
unsigned &Opcode,
77 bool MatchingInlineAsm)
override;
88 RegIndirectDisplacement,
89 RegIndirectDisplacementIndex,
106 const MCExpr *OuterDisp;
107 const MCExpr *InnerDisp;
111 uint8_t AtLeast68020 : 1;
114 M68kMemOp(Kind Op) : Op(Op) {}
116 void print(raw_ostream &OS)
const;
121 typedef MCParsedAsmOperand Base;
138 template <
unsigned N>
bool isAddrN()
const;
141 M68kOperand(KindTy Kind, SMLoc Start, SMLoc End)
142 : Base(), Kind(Kind), Start(Start), End(End) {}
144 SMLoc getStartLoc()
const override {
return Start; }
145 SMLoc getEndLoc()
const override {
return End; }
147 void print(raw_ostream &OS,
const MCAsmInfo &MAI)
const override;
149 bool isMem()
const override {
return false; }
150 bool isMemOp()
const {
return Kind == KindTy::MemOp; }
152 static void addExpr(MCInst &Inst,
const MCExpr *Expr);
155 bool isReg()
const override;
158 bool isFPDReg()
const;
159 bool isFPCReg()
const;
160 MCRegister
getReg()
const override;
161 void addRegOperands(MCInst &Inst,
unsigned N)
const;
163 static std::unique_ptr<M68kOperand> createMemOp(M68kMemOp MemOp, SMLoc Start,
167 bool isToken()
const override;
169 static std::unique_ptr<M68kOperand> createToken(StringRef Token, SMLoc Start,
173 bool isImm()
const override;
174 void addImmOperands(MCInst &Inst,
unsigned N)
const;
176 static std::unique_ptr<M68kOperand> createImm(
const MCExpr *Expr, SMLoc Start,
180 bool isTrapImm()
const;
182 bool isBkptImm()
const;
185 bool isMoveMask()
const;
186 void addMoveMaskOperands(MCInst &Inst,
unsigned N)
const;
190 bool isAddr8()
const {
return isAddrN<8>(); }
191 bool isAddr16()
const {
return isAddrN<16>(); }
192 bool isAddr32()
const {
return isAddrN<32>(); }
193 void addAddrOperands(MCInst &Inst,
unsigned N)
const;
197 void addARIOperands(MCInst &Inst,
unsigned N)
const;
201 void addARIDOperands(MCInst &Inst,
unsigned N)
const;
205 void addARIIOperands(MCInst &Inst,
unsigned N)
const;
208 bool isARIPD()
const;
209 void addARIPDOperands(MCInst &Inst,
unsigned N)
const;
212 bool isARIPI()
const;
213 void addARIPIOperands(MCInst &Inst,
unsigned N)
const;
217 void addPCDOperands(MCInst &Inst,
unsigned N)
const;
221 void addPCIOperands(MCInst &Inst,
unsigned N)
const;
224 bool isPCIBD()
const;
225 bool isPCIBD32()
const;
226 bool isPCIBD16()
const;
227 void addPCIBDOperands(MCInst &Inst,
unsigned N)
const;
236#define GET_REGISTER_MATCHER
237#define GET_MATCHER_IMPLEMENTATION
238#include "M68kGenAsmMatcher.inc"
241 static unsigned RegistersByIndex[] = {
242 M68k::D0, M68k::D1, M68k::D2, M68k::D3, M68k::D4, M68k::D5,
243 M68k::D6, M68k::D7, M68k::A0, M68k::A1, M68k::A2, M68k::A3,
244 M68k::A4, M68k::A5, M68k::A6, M68k::SP, M68k::FP0, M68k::FP1,
245 M68k::FP2, M68k::FP3, M68k::FP4, M68k::FP5, M68k::FP6, M68k::FP7};
247 sizeof(RegistersByIndex) /
sizeof(RegistersByIndex[0]));
248 return RegistersByIndex[RegisterIndex];
284 OS <<
"RegMask(" <<
format(
"%04x", RegMask) <<
")";
287 OS <<
'%' << OuterReg;
289 case Kind::RegIndirect:
290 OS <<
"(%" << OuterReg <<
')';
292 case Kind::RegPostIncrement:
293 OS <<
"(%" << OuterReg <<
")+";
295 case Kind::RegPreDecrement:
296 OS <<
"-(%" << OuterReg <<
")";
298 case Kind::RegIndirectDisplacement:
299 OS << OuterDisp <<
"(%" << OuterReg <<
")";
301 case Kind::RegIndirectDisplacementIndex:
302 OS << OuterDisp <<
"(%" << OuterReg <<
", " << InnerReg <<
", " << InnerDisp
308void M68kOperand::addExpr(MCInst &Inst,
const MCExpr *Expr) {
318bool M68kOperand::isReg()
const {
319 return Kind == KindTy::MemOp && MemOp.Op == M68kMemOp::Kind::Reg;
322MCRegister M68kOperand::getReg()
const {
324 return MemOp.OuterReg;
327void M68kOperand::addRegOperands(MCInst &Inst,
unsigned N)
const {
329 assert((
N == 1) &&
"can only handle one register operand");
334std::unique_ptr<M68kOperand> M68kOperand::createMemOp(M68kMemOp MemOp,
335 SMLoc Start, SMLoc End) {
336 auto Op = std::make_unique<M68kOperand>(KindTy::MemOp, Start, End);
342bool M68kOperand::isToken()
const {
return Kind == KindTy::Token; }
343StringRef M68kOperand::getToken()
const {
348std::unique_ptr<M68kOperand> M68kOperand::createToken(StringRef Token,
349 SMLoc Start, SMLoc End) {
350 auto Op = std::make_unique<M68kOperand>(KindTy::Token, Start, End);
356bool M68kOperand::isImm()
const {
return Kind == KindTy::Imm; }
357void M68kOperand::addImmOperands(MCInst &Inst,
unsigned N)
const {
358 assert(isImm() &&
"wrong operand kind");
359 assert((
N == 1) &&
"can only handle one register operand");
361 M68kOperand::addExpr(Inst, Expr);
364std::unique_ptr<M68kOperand> M68kOperand::createImm(
const MCExpr *Expr,
365 SMLoc Start, SMLoc End) {
366 auto Op = std::make_unique<M68kOperand>(KindTy::Imm, Start, End);
371bool M68kOperand::isTrapImm()
const {
373 if (!isImm() || !Expr->evaluateAsAbsolute(
Value))
379bool M68kOperand::isBkptImm()
const {
381 if (!isImm() || !Expr->evaluateAsAbsolute(
Value))
388bool M68kOperand::isMoveMask()
const {
392 if (MemOp.Op == M68kMemOp::Kind::RegMask)
395 if (MemOp.Op != M68kMemOp::Kind::Reg)
403void M68kOperand::addMoveMaskOperands(MCInst &Inst,
unsigned N)
const {
404 assert(isMoveMask() &&
"wrong operand kind");
405 assert((
N == 1) &&
"can only handle one immediate operand");
407 uint16_t MoveMask = MemOp.RegMask;
408 if (MemOp.Op == M68kMemOp::Kind::Reg)
415bool M68kOperand::isAddr()
const {
416 return isMemOp() && MemOp.Op == M68kMemOp::Kind::Addr;
420template <
unsigned N>
bool M68kOperand::isAddrN()
const {
423 if (MemOp.OuterDisp->evaluateAsAbsolute(Res))
429void M68kOperand::addAddrOperands(MCInst &Inst,
unsigned N)
const {
430 M68kOperand::addExpr(Inst, MemOp.OuterDisp);
434bool M68kOperand::isARI()
const {
435 return isMemOp() && MemOp.Op == M68kMemOp::Kind::RegIndirect &&
436 M68k::AR32RegClass.contains(MemOp.OuterReg);
438void M68kOperand::addARIOperands(MCInst &Inst,
unsigned N)
const {
443bool M68kOperand::isARID()
const {
444 return isMemOp() && MemOp.Op == M68kMemOp::Kind::RegIndirectDisplacement &&
445 M68k::AR32RegClass.contains(MemOp.OuterReg);
447void M68kOperand::addARIDOperands(MCInst &Inst,
unsigned N)
const {
448 M68kOperand::addExpr(Inst, MemOp.OuterDisp);
453bool M68kOperand::isARII()
const {
455 MemOp.Op == M68kMemOp::Kind::RegIndirectDisplacementIndex &&
456 M68k::AR32RegClass.contains(MemOp.OuterReg);
458void M68kOperand::addARIIOperands(MCInst &Inst,
unsigned N)
const {
459 M68kOperand::addExpr(Inst, MemOp.OuterDisp);
465bool M68kOperand::isARIPD()
const {
466 return isMemOp() && MemOp.Op == M68kMemOp::Kind::RegPreDecrement &&
467 M68k::AR32RegClass.contains(MemOp.OuterReg);
469void M68kOperand::addARIPDOperands(MCInst &Inst,
unsigned N)
const {
474bool M68kOperand::isARIPI()
const {
475 return isMemOp() && MemOp.Op == M68kMemOp::Kind::RegPostIncrement &&
476 M68k::AR32RegClass.contains(MemOp.OuterReg);
478void M68kOperand::addARIPIOperands(MCInst &Inst,
unsigned N)
const {
483bool M68kOperand::isPCD()
const {
484 return isMemOp() && MemOp.Op == M68kMemOp::Kind::RegIndirectDisplacement &&
485 MemOp.OuterReg == M68k::PC && !MemOp.AtLeast68020;
487void M68kOperand::addPCDOperands(MCInst &Inst,
unsigned N)
const {
488 M68kOperand::addExpr(Inst, MemOp.OuterDisp);
492bool M68kOperand::isPCI()
const {
494 MemOp.Op == M68kMemOp::Kind::RegIndirectDisplacementIndex &&
495 MemOp.OuterReg == M68k::PC && MemOp.Scale == 1 && !MemOp.AtLeast68020;
497void M68kOperand::addPCIOperands(MCInst &Inst,
unsigned N)
const {
498 M68kOperand::addExpr(Inst, MemOp.OuterDisp);
505bool M68kOperand::isPCIBD()
const {
506 return isMemOp() && MemOp.AtLeast68020 &&
507 (MemOp.Op == M68kMemOp::Kind::RegIndirectDisplacementIndex ||
508 MemOp.Op == M68kMemOp::Kind::RegIndirectDisplacement) &&
509 MemOp.OuterReg == M68k::PC;
511bool M68kOperand::isPCIBD32()
const {
515 (!MemOp.InnerReg.isValid() ||
516 M68kMCRegisterClasses[M68k::XR32RegClassID].
contains(MemOp.InnerReg));
518bool M68kOperand::isPCIBD16()
const {
520 M68kMCRegisterClasses[M68k::XR16RegClassID].contains(MemOp.InnerReg);
522void M68kOperand::addPCIBDOperands(MCInst &Inst,
unsigned N)
const {
523 M68kOperand::addExpr(Inst, MemOp.OuterDisp);
529 bool SP,
bool FPDR =
false,
579bool M68kOperand::isAReg()
const {
585bool M68kOperand::isDReg()
const {
591bool M68kOperand::isFPDReg()
const {
598bool M68kOperand::isFPCReg()
const {
605unsigned M68kAsmParser::validateTargetOperandClass(MCParsedAsmOperand &
Op,
607 M68kOperand &Operand = (M68kOperand &)
Op;
612 if (Operand.isReg() &&
614 return Match_Success;
620 if (Operand.isReg() &&
622 return Match_Success;
627 if (Operand.isReg() &&
629 return Match_Success;
636 if (Operand.isReg() &&
638 return Match_Success;
643 if (Operand.isReg() &&
644 ((Operand.getReg() == M68k::A0) || (Operand.getReg() == M68k::A1))) {
645 return Match_Success;
650 if (Operand.isReg() &&
651 ((Operand.getReg() == M68k::D0) || (Operand.getReg() == M68k::D1))) {
652 return Match_Success;
657 if (Operand.isReg() &&
658 ((Operand.getReg() == M68k::D0) || (Operand.getReg() == M68k::D1) ||
659 (Operand.getReg() == M68k::A0) || (Operand.getReg() == M68k::A1))) {
660 return Match_Success;
665 return Match_InvalidOperand;
668bool M68kAsmParser::parseRegisterName(MCRegister &RegNo, SMLoc Loc,
669 StringRef RegisterName) {
670 auto RegisterNameLower = RegisterName.
lower();
673 if (RegisterNameLower ==
"ccr") {
676 }
else if (RegisterNameLower ==
"sr") {
682 if (RegisterNameLower.size() == 2) {
684 switch (RegisterNameLower[0]) {
687 if (isdigit(RegisterNameLower[1])) {
688 unsigned IndexOffset = (RegisterNameLower[0] ==
'a') ? 8 : 0;
689 unsigned RegIndex = (unsigned)(RegisterNameLower[1] -
'0');
699 if (RegisterNameLower[1] ==
'p') {
702 }
else if (RegisterNameLower[1] ==
'r') {
709 if (RegisterNameLower[1] ==
'c') {
715 }
else if (StringRef(RegisterNameLower).
starts_with(
"fp") &&
716 RegisterNameLower.size() > 2) {
717 auto RegIndex = unsigned(RegisterNameLower[2] -
'0');
718 if (RegIndex < 8 && RegisterNameLower.size() == 3) {
724 RegNo = StringSwitch<unsigned>(RegisterNameLower)
725 .Cases({
"fpc",
"fpcr"}, M68k::FPC)
726 .Cases({
"fps",
"fpsr"}, M68k::FPS)
727 .Cases({
"fpi",
"fpiar"}, M68k::FPIAR)
729 assert(RegNo != M68k::NoRegister &&
730 "Unrecognized FP control register name");
738ParseStatus M68kAsmParser::parseRegister(MCRegister &RegNo,
739 bool WithSizeSuffix) {
740 bool HasPercent =
false;
741 AsmToken PercentToken;
747 PercentToken = Lex();
754 getLexer().UnLex(PercentToken);
765 RegisterName = RegisterName.
drop_back(2);
768 if (!parseRegisterName(RegNo, Parser.
getLexer().
getLoc(), RegisterName)) {
770 getLexer().UnLex(PercentToken);
775 RegNo = MRI->
getSubReg(RegNo, M68k::MxSubRegIndex16Lo);
781bool M68kAsmParser::parseRegister(MCRegister &
Reg, SMLoc &StartLoc,
783 ParseStatus
Result = tryParseRegister(
Reg, StartLoc, EndLoc);
785 return Error(StartLoc,
"expected register");
790ParseStatus M68kAsmParser::tryParseRegister(MCRegister &
Reg, SMLoc &StartLoc,
792 StartLoc = getLexer().getLoc();
794 EndLoc = getLexer().getLoc();
798bool M68kAsmParser::isExpr() {
811ParseStatus M68kAsmParser::parseImm(
OperandVector &Operands) {
814 SMLoc
Start = getLexer().getLoc();
820 if (getParser().parseExpression(Expr, End))
823 Operands.
push_back(M68kOperand::createImm(Expr, Start, End));
827ParseStatus M68kAsmParser::parseMemOp(
OperandVector &Operands) {
828 SMLoc
Start = getLexer().getLoc();
832 MemOp.AtLeast68020 = STI->hasFeature(M68k::FeatureISA20);
836 ParseStatus
Result = parseRegOrMoveMask(Operands);
841 bool HasDisplacement =
false;
845 }
else if (isExpr()) {
848 HasDisplacement =
true;
852 if (HasDisplacement) {
853 MemOp.Op = M68kMemOp::Kind::Addr;
855 M68kOperand::createMemOp(MemOp, Start, getLexer().getLoc()));
859 return Error(getLexer().getLoc(),
"expected (");
866 if (!HasDisplacement && isExpr()) {
869 HasDisplacement =
true;
873 MemOp.Op = M68kMemOp::Kind::Addr;
875 M68kOperand::createMemOp(MemOp, Start, getLexer().getLoc()));
882 Result = parseRegister(MemOp.OuterReg);
887 return Error(getLexer().getLoc(),
"expected register");
894 Result = parseRegister(MemOp.InnerReg,
true);
899 return Error(getLexer().getLoc(),
"expected register");
904 const auto &ScaleTok = Parser.
Lex();
906 return Error(getLexer().getLoc(),
"expected scale");
907 int64_t ScaleVal = ScaleTok.getIntVal();
908 if (ScaleVal < 1 || ScaleVal > 8 || !
isPowerOf2_32(ScaleVal))
909 return Error(ScaleTok.getLoc(),
"expected scale to be 1, 2, 4, or 8");
910 MemOp.Scale =
static_cast<uint8_t
>(ScaleVal);
919 return Error(getLexer().getLoc(),
"expected )");
928 SMLoc End = getLexer().getLoc();
930 unsigned OpCount = IsPD + IsPI + (
HasIndex || HasDisplacement);
932 return Error(Start,
"only one of post-increment, pre-decrement or "
933 "displacement can be used");
936 MemOp.Op = M68kMemOp::Kind::RegPreDecrement;
938 MemOp.Op = M68kMemOp::Kind::RegPostIncrement;
939 }
else if (HasIndex) {
940 MemOp.Op = M68kMemOp::Kind::RegIndirectDisplacementIndex;
941 }
else if (HasDisplacement) {
942 MemOp.Op = M68kMemOp::Kind::RegIndirectDisplacement;
944 MemOp.Op = M68kMemOp::Kind::RegIndirect;
947 Operands.
push_back(M68kOperand::createMemOp(MemOp, Start, End));
951ParseStatus M68kAsmParser::parseRegOrMoveMask(
OperandVector &Operands) {
952 SMLoc
Start = getLexer().getLoc();
953 M68kMemOp MemOp(M68kMemOp::Kind::RegMask);
957 bool IsFirstRegister =
958 (MemOp.Op == M68kMemOp::Kind::RegMask) && (MemOp.RegMask == 0);
960 MCRegister FirstRegister;
961 ParseStatus
Result = parseRegister(FirstRegister);
962 if (IsFirstRegister &&
Result.isNoMatch())
965 return Error(getLexer().getLoc(),
"expected start register");
967 MCRegister LastRegister = FirstRegister;
969 Result = parseRegister(LastRegister);
971 return Error(getLexer().getLoc(),
"expected end register");
977 uint16_t NumNewBits = LastRegisterIndex - FirstRegisterIndex + 1;
978 uint16_t NewMaskBits = ((1 << NumNewBits) - 1) << FirstRegisterIndex;
980 if (IsFirstRegister && (FirstRegister == LastRegister)) {
983 MemOp.Op = M68kMemOp::Kind::Reg;
984 MemOp.OuterReg = FirstRegister;
986 if (MemOp.Op == M68kMemOp::Kind::Reg) {
989 MemOp.Op = M68kMemOp::Kind::RegMask;
992 if (MemOp.RegMask == 0)
993 return Error(getLexer().getLoc(),
994 "special registers cannot be used in register masks");
997 if ((FirstRegisterIndex >= 16) || (LastRegisterIndex >= 16))
998 return Error(getLexer().getLoc(),
999 "special registers cannot be used in register masks");
1001 if (NewMaskBits & MemOp.RegMask)
1002 return Error(getLexer().getLoc(),
"conflicting masked registers");
1004 MemOp.RegMask |= NewMaskBits;
1012 M68kOperand::createMemOp(MemOp, Start, getLexer().getLoc()));
1016void M68kAsmParser::eatComma() {
1022bool M68kAsmParser::parseInstruction(ParseInstructionInfo &Info, StringRef Name,
1024 SMLoc
Start = getLexer().getLoc();
1025 Operands.
push_back(M68kOperand::createToken(Name, Start, Start));
1035 ParseStatus MatchResult = MatchOperandParserImpl(Operands, Name);
1040 SMLoc Loc = getLexer().getLoc();
1042 return Error(Loc,
"unexpected token parsing operands");
1050bool M68kAsmParser::invalidOperand(SMLoc Loc,
OperandVector const &Operands,
1051 uint64_t
const &ErrorInfo) {
1052 SMLoc ErrorLoc = Loc;
1053 char const *Diag = 0;
1055 if (ErrorInfo != ~0U) {
1056 if (ErrorInfo >= Operands.
size()) {
1057 Diag =
"too few operands for instruction.";
1059 auto const &
Op = (M68kOperand
const &)*Operands[ErrorInfo];
1060 if (
Op.getStartLoc() != SMLoc()) {
1061 ErrorLoc =
Op.getStartLoc();
1067 Diag =
"invalid operand for instruction";
1070 return Error(ErrorLoc, Diag);
1073bool M68kAsmParser::missingFeature(SMLoc Loc, uint64_t
const &ErrorInfo) {
1074 return Error(Loc,
"instruction requires a CPU feature not currently enabled");
1077bool M68kAsmParser::emit(MCInst &Inst, SMLoc Loc, MCStreamer &Out)
const {
1084bool M68kAsmParser::matchAndEmitInstruction(SMLoc Loc,
unsigned &Opcode,
1087 uint64_t &ErrorInfo,
1088 bool MatchingInlineAsm) {
1090 unsigned MatchResult =
1091 MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm);
1093 switch (MatchResult) {
1095 return emit(Inst, Loc, Out);
1096 case Match_MissingFeature:
1097 return missingFeature(Loc, ErrorInfo);
1098 case Match_InvalidOperand:
1099 return invalidOperand(Loc, Operands, ErrorInfo);
1100 case Match_MnemonicFail:
1101 return Error(Loc,
"invalid instruction");
1107void M68kOperand::print(raw_ostream &OS,
const MCAsmInfo &MAI)
const {
1109 case KindTy::Invalid:
1114 OS <<
"token '" << Token <<
"'";
1119 Expr->evaluateAsAbsolute(
Value);
1120 OS <<
"immediate " <<
Value;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isNot(const MachineRegisterInfo &MRI, const MachineInstr &MI)
#define LLVM_EXTERNAL_VISIBILITY
static bool checkRegisterClass(unsigned RegNo, bool Data, bool Address, bool SP, bool FPDR=false, bool FPCR=false)
static cl::opt< bool > RegisterPrefixOptional("m68k-register-prefix-optional", cl::Hidden, cl::desc("Enable specifying registers without the % prefix"), cl::init(false))
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeM68kAsmParser()
static unsigned getRegisterByIndex(unsigned RegisterIndex)
static unsigned getRegisterIndex(unsigned Register)
This file contains the M68k implementation of the TargetInstrInfo class.
This file contains the declarations of the M68k MCAsmInfo properties.
This file contains the M68k implementation of the TargetRegisterInfo class.
static MCRegister getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
static bool isReg(const MCInst &MI, unsigned OpNo)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
SMLoc getLoc() const
Get the current source location.
bool isNot(TokenKind K) const
StringRef getString() const
Get the string for the current token, this includes all characters (for example, the quotes on string...
bool is(TokenKind K) const
TokenKind getKind() const
Base class for user error types.
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
Generic assembler parser interface, for use by target specific assembly parsers.
virtual void eatToEndOfStatement()=0
Skip to the end of the current statement, for error recovery.
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
const AsmToken & getTok() const
Get the current AsmToken from the stream.
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Instances of this class represent a single low-level machine instruction.
void addOperand(const MCOperand Op)
Interface to description of machine instruction set.
static MCOperand createExpr(const MCExpr *Val)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
MCRegister getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo.
Wrapper class representing physical registers. Should be passed by value.
Streaming machine code generation interface.
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
Generic base class for all target subtargets.
const FeatureBitset & getFeatureBits() const
MCTargetAsmParser - Generic interface to target specific assembly parsers.
Ternary parse status returned by various parse* methods.
static constexpr StatusTy Failure
constexpr bool isSuccess() const
static constexpr StatusTy Success
static constexpr StatusTy NoMatch
Wrapper class representing virtual and physical registers.
Represents a location in source code.
void push_back(const T &Elt)
Represent a constant reference to a string, i.e.
LLVM_ABI std::string lower() const
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
LLVM_ABI bool ends_with_insensitive(StringRef Suffix) const
Check if this string ends with the given Suffix, ignoring case.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
static bool isMem(const MachineInstr &MI, unsigned Op)
LLVM_ABI std::pair< StringRef, StringRef > getToken(StringRef Source, StringRef Delimiters=" \t\n\v\f\r")
getToken - This function extracts one token from source, ignoring any leading characters that appear ...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
SmallVectorImpl< std::unique_ptr< MCParsedAsmOperand > > OperandVector
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
DWARFExpression::Operation Op
Target & getTheM68kTarget()
RegisterMCAsmParser - Helper template for registering a target specific assembly parser,...