40 static bool inRange(
const MCExpr *Expr, int64_t MinValue, int64_t MaxValue) {
41 if (
auto *CE = dyn_cast<MCConstantExpr>(Expr)) {
42 int64_t
Value = CE->getValue();
43 return Value >= MinValue && Value <= MaxValue;
87 SMLoc StartLoc, EndLoc;
116 unsigned MemKind : 4;
144 else if (
auto *CE = dyn_cast<MCConstantExpr>(Expr))
151 SystemZOperand(OperandKind kind,
SMLoc startLoc,
SMLoc endLoc)
152 :
Kind(kind), StartLoc(startLoc), EndLoc(endLoc) {}
155 static std::unique_ptr<SystemZOperand> createInvalid(
SMLoc StartLoc,
157 return make_unique<SystemZOperand>(KindInvalid, StartLoc, EndLoc);
160 static std::unique_ptr<SystemZOperand> createToken(
StringRef Str,
SMLoc Loc) {
161 auto Op = make_unique<SystemZOperand>(KindToken, Loc, Loc);
162 Op->Token.Data = Str.
data();
163 Op->Token.Length = Str.
size();
167 static std::unique_ptr<SystemZOperand>
169 auto Op = make_unique<SystemZOperand>(KindReg, StartLoc, EndLoc);
175 static std::unique_ptr<SystemZOperand>
177 auto Op = make_unique<SystemZOperand>(KindImm, StartLoc, EndLoc);
182 static std::unique_ptr<SystemZOperand>
185 unsigned LengthReg,
SMLoc StartLoc,
SMLoc EndLoc) {
186 auto Op = make_unique<SystemZOperand>(KindMem, StartLoc, EndLoc);
187 Op->Mem.MemKind = MemKind;
192 if (MemKind == BDLMem)
193 Op->Mem.Length.Imm = LengthImm;
194 if (MemKind == BDRMem)
195 Op->Mem.Length.Reg = LengthReg;
199 static std::unique_ptr<SystemZOperand>
202 auto Op = make_unique<SystemZOperand>(KindImmTLS, StartLoc, EndLoc);
203 Op->ImmTLS.Imm = Imm;
204 Op->ImmTLS.Sym = Sym;
209 bool isToken()
const override {
210 return Kind == KindToken;
213 assert(Kind == KindToken &&
"Not a token");
214 return StringRef(Token.Data, Token.Length);
218 bool isReg()
const override {
219 return Kind == KindReg;
222 return Kind == KindReg &&
Reg.Kind ==
RegKind;
224 unsigned getReg()
const override {
225 assert(Kind == KindReg &&
"Not a register");
230 bool isImm()
const override {
231 return Kind == KindImm;
233 bool isImm(int64_t MinValue, int64_t MaxValue)
const {
234 return Kind == KindImm &&
inRange(Imm, MinValue, MaxValue);
236 const MCExpr *getImm()
const {
237 assert(Kind == KindImm &&
"Not an immediate");
242 bool isImmTLS()
const {
243 return Kind == KindImmTLS;
247 bool isMem()
const override {
248 return Kind == KindMem;
251 return (Kind == KindMem &&
252 (Mem.MemKind == MemKind ||
255 (Mem.MemKind == BDMem && MemKind == BDXMem)));
261 return isMem(MemKind, RegKind) &&
inRange(Mem.Disp, 0, 0xfff);
264 return isMem(MemKind, RegKind) &&
inRange(Mem.Disp, -524288, 524287);
267 return isMemDisp12(BDLMem, RegKind) &&
inRange(Mem.Length.Imm, 1, 0x10);
270 return isMemDisp12(BDLMem, RegKind) &&
inRange(Mem.Length.Imm, 1, 0x100);
274 SMLoc getStartLoc()
const override {
return StartLoc; }
275 SMLoc getEndLoc()
const override {
return EndLoc; }
284 void addRegOperands(
MCInst &Inst,
unsigned N)
const {
285 assert(N == 1 &&
"Invalid number of operands");
288 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
289 assert(N == 1 &&
"Invalid number of operands");
290 addExpr(Inst, getImm());
292 void addBDAddrOperands(
MCInst &Inst,
unsigned N)
const {
293 assert(N == 2 &&
"Invalid number of operands");
296 addExpr(Inst, Mem.Disp);
298 void addBDXAddrOperands(
MCInst &Inst,
unsigned N)
const {
299 assert(N == 3 &&
"Invalid number of operands");
302 addExpr(Inst, Mem.Disp);
305 void addBDLAddrOperands(
MCInst &Inst,
unsigned N)
const {
306 assert(N == 3 &&
"Invalid number of operands");
309 addExpr(Inst, Mem.Disp);
310 addExpr(Inst, Mem.Length.Imm);
312 void addBDRAddrOperands(
MCInst &Inst,
unsigned N)
const {
313 assert(N == 3 &&
"Invalid number of operands");
316 addExpr(Inst, Mem.Disp);
319 void addBDVAddrOperands(
MCInst &Inst,
unsigned N)
const {
320 assert(N == 3 &&
"Invalid number of operands");
323 addExpr(Inst, Mem.Disp);
326 void addImmTLSOperands(
MCInst &Inst,
unsigned N)
const {
327 assert(N == 2 &&
"Invalid number of operands");
328 assert(Kind == KindImmTLS &&
"Invalid operand type");
329 addExpr(Inst, ImmTLS.Imm);
331 addExpr(Inst, ImmTLS.Sym);
335 bool isGR32()
const {
return isReg(GR32Reg); }
336 bool isGRH32()
const {
return isReg(GRH32Reg); }
337 bool isGRX32()
const {
return false; }
338 bool isGR64()
const {
return isReg(GR64Reg); }
339 bool isGR128()
const {
return isReg(GR128Reg); }
340 bool isADDR32()
const {
return isReg(ADDR32Reg); }
341 bool isADDR64()
const {
return isReg(ADDR64Reg); }
342 bool isADDR128()
const {
return false; }
343 bool isFP32()
const {
return isReg(FP32Reg); }
344 bool isFP64()
const {
return isReg(FP64Reg); }
345 bool isFP128()
const {
return isReg(FP128Reg); }
346 bool isVR32()
const {
return isReg(VR32Reg); }
347 bool isVR64()
const {
return isReg(VR64Reg); }
348 bool isVF128()
const {
return false; }
349 bool isVR128()
const {
return isReg(VR128Reg); }
350 bool isAR32()
const {
return isReg(AR32Reg); }
351 bool isCR64()
const {
return isReg(CR64Reg); }
352 bool isAnyReg()
const {
return (
isReg() || isImm(0, 15)); }
353 bool isBDAddr32Disp12()
const {
return isMemDisp12(BDMem, ADDR32Reg); }
354 bool isBDAddr32Disp20()
const {
return isMemDisp20(BDMem, ADDR32Reg); }
355 bool isBDAddr64Disp12()
const {
return isMemDisp12(BDMem, ADDR64Reg); }
356 bool isBDAddr64Disp20()
const {
return isMemDisp20(BDMem, ADDR64Reg); }
357 bool isBDXAddr64Disp12()
const {
return isMemDisp12(BDXMem, ADDR64Reg); }
358 bool isBDXAddr64Disp20()
const {
return isMemDisp20(BDXMem, ADDR64Reg); }
359 bool isBDLAddr64Disp12Len4()
const {
return isMemDisp12Len4(ADDR64Reg); }
360 bool isBDLAddr64Disp12Len8()
const {
return isMemDisp12Len8(ADDR64Reg); }
361 bool isBDRAddr64Disp12()
const {
return isMemDisp12(BDRMem, ADDR64Reg); }
362 bool isBDVAddr64Disp12()
const {
return isMemDisp12(BDVMem, ADDR64Reg); }
363 bool isU1Imm()
const {
return isImm(0, 1); }
364 bool isU2Imm()
const {
return isImm(0, 3); }
365 bool isU3Imm()
const {
return isImm(0, 7); }
366 bool isU4Imm()
const {
return isImm(0, 15); }
367 bool isU6Imm()
const {
return isImm(0, 63); }
368 bool isU8Imm()
const {
return isImm(0, 255); }
369 bool isS8Imm()
const {
return isImm(-128, 127); }
370 bool isU12Imm()
const {
return isImm(0, 4095); }
371 bool isU16Imm()
const {
return isImm(0, 65535); }
372 bool isS16Imm()
const {
return isImm(-32768, 32767); }
373 bool isU32Imm()
const {
return isImm(0, (1LL << 32) - 1); }
374 bool isS32Imm()
const {
return isImm(-(1LL << 31), (1LL << 31) - 1); }
375 bool isU48Imm()
const {
return isImm(0, (1LL << 48) - 1); }
379 #define GET_ASSEMBLER_HEADER 380 #include "SystemZGenAsmMatcher.inc" 394 SMLoc StartLoc, EndLoc;
399 bool parseRegister(
Register &Reg, RegisterGroup Group,
const unsigned *
Regs,
400 bool IsAddress =
false);
403 RegisterGroup Group,
const unsigned *Regs,
408 bool parseAddress(
bool &HaveReg1,
Register &Reg1,
411 bool parseAddressRegister(
Register &Reg);
413 bool ParseDirectiveInsn(
SMLoc L);
420 int64_t MaxVal,
bool AllowTLS);
435 setAvailableFeatures(ComputeAvailableFeatures(getSTI().getFeatureBits()));
439 bool ParseDirective(
AsmToken DirectiveID)
override;
440 bool ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
SMLoc &EndLoc)
override;
443 bool MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
446 bool MatchingInlineAsm)
override;
501 return parseAnyRegister(Operands);
522 return parsePCRel(Operands, -(1LL << 12), (1LL << 12) - 1,
false);
525 return parsePCRel(Operands, -(1LL << 16), (1LL << 16) - 1,
false);
528 return parsePCRel(Operands, -(1LL << 24), (1LL << 24) - 1,
false);
531 return parsePCRel(Operands, -(1LL << 32), (1LL << 32) - 1,
false);
534 return parsePCRel(Operands, -(1LL << 16), (1LL << 16) - 1,
true);
537 return parsePCRel(Operands, -(1LL << 32), (1LL << 32) - 1,
true);
543 #define GET_REGISTER_MATCHER 544 #define GET_SUBTARGET_FEATURE_NAME 545 #define GET_MATCHER_IMPLEMENTATION 546 #define GET_MNEMONIC_SPELL_CHECKER 547 #include "SystemZGenAsmMatcher.inc" 555 MatchClassKind OperandKinds[5];
574 {
"e", SystemZ::InsnE, 1,
576 {
"ri", SystemZ::InsnRI, 3,
577 { MCK_U32Imm, MCK_AnyReg, MCK_S16Imm } },
578 {
"rie", SystemZ::InsnRIE, 4,
579 { MCK_U48Imm, MCK_AnyReg, MCK_AnyReg, MCK_PCRel16 } },
580 {
"ril", SystemZ::InsnRIL, 3,
581 { MCK_U48Imm, MCK_AnyReg, MCK_PCRel32 } },
582 {
"rilu", SystemZ::InsnRILU, 3,
583 { MCK_U48Imm, MCK_AnyReg, MCK_U32Imm } },
584 {
"ris", SystemZ::InsnRIS, 5,
585 { MCK_U48Imm, MCK_AnyReg, MCK_S8Imm, MCK_U4Imm, MCK_BDAddr64Disp12 } },
586 {
"rr", SystemZ::InsnRR, 3,
587 { MCK_U16Imm, MCK_AnyReg, MCK_AnyReg } },
588 {
"rre", SystemZ::InsnRRE, 3,
589 { MCK_U32Imm, MCK_AnyReg, MCK_AnyReg } },
590 {
"rrf", SystemZ::InsnRRF, 5,
591 { MCK_U32Imm, MCK_AnyReg, MCK_AnyReg, MCK_AnyReg, MCK_U4Imm } },
592 {
"rrs", SystemZ::InsnRRS, 5,
593 { MCK_U48Imm, MCK_AnyReg, MCK_AnyReg, MCK_U4Imm, MCK_BDAddr64Disp12 } },
594 {
"rs", SystemZ::InsnRS, 4,
595 { MCK_U32Imm, MCK_AnyReg, MCK_AnyReg, MCK_BDAddr64Disp12 } },
596 {
"rse", SystemZ::InsnRSE, 4,
597 { MCK_U48Imm, MCK_AnyReg, MCK_AnyReg, MCK_BDAddr64Disp12 } },
598 {
"rsi", SystemZ::InsnRSI, 4,
599 { MCK_U48Imm, MCK_AnyReg, MCK_AnyReg, MCK_PCRel16 } },
600 {
"rsy", SystemZ::InsnRSY, 4,
601 { MCK_U48Imm, MCK_AnyReg, MCK_AnyReg, MCK_BDAddr64Disp20 } },
602 {
"rx", SystemZ::InsnRX, 3,
603 { MCK_U32Imm, MCK_AnyReg, MCK_BDXAddr64Disp12 } },
604 {
"rxe", SystemZ::InsnRXE, 3,
605 { MCK_U48Imm, MCK_AnyReg, MCK_BDXAddr64Disp12 } },
606 {
"rxf", SystemZ::InsnRXF, 4,
607 { MCK_U48Imm, MCK_AnyReg, MCK_AnyReg, MCK_BDXAddr64Disp12 } },
608 {
"rxy", SystemZ::InsnRXY, 3,
609 { MCK_U48Imm, MCK_AnyReg, MCK_BDXAddr64Disp20 } },
610 {
"s", SystemZ::InsnS, 2,
611 { MCK_U32Imm, MCK_BDAddr64Disp12 } },
612 {
"si", SystemZ::InsnSI, 3,
613 { MCK_U32Imm, MCK_BDAddr64Disp12, MCK_S8Imm } },
614 {
"sil", SystemZ::InsnSIL, 3,
615 { MCK_U48Imm, MCK_BDAddr64Disp12, MCK_U16Imm } },
616 {
"siy", SystemZ::InsnSIY, 3,
617 { MCK_U48Imm, MCK_BDAddr64Disp20, MCK_U8Imm } },
618 {
"ss", SystemZ::InsnSS, 4,
619 { MCK_U48Imm, MCK_BDXAddr64Disp12, MCK_BDAddr64Disp12, MCK_AnyReg } },
620 {
"sse", SystemZ::InsnSSE, 3,
621 { MCK_U48Imm, MCK_BDAddr64Disp12, MCK_BDAddr64Disp12 } },
622 {
"ssf", SystemZ::InsnSSF, 4,
623 { MCK_U48Imm, MCK_BDAddr64Disp12, MCK_BDAddr64Disp12, MCK_AnyReg } }
631 bool SystemZAsmParser::parseRegister(
Register &
Reg) {
632 Reg.StartLoc = Parser.getTok().getLoc();
636 return Error(Parser.getTok().getLoc(),
"register expected");
641 return Error(Reg.StartLoc,
"invalid register");
646 return Error(Reg.StartLoc,
"invalid register");
651 return Error(Reg.StartLoc,
"invalid register");
654 if (Prefix ==
'r' && Reg.Num < 16)
656 else if (Prefix ==
'f' && Reg.Num < 16)
658 else if (Prefix ==
'v' && Reg.Num < 32)
660 else if (Prefix ==
'a' && Reg.Num < 16)
662 else if (Prefix ==
'c' && Reg.Num < 16)
665 return Error(Reg.StartLoc,
"invalid register");
667 Reg.EndLoc = Parser.getTok().getLoc();
678 bool SystemZAsmParser::parseRegister(
Register &Reg, RegisterGroup Group,
679 const unsigned *
Regs,
bool IsAddress) {
680 if (parseRegister(Reg))
682 if (Reg.Group != Group && !(Reg.Group == RegFP && Group == RegV))
683 return Error(Reg.StartLoc,
"invalid operand for instruction");
684 if (Regs && Regs[Reg.Num] == 0)
685 return Error(Reg.StartLoc,
"invalid register pair");
686 if (Reg.Num == 0 && IsAddress)
687 return Error(Reg.StartLoc,
"%r0 used in an address");
689 Reg.Num = Regs[Reg.Num];
695 SystemZAsmParser::parseRegister(
OperandVector &Operands, RegisterGroup Group,
701 bool IsAddress = (Kind == ADDR32Reg || Kind == ADDR64Reg);
702 if (parseRegister(Reg, Group, Regs, IsAddress))
705 Operands.
push_back(SystemZOperand::createReg(Kind, Reg.Num,
706 Reg.StartLoc, Reg.EndLoc));
712 SystemZAsmParser::parseAnyRegister(
OperandVector &Operands) {
716 SMLoc StartLoc = Parser.getTok().getLoc();
717 if (Parser.parseExpression(Register))
720 if (
auto *CE = dyn_cast<MCConstantExpr>(Register)) {
721 int64_t
Value = CE->getValue();
723 Error(StartLoc,
"invalid register");
731 Operands.
push_back(SystemZOperand::createImm(Register, StartLoc, EndLoc));
735 if (parseRegister(Reg))
741 if (Reg.Group == RegGR) {
745 else if (Reg.Group == RegFP) {
749 else if (Reg.Group == RegV) {
753 else if (Reg.Group == RegAR) {
757 else if (Reg.Group == RegCR) {
765 Operands.
push_back(SystemZOperand::createReg(Kind, RegNo,
766 Reg.StartLoc, Reg.EndLoc));
772 bool SystemZAsmParser::parseAddress(
bool &HaveReg1,
Register &Reg1,
777 if (getParser().parseExpression(Disp))
790 if (parseRegister(Reg1))
794 if (getParser().parseExpression(Length))
802 if (parseRegister(Reg2))
808 return Error(Parser.getTok().getLoc(),
"unexpected token in address");
816 SystemZAsmParser::parseAddressRegister(
Register &Reg) {
817 if (Reg.Group == RegV) {
818 Error(Reg.StartLoc,
"invalid use of vector addressing");
820 }
else if (Reg.Group != RegGR) {
821 Error(Reg.StartLoc,
"invalid address register");
823 }
else if (Reg.Num == 0) {
824 Error(Reg.StartLoc,
"%r0 used in an address");
835 SMLoc StartLoc = Parser.getTok().getLoc();
836 unsigned Base = 0,
Index = 0, LengthReg = 0;
838 bool HaveReg1, HaveReg2;
841 if (parseAddress(HaveReg1, Reg1, HaveReg2, Reg2, Disp, Length))
848 if (parseAddressRegister(Reg1))
850 Base = Regs[Reg1.Num];
854 Error(StartLoc,
"invalid use of length addressing");
858 Error(StartLoc,
"invalid use of indexed addressing");
865 if (parseAddressRegister(Reg1))
870 Index = Regs[Reg1.Num];
872 Base = Regs[Reg1.Num];
876 if (parseAddressRegister(Reg2))
878 Base = Regs[Reg2.Num];
882 Error(StartLoc,
"invalid use of length addressing");
889 if (parseAddressRegister(Reg2))
891 Base = Regs[Reg2.Num];
894 if (HaveReg1 && HaveReg2) {
895 Error(StartLoc,
"invalid use of indexed addressing");
900 Error(StartLoc,
"missing length in address");
906 if (!HaveReg1 || Reg1.Group != RegGR) {
907 Error(StartLoc,
"invalid operand for instruction");
913 if (parseAddressRegister(Reg2))
915 Base = Regs[Reg2.Num];
919 Error(StartLoc,
"invalid use of length addressing");
925 if (!HaveReg1 || Reg1.Group != RegV) {
926 Error(StartLoc,
"vector index required in address");
932 if (parseAddressRegister(Reg2))
934 Base = Regs[Reg2.Num];
938 Error(StartLoc,
"invalid use of length addressing");
946 Operands.
push_back(SystemZOperand::createMem(MemKind, RegKind, Base, Disp,
947 Index, Length, LengthReg,
952 bool SystemZAsmParser::ParseDirective(
AsmToken DirectiveID) {
955 if (IDVal ==
".insn")
956 return ParseDirectiveInsn(DirectiveID.
getLoc());
963 bool SystemZAsmParser::ParseDirectiveInsn(
SMLoc L) {
970 return Error(ErrorLoc,
"expected instruction format");
980 if (EntryRange.first == EntryRange.second)
981 return Error(ErrorLoc,
"unrecognized format");
996 return Error(StartLoc,
"unexpected token in directive");
1001 if (Kind == MCK_AnyReg)
1002 ResTy = parseAnyReg(Operands);
1003 else if (Kind == MCK_BDXAddr64Disp12 || Kind == MCK_BDXAddr64Disp20)
1004 ResTy = parseBDXAddr64(Operands);
1005 else if (Kind == MCK_BDAddr64Disp12 || Kind == MCK_BDAddr64Disp20)
1006 ResTy = parseBDAddr64(Operands);
1007 else if (Kind == MCK_PCRel32)
1008 ResTy = parsePCRel32(Operands);
1009 else if (Kind == MCK_PCRel16)
1010 ResTy = parsePCRel16(Operands);
1018 return Error(StartLoc,
"unexpected token in directive");
1023 Operands.
push_back(SystemZOperand::createImm(Expr, StartLoc, EndLoc));
1034 for (
size_t i = 0; i < Operands.
size(); i++) {
1039 unsigned Res = validateOperandClass(Operand, Kind);
1040 if (Res != Match_Success)
1044 SystemZOperand &ZOperand =
static_cast<SystemZOperand &
>(Operand);
1045 if (ZOperand.isReg())
1046 ZOperand.addRegOperands(Inst, 1);
1047 else if (ZOperand.isMem(BDMem))
1048 ZOperand.addBDAddrOperands(Inst, 2);
1049 else if (ZOperand.isMem(BDXMem))
1050 ZOperand.addBDXAddrOperands(Inst, 3);
1051 else if (ZOperand.isImm())
1052 ZOperand.addImmOperands(Inst, 1);
1063 bool SystemZAsmParser::ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
1066 if (parseRegister(Reg))
1068 if (Reg.Group == RegGR)
1070 else if (Reg.Group == RegFP)
1072 else if (Reg.Group == RegV)
1074 else if (Reg.Group == RegAR)
1076 else if (Reg.Group == RegCR)
1078 StartLoc = Reg.StartLoc;
1079 EndLoc = Reg.EndLoc;
1086 Operands.
push_back(SystemZOperand::createToken(Name, NameLoc));
1091 if (parseOperand(Operands, Name)) {
1098 if (parseOperand(Operands, Name)) {
1103 SMLoc Loc = getLexer().getLoc();
1104 return Error(Loc,
"unexpected token in argument list");
1113 bool SystemZAsmParser::parseOperand(
OperandVector &Operands,
1120 uint64_t AvailableFeatures = getAvailableFeatures();
1121 setAvailableFeatures(~(uint64_t)0);
1123 setAvailableFeatures(AvailableFeatures);
1139 if (parseRegister(Reg))
1141 Operands.
push_back(SystemZOperand::createInvalid(Reg.StartLoc, Reg.EndLoc));
1148 SMLoc StartLoc = Parser.getTok().getLoc();
1150 bool HaveReg1, HaveReg2;
1153 if (parseAddress(HaveReg1, Reg1, HaveReg2, Reg2, Expr, Length))
1157 if (HaveReg1 && Reg1.Group != RegGR && Reg1.Group != RegV
1158 && parseAddressRegister(Reg1))
1160 if (HaveReg2 && parseAddressRegister(Reg2))
1165 if (HaveReg1 || HaveReg2 || Length)
1166 Operands.
push_back(SystemZOperand::createInvalid(StartLoc, EndLoc));
1168 Operands.
push_back(SystemZOperand::createImm(Expr, StartLoc, EndLoc));
1173 unsigned VariantID = 0);
1175 bool SystemZAsmParser::MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &
Opcode,
1179 bool MatchingInlineAsm) {
1181 unsigned MatchResult;
1183 MatchResult = MatchInstructionImpl(Operands, Inst,
ErrorInfo,
1185 switch (MatchResult) {
1191 case Match_MissingFeature: {
1195 std::string Msg =
"instruction requires:";
1197 for (
unsigned I = 0;
I <
sizeof(
ErrorInfo) * 8 - 1; ++
I) {
1204 return Error(IDLoc, Msg);
1207 case Match_InvalidOperand: {
1208 SMLoc ErrorLoc = IDLoc;
1211 return Error(IDLoc,
"too few operands for instruction");
1213 ErrorLoc = ((SystemZOperand &)*Operands[
ErrorInfo]).getStartLoc();
1214 if (ErrorLoc ==
SMLoc())
1217 return Error(ErrorLoc,
"invalid operand for instruction");
1220 case Match_MnemonicFail: {
1221 uint64_t FBS = ComputeAvailableFeatures(getSTI().getFeatureBits());
1223 ((SystemZOperand &)*Operands[0]).
getToken(), FBS);
1224 return Error(IDLoc,
"invalid instruction" + Suggestion,
1225 ((SystemZOperand &)*Operands[0]).getLocRange());
1233 SystemZAsmParser::parsePCRel(
OperandVector &Operands, int64_t MinVal,
1234 int64_t MaxVal,
bool AllowTLS) {
1238 SMLoc StartLoc = Parser.getTok().getLoc();
1239 if (getParser().parseExpression(Expr))
1244 if (
auto *CE = dyn_cast<MCConstantExpr>(Expr)) {
1245 int64_t
Value = CE->getValue();
1247 Error(StartLoc,
"offset out of range");
1258 const MCExpr *Sym =
nullptr;
1263 Error(Parser.getTok().getLoc(),
"unexpected token");
1268 StringRef Name = Parser.getTok().getString();
1269 if (Name ==
"tls_gdcall")
1271 else if (Name ==
"tls_ldcall")
1274 Error(Parser.getTok().getLoc(),
"unknown TLS tag");
1280 Error(Parser.getTok().getLoc(),
"unexpected token");
1286 Error(Parser.getTok().getLoc(),
"unexpected token");
1300 Operands.
push_back(SystemZOperand::createImmTLS(Expr, Sym,
1303 Operands.
push_back(SystemZOperand::createImm(Expr, StartLoc, EndLoc));
static bool isReg(const MCInst &MI, unsigned OpNo)
Represents a range in source code.
void push_back(const T &Elt)
const_iterator end(StringRef path)
Get end iterator over path.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
const unsigned GR32Regs[16]
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Compute iterated dominance frontiers using a linear time algorithm.
const unsigned FP128Regs[16]
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.
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
static MCOperand createExpr(const MCExpr *Val)
MCTargetAsmParser - Generic interface to target specific assembly parsers.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
MatchClassKind OperandKinds[5]
const unsigned FP32Regs[16]
static struct InsnMatchEntry InsnMatchTable[]
const AsmToken & getTok() const
Get the current AsmToken from the 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).
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
const unsigned VR64Regs[32]
StringRef getIdentifier() const
Get the identifier string for the current token, which should be an identifier or a string...
static MCOperand createReg(unsigned Reg)
const unsigned AR32Regs[16]
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.
const unsigned GRH32Regs[16]
static bool isMem(const MachineInstr &MI, unsigned Op)
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
Context object for machine code objects.
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.
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).
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
const unsigned CR64Regs[16]
Instances of this class represent a single low-level machine instruction.
static std::string SystemZMnemonicSpellCheck(StringRef S, uint64_t FBS, unsigned VariantID=0)
virtual void addAliasForDirective(StringRef Directive, StringRef Alias)=0
const char * getPointer() const
Streaming machine code generation interface.
MCSymbol * createTempSymbol(bool CanBeUnnamed=true)
Create and return a new assembler temporary symbol with a unique but unspecified name.
static bool inRange(const MCExpr *Expr, int64_t MinValue, int64_t MaxValue)
Interface to description of machine instruction set.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#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.
virtual MCStreamer & getStreamer()=0
Return the output streamer for the assembler.
void LLVMInitializeSystemZAsmParser()
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const unsigned FP64Regs[16]
virtual SMLoc getStartLoc() const =0
getStartLoc - Get the location of the first token of this operand.
Promote Memory to Register
const unsigned GR128Regs[16]
const unsigned GR64Regs[16]
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
Base class for user error types.
static SMLoc getFromPointer(const char *Ptr)
Target & getTheSystemZTarget()
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Generic base class for all target subtargets.
const unsigned VR32Regs[32]
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
virtual void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
This class implements an extremely fast bulk output stream that can only output to a stream...
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
virtual bool parseIdentifier(StringRef &Res)=0
Parse an identifier or string (as a quoted identifier) and set Res to the identifier contents...
Represents a location in source code.
static const char * getSubtargetFeatureName(uint64_t Val)
static MCOperand createImm(int64_t Val)
const unsigned VR128Regs[32]