60 #define GET_ASSEMBLER_HEADER 61 #include "SparcGenAsmMatcher.inc" 66 bool MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
69 bool MatchingInlineAsm)
override;
70 bool ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
SMLoc &EndLoc)
override;
73 bool ParseDirective(
AsmToken DirectiveID)
override;
76 unsigned Kind)
override;
84 parseSparcAsmOperand(std::unique_ptr<SparcOperand> &Operand,
94 bool matchRegisterName(
const AsmToken &Tok,
unsigned &RegNo,
97 bool matchSparcAsmModifiers(
const MCExpr *&EVal,
SMLoc &EndLoc);
120 setAvailableFeatures(ComputeAvailableFeatures(getSTI().getFeatureBits()));
127 Sparc::G0, Sparc::G1, Sparc::G2, Sparc::G3,
128 Sparc::G4, Sparc::G5, Sparc::G6, Sparc::G7,
129 Sparc::O0, Sparc::O1, Sparc::O2, Sparc::O3,
130 Sparc::O4, Sparc::O5, Sparc::O6, Sparc::O7,
131 Sparc::L0, Sparc::L1, Sparc::L2, Sparc::L3,
132 Sparc::L4, Sparc::L5, Sparc::L6, Sparc::L7,
133 Sparc::I0, Sparc::I1, Sparc::I2, Sparc::I3,
134 Sparc::I4, Sparc::I5, Sparc::I6, Sparc::I7 };
137 Sparc::F0, Sparc::F1, Sparc::F2, Sparc::F3,
138 Sparc::F4, Sparc::F5, Sparc::F6, Sparc::F7,
139 Sparc::F8, Sparc::F9, Sparc::F10, Sparc::F11,
140 Sparc::F12, Sparc::F13, Sparc::F14, Sparc::F15,
141 Sparc::F16, Sparc::F17, Sparc::F18, Sparc::F19,
142 Sparc::F20, Sparc::F21, Sparc::F22, Sparc::F23,
143 Sparc::F24, Sparc::F25, Sparc::F26, Sparc::F27,
144 Sparc::F28, Sparc::F29, Sparc::F30, Sparc::F31 };
147 Sparc::D0, Sparc::D1, Sparc::D2, Sparc::D3,
148 Sparc::D4, Sparc::D5, Sparc::D6, Sparc::D7,
149 Sparc::D8, Sparc::D9, Sparc::D10, Sparc::D11,
150 Sparc::D12, Sparc::D13, Sparc::D14, Sparc::D15,
151 Sparc::D16, Sparc::D17, Sparc::D18, Sparc::D19,
152 Sparc::D20, Sparc::D21, Sparc::D22, Sparc::D23,
153 Sparc::D24, Sparc::D25, Sparc::D26, Sparc::D27,
154 Sparc::D28, Sparc::D29, Sparc::D30, Sparc::D31 };
157 Sparc::Q0, Sparc::Q1, Sparc::Q2, Sparc::Q3,
158 Sparc::Q4, Sparc::Q5, Sparc::Q6, Sparc::Q7,
159 Sparc::Q8, Sparc::Q9, Sparc::Q10, Sparc::Q11,
160 Sparc::Q12, Sparc::Q13, Sparc::Q14, Sparc::Q15 };
163 SP::Y, SP::ASR1, SP::ASR2, SP::ASR3,
164 SP::ASR4, SP::ASR5, SP::ASR6, SP::ASR7,
165 SP::ASR8, SP::ASR9, SP::ASR10, SP::ASR11,
166 SP::ASR12, SP::ASR13, SP::ASR14, SP::ASR15,
167 SP::ASR16, SP::ASR17, SP::ASR18, SP::ASR19,
168 SP::ASR20, SP::ASR21, SP::ASR22, SP::ASR23,
169 SP::ASR24, SP::ASR25, SP::ASR26, SP::ASR27,
170 SP::ASR28, SP::ASR29, SP::ASR30, SP::ASR31};
173 Sparc::G0_G1, Sparc::G2_G3, Sparc::G4_G5, Sparc::G6_G7,
174 Sparc::O0_O1, Sparc::O2_O3, Sparc::O4_O5, Sparc::O6_O7,
175 Sparc::L0_L1, Sparc::L2_L3, Sparc::L4_L5, Sparc::L6_L7,
176 Sparc::I0_I1, Sparc::I2_I3, Sparc::I4_I5, Sparc::I6_I7};
179 Sparc::C0, Sparc::C1, Sparc::C2, Sparc::C3,
180 Sparc::C4, Sparc::C5, Sparc::C6, Sparc::C7,
181 Sparc::C8, Sparc::C9, Sparc::C10, Sparc::C11,
182 Sparc::C12, Sparc::C13, Sparc::C14, Sparc::C15,
183 Sparc::C16, Sparc::C17, Sparc::C18, Sparc::C19,
184 Sparc::C20, Sparc::C21, Sparc::C22, Sparc::C23,
185 Sparc::C24, Sparc::C25, Sparc::C26, Sparc::C27,
186 Sparc::C28, Sparc::C29, Sparc::C30, Sparc::C31 };
189 Sparc::C0_C1, Sparc::C2_C3, Sparc::C4_C5, Sparc::C6_C7,
190 Sparc::C8_C9, Sparc::C10_C11, Sparc::C12_C13, Sparc::C14_C15,
191 Sparc::C16_C17, Sparc::C18_C19, Sparc::C20_C21, Sparc::C22_C23,
192 Sparc::C24_C25, Sparc::C26_C27, Sparc::C28_C29, Sparc::C30_C31};
221 SMLoc StartLoc, EndLoc;
253 bool isToken()
const override {
return Kind == k_Token; }
254 bool isReg()
const override {
return Kind == k_Register; }
255 bool isImm()
const override {
return Kind == k_Immediate; }
256 bool isMem()
const override {
return isMEMrr() || isMEMri(); }
257 bool isMEMrr()
const {
return Kind == k_MemoryReg; }
258 bool isMEMri()
const {
return Kind == k_MemoryImm; }
261 return (Kind == k_Register &&
Reg.Kind == rk_IntReg);
264 bool isFloatReg()
const {
265 return (Kind == k_Register &&
Reg.Kind == rk_FloatReg);
268 bool isFloatOrDoubleReg()
const {
269 return (Kind == k_Register && (
Reg.Kind == rk_FloatReg
270 ||
Reg.Kind == rk_DoubleReg));
273 bool isCoprocReg()
const {
274 return (Kind == k_Register &&
Reg.Kind == rk_CoprocReg);
278 assert(Kind == k_Token &&
"Invalid access!");
282 unsigned getReg()
const override {
283 assert((Kind == k_Register) &&
"Invalid access!");
287 const MCExpr *getImm()
const {
288 assert((Kind == k_Immediate) &&
"Invalid access!");
292 unsigned getMemBase()
const {
293 assert((Kind == k_MemoryReg || Kind == k_MemoryImm) &&
"Invalid access!");
297 unsigned getMemOffsetReg()
const {
298 assert((Kind == k_MemoryReg) &&
"Invalid access!");
299 return Mem.OffsetReg;
302 const MCExpr *getMemOff()
const {
303 assert((Kind == k_MemoryImm) &&
"Invalid access!");
308 SMLoc getStartLoc()
const override {
312 SMLoc getEndLoc()
const override {
318 case k_Token: OS <<
"Token: " <<
getToken() <<
"\n";
break;
319 case k_Register: OS <<
"Reg: #" <<
getReg() <<
"\n";
break;
320 case k_Immediate: OS <<
"Imm: " << getImm() <<
"\n";
break;
321 case k_MemoryReg: OS <<
"Mem: " << getMemBase() <<
"+" 322 << getMemOffsetReg() <<
"\n";
break;
323 case k_MemoryImm:
assert(getMemOff() !=
nullptr);
324 OS <<
"Mem: " << getMemBase()
325 <<
"+" << *getMemOff()
330 void addRegOperands(
MCInst &Inst,
unsigned N)
const {
331 assert(N == 1 &&
"Invalid number of operands!");
335 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
336 assert(N == 1 &&
"Invalid number of operands!");
337 const MCExpr *Expr = getImm();
345 else if (
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Expr))
351 void addMEMrrOperands(
MCInst &Inst,
unsigned N)
const {
352 assert(N == 2 &&
"Invalid number of operands!");
356 assert(getMemOffsetReg() != 0 &&
"Invalid offset");
360 void addMEMriOperands(
MCInst &Inst,
unsigned N)
const {
361 assert(N == 2 &&
"Invalid number of operands!");
365 const MCExpr *Expr = getMemOff();
369 static std::unique_ptr<SparcOperand> CreateToken(
StringRef Str,
SMLoc S) {
370 auto Op = make_unique<SparcOperand>(k_Token);
371 Op->Tok.Data = Str.
data();
372 Op->Tok.Length = Str.
size();
378 static std::unique_ptr<SparcOperand> CreateReg(
unsigned RegNum,
unsigned Kind,
380 auto Op = make_unique<SparcOperand>(k_Register);
381 Op->Reg.RegNum = RegNum;
388 static std::unique_ptr<SparcOperand> CreateImm(
const MCExpr *Val,
SMLoc S,
390 auto Op = make_unique<SparcOperand>(k_Immediate);
397 static bool MorphToIntPairReg(SparcOperand &
Op) {
398 unsigned Reg = Op.getReg();
399 assert(Op.Reg.Kind == rk_IntReg);
400 unsigned regIdx = 32;
401 if (Reg >= Sparc::G0 && Reg <= Sparc::G7)
402 regIdx = Reg - Sparc::G0;
403 else if (Reg >= Sparc::O0 && Reg <= Sparc::O7)
404 regIdx = Reg - Sparc::O0 + 8;
405 else if (Reg >= Sparc::L0 && Reg <= Sparc::L7)
406 regIdx = Reg - Sparc::L0 + 16;
407 else if (Reg >= Sparc::I0 && Reg <= Sparc::I7)
408 regIdx = Reg - Sparc::I0 + 24;
409 if (regIdx % 2 || regIdx > 31)
411 Op.Reg.RegNum = IntPairRegs[regIdx / 2];
412 Op.Reg.Kind = rk_IntPairReg;
416 static bool MorphToDoubleReg(SparcOperand &Op) {
417 unsigned Reg = Op.getReg();
418 assert(Op.Reg.Kind == rk_FloatReg);
419 unsigned regIdx = Reg - Sparc::F0;
420 if (regIdx % 2 || regIdx > 31)
422 Op.Reg.RegNum = DoubleRegs[regIdx / 2];
423 Op.Reg.Kind = rk_DoubleReg;
427 static bool MorphToQuadReg(SparcOperand &Op) {
428 unsigned Reg = Op.getReg();
430 switch (Op.Reg.Kind) {
433 regIdx = Reg - Sparc::F0;
434 if (regIdx % 4 || regIdx > 31)
436 Reg = QuadFPRegs[regIdx / 4];
439 regIdx = Reg - Sparc::D0;
440 if (regIdx % 2 || regIdx > 31)
442 Reg = QuadFPRegs[regIdx / 2];
446 Op.Reg.Kind = rk_QuadReg;
450 static bool MorphToCoprocPairReg(SparcOperand &Op) {
451 unsigned Reg = Op.getReg();
452 assert(Op.Reg.Kind == rk_CoprocReg);
453 unsigned regIdx = 32;
454 if (Reg >= Sparc::C0 && Reg <= Sparc::C31)
455 regIdx = Reg - Sparc::C0;
456 if (regIdx % 2 || regIdx > 31)
458 Op.Reg.RegNum = CoprocPairRegs[regIdx / 2];
459 Op.Reg.Kind = rk_CoprocPairReg;
463 static std::unique_ptr<SparcOperand>
464 MorphToMEMrr(
unsigned Base, std::unique_ptr<SparcOperand> Op) {
465 unsigned offsetReg = Op->getReg();
466 Op->Kind = k_MemoryReg;
468 Op->Mem.OffsetReg = offsetReg;
469 Op->Mem.Off =
nullptr;
473 static std::unique_ptr<SparcOperand>
475 auto Op = make_unique<SparcOperand>(k_MemoryReg);
477 Op->Mem.OffsetReg = Sparc::G0;
478 Op->Mem.Off =
nullptr;
484 static std::unique_ptr<SparcOperand>
485 MorphToMEMri(
unsigned Base, std::unique_ptr<SparcOperand> Op) {
486 const MCExpr *Imm = Op->getImm();
487 Op->Kind = k_MemoryImm;
489 Op->Mem.OffsetReg = 0;
497 bool SparcAsmParser::expandSET(
MCInst &Inst,
SMLoc IDLoc,
506 int64_t RawImmValue = IsImm ? MCValOp.
getImm() : 0;
509 if (RawImmValue < -2147483648LL || RawImmValue > 4294967295LL) {
511 "set: argument must be between -2147483648 and 4294967295");
516 int32_t ImmValue = RawImmValue;
520 bool IsEffectivelyImm13 =
521 IsImm && ((
is64Bit() ? 0 : -4096) <= ImmValue && ImmValue < 4096);
533 if (!IsEffectivelyImm13) {
554 if (!IsImm || IsEffectivelyImm13 || (ImmValue & 0x3ff)) {
557 if (IsEffectivelyImm13)
571 bool SparcAsmParser::MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
575 bool MatchingInlineAsm) {
578 unsigned MatchResult = MatchInstructionImpl(Operands, Inst, ErrorInfo,
580 switch (MatchResult) {
581 case Match_Success: {
588 if (expandSET(Inst, IDLoc, Instructions))
593 for (
const MCInst &
I : Instructions) {
599 case Match_MissingFeature:
601 "instruction requires a CPU feature not currently enabled");
603 case Match_InvalidOperand: {
604 SMLoc ErrorLoc = IDLoc;
605 if (ErrorInfo != ~0ULL) {
606 if (ErrorInfo >= Operands.
size())
607 return Error(IDLoc,
"too few operands for instruction");
609 ErrorLoc = ((SparcOperand &)*Operands[ErrorInfo]).getStartLoc();
610 if (ErrorLoc ==
SMLoc())
614 return Error(ErrorLoc,
"invalid operand for instruction");
616 case Match_MnemonicFail:
617 return Error(IDLoc,
"invalid instruction mnemonic");
622 bool SparcAsmParser::ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
631 unsigned regKind = SparcOperand::rk_None;
632 if (matchRegisterName(Tok, RegNo, regKind)) {
637 return Error(StartLoc,
"invalid register name");
648 Operands.
push_back(SparcOperand::CreateToken(Name, NameLoc));
657 SMLoc Loc = getLexer().getLoc();
658 return Error(Loc,
"unexpected token");
662 SMLoc Loc = getLexer().getLoc();
663 return Error(Loc,
"unexpected token");
674 SMLoc Loc = getLexer().getLoc();
675 return Error(Loc,
"unexpected token");
680 SMLoc Loc = getLexer().getLoc();
681 return Error(Loc,
"unexpected token");
687 bool SparcAsmParser::
688 ParseDirective(
AsmToken DirectiveID)
692 if (IDVal ==
".register") {
697 if (IDVal ==
".proc") {
711 unsigned BaseReg = 0;
713 if (ParseRegister(BaseReg, S, E)) {
717 switch (getLexer().getKind()) {
723 Operands.
push_back(SparcOperand::CreateMEMr(BaseReg, S, E));
733 std::unique_ptr<SparcOperand>
Offset;
739 Offset->isImm() ? SparcOperand::MorphToMEMri(BaseReg, std::move(Offset))
740 : SparcOperand::MorphToMEMrr(BaseReg, std::move(Offset)));
758 Operands.
push_back(SparcOperand::CreateToken(
"[",
762 if (Mnemonic ==
"cas" || Mnemonic ==
"casx" || Mnemonic ==
"casa") {
774 Operands.
push_back(SparcOperand::CreateReg(RegNo, RegKind, S, E));
777 ResTy = parseMEMOperand(Operands);
786 Operands.
push_back(SparcOperand::CreateToken(
"]",
792 std::unique_ptr<SparcOperand>
Op;
793 ResTy = parseSparcAsmOperand(Op,
false);
801 std::unique_ptr<SparcOperand>
Op;
803 ResTy = parseSparcAsmOperand(Op, (Mnemonic ==
"call"));
814 SparcAsmParser::parseSparcAsmOperand(std::unique_ptr<SparcOperand> &
Op,
821 switch (getLexer().getKind()) {
834 Op = SparcOperand::CreateReg(RegNo, RegKind, S, E);
837 Op = SparcOperand::CreateToken(
"%psr", S);
840 Op = SparcOperand::CreateToken(
"%fsr", S);
843 Op = SparcOperand::CreateToken(
"%fq", S);
846 Op = SparcOperand::CreateToken(
"%csr", S);
849 Op = SparcOperand::CreateToken(
"%cq", S);
852 Op = SparcOperand::CreateToken(
"%wim", S);
855 Op = SparcOperand::CreateToken(
"%tbr", S);
859 Op = SparcOperand::CreateToken(
"%xcc", S);
861 Op = SparcOperand::CreateToken(
"%icc", S);
866 if (matchSparcAsmModifiers(EVal, E)) {
868 Op = SparcOperand::CreateImm(EVal, S, E);
876 if (!getParser().parseExpression(EVal, E))
877 Op = SparcOperand::CreateImm(EVal, S, E);
882 if (!getParser().parseIdentifier(Identifier)) {
884 MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
890 if (getContext().getObjectFileInfo()->isPositionIndependent()) {
899 Op = SparcOperand::CreateImm(Res, S, E);
908 SparcAsmParser::parseBranchModifiers(
OperandVector &Operands) {
917 if (modName ==
"a" || modName ==
"pn" || modName ==
"pt") {
918 Operands.
push_back(SparcOperand::CreateToken(modName,
926 bool SparcAsmParser::matchRegisterName(
const AsmToken &Tok,
unsigned &RegNo,
930 RegKind = SparcOperand::rk_None;
937 RegKind = SparcOperand::rk_IntReg;
943 RegKind = SparcOperand::rk_IntReg;
949 RegKind = SparcOperand::rk_Special;
955 && intVal > 0 && intVal < 32) {
956 RegNo = ASRRegs[intVal];
957 RegKind = SparcOperand::rk_Special;
962 if (name.
equals(
"fprs")) {
964 RegKind = SparcOperand::rk_Special;
970 RegKind = SparcOperand::rk_Special;
976 RegKind = SparcOperand::rk_Special;
982 RegKind = SparcOperand::rk_Special;
988 RegKind = SparcOperand::rk_Special;
994 RegKind = SparcOperand::rk_Special;
1000 RegKind = SparcOperand::rk_Special;
1004 if (name.
equals(
"wim")) {
1006 RegKind = SparcOperand::rk_Special;
1010 if (name.
equals(
"tbr")) {
1012 RegKind = SparcOperand::rk_Special;
1016 if (name.
equals(
"xcc")) {
1019 RegKind = SparcOperand::rk_Special;
1028 RegNo = Sparc::FCC0 + intVal;
1029 RegKind = SparcOperand::rk_Special;
1037 RegNo = IntRegs[intVal];
1038 RegKind = SparcOperand::rk_IntReg;
1045 RegNo = IntRegs[8 + intVal];
1046 RegKind = SparcOperand::rk_IntReg;
1052 RegNo = IntRegs[16 + intVal];
1053 RegKind = SparcOperand::rk_IntReg;
1059 RegNo = IntRegs[24 + intVal];
1060 RegKind = SparcOperand::rk_IntReg;
1066 RegNo = FloatRegs[intVal];
1067 RegKind = SparcOperand::rk_FloatReg;
1073 && intVal >= 32 && intVal <= 62 && (intVal % 2 == 0)) {
1075 RegNo = DoubleRegs[intVal/2];
1076 RegKind = SparcOperand::rk_DoubleReg;
1083 RegNo = IntRegs[intVal];
1084 RegKind = SparcOperand::rk_IntReg;
1092 RegNo = CoprocRegs[intVal];
1093 RegKind = SparcOperand::rk_CoprocReg;
1097 if (name.
equals(
"tpc")) {
1099 RegKind = SparcOperand::rk_Special;
1102 if (name.
equals(
"tnpc")) {
1103 RegNo = Sparc::TNPC;
1104 RegKind = SparcOperand::rk_Special;
1107 if (name.
equals(
"tstate")) {
1108 RegNo = Sparc::TSTATE;
1109 RegKind = SparcOperand::rk_Special;
1114 RegKind = SparcOperand::rk_Special;
1117 if (name.
equals(
"tick")) {
1118 RegNo = Sparc::TICK;
1119 RegKind = SparcOperand::rk_Special;
1122 if (name.
equals(
"tba")) {
1124 RegKind = SparcOperand::rk_Special;
1127 if (name.
equals(
"pstate")) {
1128 RegNo = Sparc::PSTATE;
1129 RegKind = SparcOperand::rk_Special;
1134 RegKind = SparcOperand::rk_Special;
1137 if (name.
equals(
"pil")) {
1139 RegKind = SparcOperand::rk_Special;
1142 if (name.
equals(
"cwp")) {
1144 RegKind = SparcOperand::rk_Special;
1147 if (name.
equals(
"cansave")) {
1148 RegNo = Sparc::CANSAVE;
1149 RegKind = SparcOperand::rk_Special;
1152 if (name.
equals(
"canrestore")) {
1153 RegNo = Sparc::CANRESTORE;
1154 RegKind = SparcOperand::rk_Special;
1157 if (name.
equals(
"cleanwin")) {
1158 RegNo = Sparc::CLEANWIN;
1159 RegKind = SparcOperand::rk_Special;
1162 if (name.
equals(
"otherwin")) {
1163 RegNo = Sparc::OTHERWIN;
1164 RegKind = SparcOperand::rk_Special;
1167 if (name.
equals(
"wstate")) {
1168 RegNo = Sparc::WSTATE;
1169 RegKind = SparcOperand::rk_Special;
1181 if (
const SparcMCExpr *SE = dyn_cast<SparcMCExpr>(Expr))
1212 if (getContext().getObjectFileInfo()->isPositionIndependent()) {
1229 bool SparcAsmParser::matchSparcAsmModifiers(
const MCExpr *&EVal,
1251 EVal = adjustPICRelocation(VK, subExpr);
1261 #define GET_REGISTER_MATCHER 1262 #define GET_MATCHER_IMPLEMENTATION 1263 #include "SparcGenAsmMatcher.inc" 1267 SparcOperand &Op = (SparcOperand &)GOp;
1268 if (Op.isFloatOrDoubleReg()) {
1272 if (!Op.isFloatReg() || SparcOperand::MorphToDoubleReg(Op))
1276 if (SparcOperand::MorphToQuadReg(Op))
1281 if (Op.isIntReg() && Kind == MCK_IntPair) {
1282 if (SparcOperand::MorphToIntPairReg(Op))
1285 if (Op.isCoprocReg() && Kind == MCK_CoprocPair) {
1286 if (SparcOperand::MorphToCoprocPairReg(Op))
1289 return Match_InvalidOperand;
static bool isReg(const MCInst &MI, unsigned OpNo)
void push_back(const T &Elt)
StringRef getString() const
Get the string for the current token, this includes all characters (for example, the quotes on string...
static const MCPhysReg IntRegs[32]
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Compute iterated dominance frontiers using a linear time algorithm.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
LLVM_NODISCARD bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
Generic assembler parser interface, for use by target specific assembly parsers.
static MCOperand createExpr(const MCExpr *Val)
MCTargetAsmParser - Generic interface to target specific assembly parsers.
static const MCPhysReg CoprocPairRegs[]
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
const AsmToken & getTok() const
Get the current AsmToken from the stream.
static const MCPhysReg ASRRegs[32]
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
static const MCPhysReg QuadFPRegs[32]
static void applyMnemonicAliases(StringRef &Mnemonic, uint64_t Features, unsigned VariantID)
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
static MCOperand createReg(unsigned Reg)
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.
Target independent representation for an assembler token.
Represent a reference to a symbol from inside an expression.
static bool isMem(const MachineInstr &MI, unsigned Op)
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
std::pair< StringRef, StringRef > getToken(StringRef Source, StringRef Delimiters=" \\\)
getToken - This function extracts one token from source, ignoring any leading characters that appear ...
RegisterMCAsmParser - Helper template for registering a target specific assembly parser, for use in the target machine initialization function.
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Target & getTheSparcTarget()
const MCExpr * getExpr() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Instances of this class represent a single low-level machine instruction.
void LLVMInitializeSparcAsmParser()
virtual void eatToEndOfStatement()=0
Skip to the end of the current statement, for error recovery.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
virtual void addAliasForDirective(StringRef Directive, StringRef Alias)=0
const char * getPointer() const
Streaming machine code generation interface.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static bool is64Bit(const char *name)
Interface to description of machine instruction set.
Target & getTheSparcelTarget()
static VariantKind parseVariantKind(StringRef name)
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static bool hasGOTReference(const MCExpr *Expr)
Binary assembler expressions.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
void setOpcode(unsigned Op)
const MCSymbol & getSymbol() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const MCOperand & getOperand(unsigned i) const
static const MCPhysReg CoprocRegs[32]
bool is(TokenKind K) const
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static const MCPhysReg IntPairRegs[]
Base class for user error types.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
Target & getTheSparcV9Target()
static SMLoc getFromPointer(const char *Ptr)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Generic base class for all target subtargets.
References to labels and assigned expressions.
static const SparcMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
StringRef getName() const
getName - Get the symbol name.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const MCPhysReg FloatRegs[32]
const FeatureBitset Features
This class implements an extremely fast bulk output stream that can only output to a stream...
bool isIntReg(unsigned Reg)
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
Target specific expression.
Represents a location in source code.
unsigned getOpcode() const
Instances of this class represent operands of the MCInst class.
virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression, assuming that an initial '(' has already been consumed.
static MCOperand createImm(int64_t Val)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
TokenKind getKind() const
static const MCPhysReg DoubleRegs[32]