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);
98 bool parseDirectiveWord(
unsigned Size,
SMLoc L);
113 setAvailableFeatures(ComputeAvailableFeatures(getSTI().getFeatureBits()));
120 Sparc::G0, Sparc::G1, Sparc::G2, Sparc::G3,
121 Sparc::G4, Sparc::G5, Sparc::G6, Sparc::G7,
122 Sparc::O0, Sparc::O1, Sparc::O2, Sparc::O3,
123 Sparc::O4, Sparc::O5, Sparc::O6, Sparc::O7,
124 Sparc::L0, Sparc::L1, Sparc::L2, Sparc::L3,
125 Sparc::L4, Sparc::L5, Sparc::L6, Sparc::L7,
126 Sparc::I0, Sparc::I1, Sparc::I2, Sparc::I3,
127 Sparc::I4, Sparc::I5, Sparc::I6, Sparc::I7 };
130 Sparc::F0, Sparc::F1, Sparc::F2, Sparc::F3,
131 Sparc::F4, Sparc::F5, Sparc::F6, Sparc::F7,
132 Sparc::F8, Sparc::F9, Sparc::F10, Sparc::F11,
133 Sparc::F12, Sparc::F13, Sparc::F14, Sparc::F15,
134 Sparc::F16, Sparc::F17, Sparc::F18, Sparc::F19,
135 Sparc::F20, Sparc::F21, Sparc::F22, Sparc::F23,
136 Sparc::F24, Sparc::F25, Sparc::F26, Sparc::F27,
137 Sparc::F28, Sparc::F29, Sparc::F30, Sparc::F31 };
140 Sparc::D0, Sparc::D1, Sparc::D2, Sparc::D3,
141 Sparc::D4, Sparc::D5, Sparc::D6, Sparc::D7,
142 Sparc::D8, Sparc::D9, Sparc::D10, Sparc::D11,
143 Sparc::D12, Sparc::D13, Sparc::D14, Sparc::D15,
144 Sparc::D16, Sparc::D17, Sparc::D18, Sparc::D19,
145 Sparc::D20, Sparc::D21, Sparc::D22, Sparc::D23,
146 Sparc::D24, Sparc::D25, Sparc::D26, Sparc::D27,
147 Sparc::D28, Sparc::D29, Sparc::D30, Sparc::D31 };
150 Sparc::Q0, Sparc::Q1, Sparc::Q2, Sparc::Q3,
151 Sparc::Q4, Sparc::Q5, Sparc::Q6, Sparc::Q7,
152 Sparc::Q8, Sparc::Q9, Sparc::Q10, Sparc::Q11,
153 Sparc::Q12, Sparc::Q13, Sparc::Q14, Sparc::Q15 };
156 SP::Y, SP::ASR1, SP::ASR2, SP::ASR3,
157 SP::ASR4, SP::ASR5, SP::ASR6, SP::ASR7,
158 SP::ASR8, SP::ASR9, SP::ASR10, SP::ASR11,
159 SP::ASR12, SP::ASR13, SP::ASR14, SP::ASR15,
160 SP::ASR16, SP::ASR17, SP::ASR18, SP::ASR19,
161 SP::ASR20, SP::ASR21, SP::ASR22, SP::ASR23,
162 SP::ASR24, SP::ASR25, SP::ASR26, SP::ASR27,
163 SP::ASR28, SP::ASR29, SP::ASR30, SP::ASR31};
166 Sparc::G0_G1, Sparc::G2_G3, Sparc::G4_G5, Sparc::G6_G7,
167 Sparc::O0_O1, Sparc::O2_O3, Sparc::O4_O5, Sparc::O6_O7,
168 Sparc::L0_L1, Sparc::L2_L3, Sparc::L4_L5, Sparc::L6_L7,
169 Sparc::I0_I1, Sparc::I2_I3, Sparc::I4_I5, Sparc::I6_I7};
172 Sparc::C0, Sparc::C1, Sparc::C2, Sparc::C3,
173 Sparc::C4, Sparc::C5, Sparc::C6, Sparc::C7,
174 Sparc::C8, Sparc::C9, Sparc::C10, Sparc::C11,
175 Sparc::C12, Sparc::C13, Sparc::C14, Sparc::C15,
176 Sparc::C16, Sparc::C17, Sparc::C18, Sparc::C19,
177 Sparc::C20, Sparc::C21, Sparc::C22, Sparc::C23,
178 Sparc::C24, Sparc::C25, Sparc::C26, Sparc::C27,
179 Sparc::C28, Sparc::C29, Sparc::C30, Sparc::C31 };
182 Sparc::C0_C1, Sparc::C2_C3, Sparc::C4_C5, Sparc::C6_C7,
183 Sparc::C8_C9, Sparc::C10_C11, Sparc::C12_C13, Sparc::C14_C15,
184 Sparc::C16_C17, Sparc::C18_C19, Sparc::C20_C21, Sparc::C22_C23,
185 Sparc::C24_C25, Sparc::C26_C27, Sparc::C28_C29, Sparc::C30_C31};
214 SMLoc StartLoc, EndLoc;
246 bool isToken()
const override {
return Kind == k_Token; }
247 bool isReg()
const override {
return Kind == k_Register; }
248 bool isImm()
const override {
return Kind == k_Immediate; }
249 bool isMem()
const override {
return isMEMrr() || isMEMri(); }
250 bool isMEMrr()
const {
return Kind == k_MemoryReg; }
251 bool isMEMri()
const {
return Kind == k_MemoryImm; }
254 return (
Kind == k_Register &&
Reg.Kind == rk_IntReg);
257 bool isFloatReg()
const {
258 return (
Kind == k_Register &&
Reg.Kind == rk_FloatReg);
261 bool isFloatOrDoubleReg()
const {
262 return (
Kind == k_Register && (
Reg.Kind == rk_FloatReg
263 ||
Reg.Kind == rk_DoubleReg));
266 bool isCoprocReg()
const {
267 return (
Kind == k_Register &&
Reg.Kind == rk_CoprocReg);
275 unsigned getReg()
const override {
276 assert((
Kind == k_Register) &&
"Invalid access!");
280 const MCExpr *getImm()
const {
281 assert((
Kind == k_Immediate) &&
"Invalid access!");
285 unsigned getMemBase()
const {
286 assert((
Kind == k_MemoryReg ||
Kind == k_MemoryImm) &&
"Invalid access!");
290 unsigned getMemOffsetReg()
const {
291 assert((
Kind == k_MemoryReg) &&
"Invalid access!");
292 return Mem.OffsetReg;
295 const MCExpr *getMemOff()
const {
296 assert((
Kind == k_MemoryImm) &&
"Invalid access!");
301 SMLoc getStartLoc()
const override {
305 SMLoc getEndLoc()
const override {
311 case k_Token: OS <<
"Token: " <<
getToken() <<
"\n";
break;
312 case k_Register: OS <<
"Reg: #" <<
getReg() <<
"\n";
break;
313 case k_Immediate: OS <<
"Imm: " << getImm() <<
"\n";
break;
314 case k_MemoryReg: OS <<
"Mem: " << getMemBase() <<
"+"
315 << getMemOffsetReg() <<
"\n";
break;
316 case k_MemoryImm:
assert(getMemOff() !=
nullptr);
317 OS <<
"Mem: " << getMemBase()
318 <<
"+" << *getMemOff()
323 void addRegOperands(
MCInst &Inst,
unsigned N)
const {
324 assert(N == 1 &&
"Invalid number of operands!");
328 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
329 assert(N == 1 &&
"Invalid number of operands!");
330 const MCExpr *Expr = getImm();
338 else if (
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Expr))
344 void addMEMrrOperands(
MCInst &Inst,
unsigned N)
const {
345 assert(N == 2 &&
"Invalid number of operands!");
349 assert(getMemOffsetReg() != 0 &&
"Invalid offset");
353 void addMEMriOperands(
MCInst &Inst,
unsigned N)
const {
354 assert(N == 2 &&
"Invalid number of operands!");
358 const MCExpr *Expr = getMemOff();
362 static std::unique_ptr<SparcOperand> CreateToken(
StringRef Str,
SMLoc S) {
363 auto Op = make_unique<SparcOperand>(k_Token);
364 Op->Tok.Data = Str.
data();
365 Op->Tok.Length = Str.
size();
371 static std::unique_ptr<SparcOperand> CreateReg(
unsigned RegNum,
unsigned Kind,
373 auto Op = make_unique<SparcOperand>(k_Register);
374 Op->Reg.RegNum = RegNum;
381 static std::unique_ptr<SparcOperand> CreateImm(
const MCExpr *Val,
SMLoc S,
383 auto Op = make_unique<SparcOperand>(k_Immediate);
390 static bool MorphToIntPairReg(SparcOperand &
Op) {
391 unsigned Reg = Op.getReg();
392 assert(Op.Reg.Kind == rk_IntReg);
393 unsigned regIdx = 32;
394 if (Reg >= Sparc::G0 && Reg <= Sparc::G7)
395 regIdx = Reg - Sparc::G0;
396 else if (Reg >= Sparc::O0 && Reg <= Sparc::O7)
397 regIdx = Reg - Sparc::O0 + 8;
398 else if (Reg >= Sparc::L0 && Reg <= Sparc::L7)
399 regIdx = Reg - Sparc::L0 + 16;
400 else if (Reg >= Sparc::I0 && Reg <= Sparc::I7)
401 regIdx = Reg - Sparc::I0 + 24;
402 if (regIdx % 2 || regIdx > 31)
405 Op.Reg.Kind = rk_IntPairReg;
409 static bool MorphToDoubleReg(SparcOperand &Op) {
410 unsigned Reg = Op.getReg();
411 assert(Op.Reg.Kind == rk_FloatReg);
412 unsigned regIdx = Reg - Sparc::F0;
413 if (regIdx % 2 || regIdx > 31)
416 Op.Reg.Kind = rk_DoubleReg;
420 static bool MorphToQuadReg(SparcOperand &Op) {
421 unsigned Reg = Op.getReg();
423 switch (Op.Reg.Kind) {
426 regIdx = Reg - Sparc::F0;
427 if (regIdx % 4 || regIdx > 31)
432 regIdx = Reg - Sparc::D0;
433 if (regIdx % 2 || regIdx > 31)
439 Op.Reg.Kind = rk_QuadReg;
443 static bool MorphToCoprocPairReg(SparcOperand &Op) {
444 unsigned Reg = Op.getReg();
445 assert(Op.Reg.Kind == rk_CoprocReg);
446 unsigned regIdx = 32;
447 if (Reg >= Sparc::C0 && Reg <= Sparc::C31)
448 regIdx = Reg - Sparc::C0;
449 if (regIdx % 2 || regIdx > 31)
452 Op.Reg.Kind = rk_CoprocPairReg;
456 static std::unique_ptr<SparcOperand>
457 MorphToMEMrr(
unsigned Base, std::unique_ptr<SparcOperand> Op) {
458 unsigned offsetReg = Op->getReg();
459 Op->Kind = k_MemoryReg;
461 Op->Mem.OffsetReg = offsetReg;
462 Op->Mem.Off =
nullptr;
466 static std::unique_ptr<SparcOperand>
468 auto Op = make_unique<SparcOperand>(k_MemoryReg);
470 Op->Mem.OffsetReg = Sparc::G0;
471 Op->Mem.Off =
nullptr;
477 static std::unique_ptr<SparcOperand>
478 MorphToMEMri(
unsigned Base, std::unique_ptr<SparcOperand> Op) {
479 const MCExpr *Imm = Op->getImm();
480 Op->Kind = k_MemoryImm;
482 Op->Mem.OffsetReg = 0;
490 bool SparcAsmParser::expandSET(
MCInst &Inst,
SMLoc IDLoc,
499 int64_t RawImmValue = IsImm ? MCValOp.
getImm() : 0;
502 if (RawImmValue < -2147483648LL || RawImmValue > 4294967295LL) {
504 "set: argument must be between -2147483648 and 4294967295");
509 int32_t ImmValue = RawImmValue;
513 bool IsEffectivelyImm13 =
514 IsImm && ((
is64Bit() ? 0 : -4096) <= ImmValue && ImmValue < 4096);
526 if (!IsEffectivelyImm13) {
547 if (!IsImm || IsEffectivelyImm13 || (ImmValue & 0x3ff)) {
550 if (IsEffectivelyImm13)
564 bool SparcAsmParser::MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
568 bool MatchingInlineAsm) {
571 unsigned MatchResult = MatchInstructionImpl(Operands, Inst, ErrorInfo,
573 switch (MatchResult) {
574 case Match_Success: {
581 if (expandSET(Inst, IDLoc, Instructions))
586 for (
const MCInst &
I : Instructions) {
592 case Match_MissingFeature:
594 "instruction requires a CPU feature not currently enabled");
596 case Match_InvalidOperand: {
597 SMLoc ErrorLoc = IDLoc;
598 if (ErrorInfo != ~0ULL) {
599 if (ErrorInfo >= Operands.
size())
600 return Error(IDLoc,
"too few operands for instruction");
602 ErrorLoc = ((SparcOperand &)*Operands[ErrorInfo]).getStartLoc();
603 if (ErrorLoc ==
SMLoc())
607 return Error(ErrorLoc,
"invalid operand for instruction");
609 case Match_MnemonicFail:
610 return Error(IDLoc,
"invalid instruction mnemonic");
615 bool SparcAsmParser::ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
617 const AsmToken &Tok = Parser.getTok();
624 unsigned regKind = SparcOperand::rk_None;
625 if (matchRegisterName(Tok, RegNo, regKind)) {
630 return Error(StartLoc,
"invalid register name");
641 Operands.
push_back(SparcOperand::CreateToken(Name, NameLoc));
650 SMLoc Loc = getLexer().getLoc();
651 return Error(Loc,
"unexpected token");
655 SMLoc Loc = getLexer().getLoc();
656 return Error(Loc,
"unexpected token");
662 Operands.
push_back(SparcOperand::CreateToken(
"+", Parser.getTok().getLoc()));
667 SMLoc Loc = getLexer().getLoc();
668 return Error(Loc,
"unexpected token");
673 SMLoc Loc = getLexer().getLoc();
674 return Error(Loc,
"unexpected token");
680 bool SparcAsmParser::
681 ParseDirective(
AsmToken DirectiveID)
685 if (IDVal ==
".byte")
686 return parseDirectiveWord(1, DirectiveID.
getLoc());
688 if (IDVal ==
".half")
689 return parseDirectiveWord(2, DirectiveID.
getLoc());
691 if (IDVal ==
".word")
692 return parseDirectiveWord(4, DirectiveID.
getLoc());
694 if (IDVal ==
".nword")
695 return parseDirectiveWord(
is64Bit() ? 8 : 4, DirectiveID.
getLoc());
697 if (
is64Bit() && IDVal ==
".xword")
698 return parseDirectiveWord(8, DirectiveID.
getLoc());
700 if (IDVal ==
".register") {
702 Parser.eatToEndOfStatement();
705 if (IDVal ==
".proc") {
708 Parser.eatToEndOfStatement();
716 bool SparcAsmParser:: parseDirectiveWord(
unsigned Size,
SMLoc L) {
720 if (getParser().parseExpression(Value))
723 getParser().getStreamer().EmitValue(Value, Size);
730 return Error(L,
"unexpected token in directive");
741 unsigned BaseReg = 0;
743 if (ParseRegister(BaseReg, S, E)) {
747 switch (getLexer().getKind()) {
753 Operands.
push_back(SparcOperand::CreateMEMr(BaseReg, S, E));
763 std::unique_ptr<SparcOperand>
Offset;
769 Offset->isImm() ? SparcOperand::MorphToMEMri(BaseReg, std::move(Offset))
770 : SparcOperand::MorphToMEMrr(BaseReg, std::move(Offset)));
788 Operands.
push_back(SparcOperand::CreateToken(
"[",
789 Parser.getTok().getLoc()));
792 if (Mnemonic ==
"cas" || Mnemonic ==
"casx" || Mnemonic ==
"casa") {
793 SMLoc S = Parser.getTok().getLoc();
798 unsigned RegNo, RegKind;
799 if (!matchRegisterName(Parser.getTok(), RegNo, RegKind))
804 Operands.
push_back(SparcOperand::CreateReg(RegNo, RegKind, S, E));
807 ResTy = parseMEMOperand(Operands);
816 Operands.
push_back(SparcOperand::CreateToken(
"]",
817 Parser.getTok().getLoc()));
822 std::unique_ptr<SparcOperand>
Op;
823 ResTy = parseSparcAsmOperand(Op,
false);
831 std::unique_ptr<SparcOperand>
Op;
833 ResTy = parseSparcAsmOperand(Op, (Mnemonic ==
"call"));
844 SparcAsmParser::parseSparcAsmOperand(std::unique_ptr<SparcOperand> &Op,
846 SMLoc S = Parser.getTok().getLoc();
851 switch (getLexer().getKind()) {
858 if (matchRegisterName(Parser.getTok(), RegNo, RegKind)) {
864 Op = SparcOperand::CreateReg(RegNo, RegKind, S, E);
867 Op = SparcOperand::CreateToken(
"%psr", S);
870 Op = SparcOperand::CreateToken(
"%fsr", S);
873 Op = SparcOperand::CreateToken(
"%fq", S);
876 Op = SparcOperand::CreateToken(
"%csr", S);
879 Op = SparcOperand::CreateToken(
"%cq", S);
882 Op = SparcOperand::CreateToken(
"%wim", S);
885 Op = SparcOperand::CreateToken(
"%tbr", S);
889 Op = SparcOperand::CreateToken(
"%xcc", S);
891 Op = SparcOperand::CreateToken(
"%icc", S);
896 if (matchSparcAsmModifiers(EVal, E)) {
898 Op = SparcOperand::CreateImm(EVal, S, E);
906 if (!getParser().parseExpression(EVal, E))
907 Op = SparcOperand::CreateImm(EVal, S, E);
912 if (!getParser().parseIdentifier(Identifier)) {
914 MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
918 if (isCall && getContext().getObjectFileInfo()->isPositionIndependent())
921 Op = SparcOperand::CreateImm(Res, S, E);
930 SparcAsmParser::parseBranchModifiers(
OperandVector &Operands) {
938 StringRef modName = Parser.getTok().getString();
939 if (modName ==
"a" || modName ==
"pn" || modName ==
"pt") {
940 Operands.
push_back(SparcOperand::CreateToken(modName,
941 Parser.getTok().getLoc()));
948 bool SparcAsmParser::matchRegisterName(
const AsmToken &Tok,
unsigned &RegNo,
952 RegKind = SparcOperand::rk_None;
959 RegKind = SparcOperand::rk_IntReg;
965 RegKind = SparcOperand::rk_IntReg;
971 RegKind = SparcOperand::rk_Special;
977 && intVal > 0 && intVal < 32) {
979 RegKind = SparcOperand::rk_Special;
984 if (name.
equals(
"fprs")) {
986 RegKind = SparcOperand::rk_Special;
992 RegKind = SparcOperand::rk_Special;
998 RegKind = SparcOperand::rk_Special;
1002 if (name.
equals(
"fsr")) {
1004 RegKind = SparcOperand::rk_Special;
1010 RegKind = SparcOperand::rk_Special;
1014 if (name.
equals(
"csr")) {
1015 RegNo = Sparc::CPSR;
1016 RegKind = SparcOperand::rk_Special;
1022 RegKind = SparcOperand::rk_Special;
1026 if (name.
equals(
"wim")) {
1028 RegKind = SparcOperand::rk_Special;
1032 if (name.
equals(
"tbr")) {
1034 RegKind = SparcOperand::rk_Special;
1038 if (name.
equals(
"xcc")) {
1041 RegKind = SparcOperand::rk_Special;
1050 RegNo = Sparc::FCC0 + intVal;
1051 RegKind = SparcOperand::rk_Special;
1060 RegKind = SparcOperand::rk_IntReg;
1068 RegKind = SparcOperand::rk_IntReg;
1075 RegKind = SparcOperand::rk_IntReg;
1082 RegKind = SparcOperand::rk_IntReg;
1089 RegKind = SparcOperand::rk_FloatReg;
1095 && intVal >= 32 && intVal <= 62 && (intVal % 2 == 0)) {
1098 RegKind = SparcOperand::rk_DoubleReg;
1106 RegKind = SparcOperand::rk_IntReg;
1115 RegKind = SparcOperand::rk_CoprocReg;
1119 if (name.
equals(
"tpc")) {
1121 RegKind = SparcOperand::rk_Special;
1124 if (name.
equals(
"tnpc")) {
1125 RegNo = Sparc::TNPC;
1126 RegKind = SparcOperand::rk_Special;
1129 if (name.
equals(
"tstate")) {
1130 RegNo = Sparc::TSTATE;
1131 RegKind = SparcOperand::rk_Special;
1136 RegKind = SparcOperand::rk_Special;
1139 if (name.
equals(
"tick")) {
1140 RegNo = Sparc::TICK;
1141 RegKind = SparcOperand::rk_Special;
1144 if (name.
equals(
"tba")) {
1146 RegKind = SparcOperand::rk_Special;
1149 if (name.
equals(
"pstate")) {
1150 RegNo = Sparc::PSTATE;
1151 RegKind = SparcOperand::rk_Special;
1156 RegKind = SparcOperand::rk_Special;
1159 if (name.
equals(
"pil")) {
1161 RegKind = SparcOperand::rk_Special;
1164 if (name.
equals(
"cwp")) {
1166 RegKind = SparcOperand::rk_Special;
1169 if (name.
equals(
"cansave")) {
1170 RegNo = Sparc::CANSAVE;
1171 RegKind = SparcOperand::rk_Special;
1174 if (name.
equals(
"canrestore")) {
1175 RegNo = Sparc::CANRESTORE;
1176 RegKind = SparcOperand::rk_Special;
1179 if (name.
equals(
"cleanwin")) {
1180 RegNo = Sparc::CLEANWIN;
1181 RegKind = SparcOperand::rk_Special;
1184 if (name.
equals(
"otherwin")) {
1185 RegNo = Sparc::OTHERWIN;
1186 RegKind = SparcOperand::rk_Special;
1189 if (name.
equals(
"wstate")) {
1190 RegNo = Sparc::WSTATE;
1191 RegKind = SparcOperand::rk_Special;
1203 if (
const SparcMCExpr *SE = dyn_cast<SparcMCExpr>(Expr))
1234 if (getContext().getObjectFileInfo()->isPositionIndependent()) {
1251 bool SparcAsmParser::matchSparcAsmModifiers(
const MCExpr *&EVal,
1270 if (Parser.parseParenExpression(subExpr, EndLoc))
1273 EVal = adjustPICRelocation(VK, subExpr);
1283 #define GET_REGISTER_MATCHER
1284 #define GET_MATCHER_IMPLEMENTATION
1285 #include "SparcGenAsmMatcher.inc"
1289 SparcOperand &Op = (SparcOperand &)GOp;
1290 if (Op.isFloatOrDoubleReg()) {
1294 if (!Op.isFloatReg() || SparcOperand::MorphToDoubleReg(Op))
1298 if (SparcOperand::MorphToQuadReg(Op))
1303 if (Op.isIntReg() && Kind == MCK_IntPair) {
1304 if (SparcOperand::MorphToIntPairReg(Op))
1307 if (Op.isCoprocReg() && Kind == MCK_CoprocPair) {
1308 if (SparcOperand::MorphToCoprocPairReg(Op))
1311 return Match_InvalidOperand;
static bool isReg(const MCInst &MI, unsigned OpNo)
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 push_back(const T &Elt)
static const MCPhysReg IntRegs[32]
const MCSymbol & getSymbol() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
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 bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
StringRef getString() const
Get the string for the current token, this includes all characters (for example, the quotes on string...
static const MCPhysReg ASRRegs[32]
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 MCOperand createReg(unsigned Reg)
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 ...
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.
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 ...
Reg
All possible values of the reg field in the ModR/M byte.
Target independent representation for an assembler token.
Represent a reference to a symbol from inside an expression.
Windows NT (Windows on ARM)
static bool isMem(const MachineInstr &MI, unsigned Op)
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
Target & getTheSparcTarget()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Instances of this class represent a single low-level machine instruction.
void LLVMInitializeSparcAsmParser()
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
const MCExpr * getExpr() const
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
Streaming machine code generation interface.
static bool is64Bit(const char *name)
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).
Interface to description of machine instruction set.
Target & getTheSparcelTarget()
static VariantKind parseVariantKind(StringRef name)
static bool hasGOTReference(const MCExpr *Expr)
Binary assembler expressions.
void setOpcode(unsigned Op)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static const MCPhysReg CoprocRegs[32]
bool is(TokenKind K) const
unsigned getOpcode() const
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static const MCPhysReg IntPairRegs[]
Base class for user error types.
Target & getTheSparcV9Target()
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static SMLoc getFromPointer(const char *Ptr)
llvm_unreachable("Unknown RegBank!")
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
RegisterMCAsmParser - Helper template for registering a target specific assembly parser, for use in the target machine initialization function.
StringRef getName() const
getName - Get the symbol name.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
MCSubtargetInfo - Generic base class for all target subtargets.
References to labels and assigned expressions.
static const SparcMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
static const MCPhysReg FloatRegs[32]
const FeatureBitset Features
This class implements an extremely fast bulk output stream that can only output to a stream...
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).
bool isIntReg(unsigned Reg)
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
Target specific expression.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
Represents a location in source code.
Instances of this class represent operands of the MCInst class.
static MCOperand createImm(int64_t Val)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
const MCOperand & getOperand(unsigned i) const
static const MCPhysReg DoubleRegs[32]