74 SMLoc getLoc()
const {
return getParser().getTok().getLoc(); }
79 bool parseCondCode(
OperandVector &Operands,
bool invertCondCode);
81 int tryParseRegister();
84 bool parseSymbolicImmVal(
const MCExpr *&ImmVal);
91 bool parseDirectiveArch(
SMLoc L);
92 bool parseDirectiveCPU(
SMLoc L);
93 bool parseDirectiveWord(
unsigned Size,
SMLoc L);
94 bool parseDirectiveInst(
SMLoc L);
96 bool parseDirectiveTLSDescCall(
SMLoc L);
99 bool parseDirectiveLtorg(
SMLoc L);
102 bool parseDirectiveUnreq(
SMLoc L);
105 bool MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
108 bool MatchingInlineAsm)
override;
112 #define GET_ASSEMBLER_HEADER
113 #include "AArch64GenAsmMatcher.inc"
133 enum AArch64MatchResultTy {
134 Match_InvalidSuffix = FIRST_TARGET_MATCH_RESULT_TY,
135 #define GET_OPERAND_DIAGNOSTIC_TYPES
136 #include "AArch64GenAsmMatcher.inc"
150 setAvailableFeatures(ComputeAvailableFeatures(getSTI().getFeatureBits()));
155 bool ParseRegister(
unsigned &RegNo,
SMLoc &StartLoc,
SMLoc &EndLoc)
override;
156 bool ParseDirective(
AsmToken DirectiveID)
override;
158 unsigned Kind)
override;
160 static bool classifySymbolRef(
const MCExpr *Expr,
187 SMLoc StartLoc, EndLoc;
200 struct VectorListOp {
203 unsigned NumElements;
204 unsigned ElementKind;
207 struct VectorIndexOp {
215 struct ShiftedImmOp {
217 unsigned ShiftAmount;
258 struct ShiftExtendOp {
261 bool HasExplicitAmount;
271 struct VectorListOp VectorList;
272 struct VectorIndexOp VectorIndex;
274 struct ShiftedImmOp ShiftedImm;
276 struct FPImmOp FPImm;
278 struct SysRegOp SysReg;
279 struct SysCRImmOp SysCRImm;
281 struct PSBHintOp PSBHint;
282 struct ShiftExtendOp ShiftExtend;
290 AArch64Operand(KindTy K,
MCContext &Ctx) :
Kind(K), Ctx(Ctx) {}
294 StartLoc = o.StartLoc;
304 ShiftedImm = o.ShiftedImm;
319 VectorList = o.VectorList;
322 VectorIndex = o.VectorIndex;
328 SysCRImm = o.SysCRImm;
337 ShiftExtend = o.ShiftExtend;
343 SMLoc getStartLoc()
const override {
return StartLoc; }
345 SMLoc getEndLoc()
const override {
return EndLoc; }
352 bool isTokenSuffix()
const {
357 const MCExpr *getImm()
const {
358 assert(
Kind == k_Immediate &&
"Invalid access!");
362 const MCExpr *getShiftedImmVal()
const {
363 assert(
Kind == k_ShiftedImm &&
"Invalid access!");
364 return ShiftedImm.Val;
367 unsigned getShiftedImmShift()
const {
368 assert(
Kind == k_ShiftedImm &&
"Invalid access!");
369 return ShiftedImm.ShiftAmount;
373 assert(
Kind == k_CondCode &&
"Invalid access!");
377 unsigned getFPImm()
const {
382 unsigned getBarrier()
const {
383 assert(
Kind == k_Barrier &&
"Invalid access!");
388 assert(
Kind == k_Barrier &&
"Invalid access!");
392 unsigned getReg()
const override {
393 assert(
Kind == k_Register &&
"Invalid access!");
397 unsigned getVectorListStart()
const {
398 assert(
Kind == k_VectorList &&
"Invalid access!");
399 return VectorList.RegNum;
402 unsigned getVectorListCount()
const {
403 assert(
Kind == k_VectorList &&
"Invalid access!");
404 return VectorList.Count;
407 unsigned getVectorIndex()
const {
408 assert(
Kind == k_VectorIndex &&
"Invalid access!");
409 return VectorIndex.Val;
413 assert(
Kind == k_SysReg &&
"Invalid access!");
414 return StringRef(SysReg.Data, SysReg.Length);
417 unsigned getSysCR()
const {
422 unsigned getPrefetch()
const {
423 assert(
Kind == k_Prefetch &&
"Invalid access!");
427 unsigned getPSBHint()
const {
428 assert(
Kind == k_PSBHint &&
"Invalid access!");
433 assert(
Kind == k_PSBHint &&
"Invalid access!");
434 return StringRef(PSBHint.Data, PSBHint.Length);
438 assert(
Kind == k_Prefetch &&
"Invalid access!");
443 assert(
Kind == k_ShiftExtend &&
"Invalid access!");
444 return ShiftExtend.Type;
447 unsigned getShiftExtendAmount()
const {
448 assert(
Kind == k_ShiftExtend &&
"Invalid access!");
449 return ShiftExtend.Amount;
452 bool hasShiftExtendAmount()
const {
453 assert(
Kind == k_ShiftExtend &&
"Invalid access!");
454 return ShiftExtend.HasExplicitAmount;
457 bool isImm()
const override {
return Kind == k_Immediate; }
458 bool isMem()
const override {
return false; }
459 bool isSImm9()
const {
466 return (Val >= -256 && Val < 256);
468 bool isSImm7s4()
const {
475 return (Val >= -256 && Val <= 252 && (Val & 3) == 0);
477 bool isSImm7s8()
const {
484 return (Val >= -512 && Val <= 504 && (Val & 7) == 0);
486 bool isSImm7s16()
const {
493 return (Val >= -1024 && Val <= 1008 && (Val & 15) == 0);
496 bool isSymbolicUImm12Offset(
const MCExpr *Expr,
unsigned Scale)
const {
500 if (!AArch64AsmParser::classifySymbolRef(Expr, ELFRefKind, DarwinRefKind,
519 return Addend >= 0 && (Addend % Scale) == 0;
529 template <
int Scale>
bool isUImm12Offset()
const {
535 return isSymbolicUImm12Offset(getImm(), Scale);
538 return (Val % Scale) == 0 && Val >= 0 && (Val / Scale) < 0x1000;
541 template <
int N,
int M>
542 bool isImmInRange()
const {
549 return (Val >=
N && Val <= M);
552 bool isLogicalImm32()
const {
559 if (Val >> 32 != 0 && Val >> 32 != ~0LL)
565 bool isLogicalImm64()
const {
574 bool isLogicalImm32Not()
const {
580 int64_t Val = ~MCE->
getValue() & 0xFFFFFFFF;
584 bool isLogicalImm64Not()
const {
593 bool isShiftedImm()
const {
return Kind == k_ShiftedImm; }
595 bool isAddSubImm()
const {
596 if (!isShiftedImm() && !isImm())
602 if (isShiftedImm()) {
603 unsigned Shift = ShiftedImm.ShiftAmount;
604 Expr = ShiftedImm.Val;
605 if (Shift != 0 && Shift != 12)
614 if (AArch64AsmParser::classifySymbolRef(Expr, ELFRefKind,
615 DarwinRefKind, Addend)) {
630 if (
auto *CE = dyn_cast<MCConstantExpr>(Expr))
631 return CE->getValue() >= 0 &&
CE->getValue() <= 0xfff;
638 bool isAddSubImmNeg()
const {
639 if (!isShiftedImm() && !isImm())
645 if (isShiftedImm()) {
646 unsigned Shift = ShiftedImm.ShiftAmount;
647 Expr = ShiftedImm.Val;
648 if (Shift != 0 && Shift != 12)
658 bool isCondCode()
const {
return Kind == k_CondCode; }
660 bool isSIMDImmType10()
const {
670 bool isBranchTarget()
const {
679 assert(
N > 0 &&
"Branch target immediate cannot be 0 bits!");
680 return (Val >= -((1<<(
N-1)) << 2) && Val <= (((1<<(
N-1))-1) << 2));
691 if (!AArch64AsmParser::classifySymbolRef(getImm(), ELFRefKind,
692 DarwinRefKind, Addend)) {
698 for (
unsigned i = 0; i != AllowedModifiers.
size(); ++i) {
699 if (ELFRefKind == AllowedModifiers[i])
706 bool isMovZSymbolG3()
const {
710 bool isMovZSymbolG2()
const {
716 bool isMovZSymbolG1()
const {
717 return isMovWSymbol({
724 bool isMovZSymbolG0()
const {
730 bool isMovKSymbolG3()
const {
734 bool isMovKSymbolG2()
const {
738 bool isMovKSymbolG1()
const {
744 bool isMovKSymbolG0()
const {
750 template<
int RegW
idth,
int Shift>
752 if (!isImm())
return false;
755 if (!CE)
return false;
761 template<
int RegW
idth,
int Shift>
763 if (!isImm())
return false;
766 if (!CE)
return false;
772 bool isFPImm()
const {
return Kind == k_FPImm; }
773 bool isBarrier()
const {
return Kind == k_Barrier; }
774 bool isSysReg()
const {
return Kind == k_SysReg; }
776 bool isMRSSystemRegister()
const {
777 if (!isSysReg())
return false;
779 return SysReg.MRSReg != -1U;
782 bool isMSRSystemRegister()
const {
783 if (!isSysReg())
return false;
784 return SysReg.MSRReg != -1U;
787 bool isSystemPStateFieldWithImm0_1()
const {
788 if (!isSysReg())
return false;
789 return (SysReg.PStateField == AArch64PState::PAN ||
790 SysReg.PStateField == AArch64PState::UAO);
793 bool isSystemPStateFieldWithImm0_15()
const {
794 if (!isSysReg() || isSystemPStateFieldWithImm0_1())
return false;
795 return SysReg.PStateField != -1U;
798 bool isReg()
const override {
return Kind == k_Register && !
Reg.isVector; }
799 bool isVectorReg()
const {
return Kind == k_Register &&
Reg.isVector; }
801 bool isVectorRegLo()
const {
802 return Kind == k_Register &&
Reg.isVector &&
803 AArch64MCRegisterClasses[AArch64::FPR128_loRegClassID].contains(
807 bool isGPR32as64()
const {
808 return Kind == k_Register && !
Reg.isVector &&
809 AArch64MCRegisterClasses[AArch64::GPR64RegClassID].contains(
Reg.RegNum);
812 bool isWSeqPair()
const {
813 return Kind == k_Register && !
Reg.isVector &&
814 AArch64MCRegisterClasses[AArch64::WSeqPairsClassRegClassID].contains(
818 bool isXSeqPair()
const {
819 return Kind == k_Register && !
Reg.isVector &&
820 AArch64MCRegisterClasses[AArch64::XSeqPairsClassRegClassID].contains(
824 bool isGPR64sp0()
const {
825 return Kind == k_Register && !
Reg.isVector &&
826 AArch64MCRegisterClasses[AArch64::GPR64spRegClassID].contains(
Reg.RegNum);
831 template <
unsigned NumRegs>
bool isImplicitlyTypedVectorList()
const {
832 return Kind == k_VectorList && VectorList.Count == NumRegs &&
833 !VectorList.ElementKind;
836 template <
unsigned NumRegs,
unsigned NumElements,
char ElementKind>
837 bool isTypedVectorList()
const {
838 if (
Kind != k_VectorList)
840 if (VectorList.Count != NumRegs)
842 if (VectorList.ElementKind != ElementKind)
844 return VectorList.NumElements == NumElements;
847 bool isVectorIndex1()
const {
848 return Kind == k_VectorIndex && VectorIndex.Val == 1;
851 bool isVectorIndexB()
const {
852 return Kind == k_VectorIndex && VectorIndex.Val < 16;
855 bool isVectorIndexH()
const {
856 return Kind == k_VectorIndex && VectorIndex.Val < 8;
859 bool isVectorIndexS()
const {
860 return Kind == k_VectorIndex && VectorIndex.Val < 4;
863 bool isVectorIndexD()
const {
864 return Kind == k_VectorIndex && VectorIndex.Val < 2;
867 bool isToken()
const override {
return Kind == k_Token; }
872 bool isSysCR()
const {
return Kind == k_SysCR; }
873 bool isPrefetch()
const {
return Kind == k_Prefetch; }
874 bool isPSBHint()
const {
return Kind == k_PSBHint; }
875 bool isShiftExtend()
const {
return Kind == k_ShiftExtend; }
876 bool isShifter()
const {
877 if (!isShiftExtend())
885 bool isExtend()
const {
886 if (!isShiftExtend())
895 getShiftExtendAmount() <= 4;
898 bool isExtend64()
const {
906 bool isExtendLSL64()
const {
912 getShiftExtendAmount() <= 4;
915 template<
int W
idth>
bool isMemXExtend()
const {
920 (getShiftExtendAmount() ==
Log2_32(Width / 8) ||
921 getShiftExtendAmount() == 0);
924 template<
int W
idth>
bool isMemWExtend()
const {
929 (getShiftExtendAmount() ==
Log2_32(Width / 8) ||
930 getShiftExtendAmount() == 0);
933 template <
unsigned w
idth>
934 bool isArithmeticShifter()
const {
944 template <
unsigned w
idth>
945 bool isLogicalShifter()
const {
953 getShiftExtendAmount() < width;
956 bool isMovImm32Shifter()
const {
964 uint64_t Val = getShiftExtendAmount();
965 return (Val == 0 || Val == 16);
968 bool isMovImm64Shifter()
const {
976 uint64_t Val = getShiftExtendAmount();
977 return (Val == 0 || Val == 16 || Val == 32 || Val == 48);
980 bool isLogicalVecShifter()
const {
985 unsigned Shift = getShiftExtendAmount();
987 (Shift == 0 || Shift == 8 || Shift == 16 || Shift == 24);
990 bool isLogicalVecHalfWordShifter()
const {
991 if (!isLogicalVecShifter())
995 unsigned Shift = getShiftExtendAmount();
997 (Shift == 0 || Shift == 8);
1000 bool isMoveVecShifter()
const {
1001 if (!isShiftExtend())
1005 unsigned Shift = getShiftExtendAmount();
1007 (Shift == 8 || Shift == 16);
1016 bool isSImm9OffsetFB()
const {
1017 return isSImm9() && !isUImm12Offset<Width / 8>();
1020 bool isAdrpLabel()
const {
1026 if (
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Imm.Val)) {
1028 int64_t
Min = - (4096 * (1LL << (21 - 1)));
1029 int64_t
Max = 4096 * ((1LL << (21 - 1)) - 1);
1030 return (Val % 4096) == 0 && Val >= Min && Val <=
Max;
1036 bool isAdrLabel()
const {
1042 if (
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Imm.Val)) {
1044 int64_t
Min = - (1LL << (21 - 1));
1045 int64_t
Max = ((1LL << (21 - 1)) - 1);
1046 return Val >= Min && Val <=
Max;
1056 else if (
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Expr))
1062 void addRegOperands(
MCInst &Inst,
unsigned N)
const {
1063 assert(N == 1 &&
"Invalid number of operands!");
1067 void addGPR32as64Operands(
MCInst &Inst,
unsigned N)
const {
1068 assert(N == 1 &&
"Invalid number of operands!");
1070 AArch64MCRegisterClasses[AArch64::GPR64RegClassID].
contains(
getReg()));
1079 void addVectorReg64Operands(
MCInst &Inst,
unsigned N)
const {
1080 assert(N == 1 &&
"Invalid number of operands!");
1082 AArch64MCRegisterClasses[AArch64::FPR128RegClassID].
contains(
getReg()));
1086 void addVectorReg128Operands(
MCInst &Inst,
unsigned N)
const {
1087 assert(N == 1 &&
"Invalid number of operands!");
1089 AArch64MCRegisterClasses[AArch64::FPR128RegClassID].
contains(
getReg()));
1093 void addVectorRegLoOperands(
MCInst &Inst,
unsigned N)
const {
1094 assert(N == 1 &&
"Invalid number of operands!");
1098 template <
unsigned NumRegs>
1099 void addVectorList64Operands(
MCInst &Inst,
unsigned N)
const {
1100 assert(N == 1 &&
"Invalid number of operands!");
1101 static const unsigned FirstRegs[] = { AArch64::D0,
1104 AArch64::D0_D1_D2_D3 };
1105 unsigned FirstReg = FirstRegs[NumRegs - 1];
1111 template <
unsigned NumRegs>
1112 void addVectorList128Operands(
MCInst &Inst,
unsigned N)
const {
1113 assert(N == 1 &&
"Invalid number of operands!");
1114 static const unsigned FirstRegs[] = { AArch64::Q0,
1117 AArch64::Q0_Q1_Q2_Q3 };
1118 unsigned FirstReg = FirstRegs[NumRegs - 1];
1124 void addVectorIndex1Operands(
MCInst &Inst,
unsigned N)
const {
1125 assert(N == 1 &&
"Invalid number of operands!");
1129 void addVectorIndexBOperands(
MCInst &Inst,
unsigned N)
const {
1130 assert(N == 1 &&
"Invalid number of operands!");
1134 void addVectorIndexHOperands(
MCInst &Inst,
unsigned N)
const {
1135 assert(N == 1 &&
"Invalid number of operands!");
1139 void addVectorIndexSOperands(
MCInst &Inst,
unsigned N)
const {
1140 assert(N == 1 &&
"Invalid number of operands!");
1144 void addVectorIndexDOperands(
MCInst &Inst,
unsigned N)
const {
1145 assert(N == 1 &&
"Invalid number of operands!");
1149 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
1150 assert(N == 1 &&
"Invalid number of operands!");
1154 addExpr(Inst, getImm());
1157 void addAddSubImmOperands(
MCInst &Inst,
unsigned N)
const {
1158 assert(N == 2 &&
"Invalid number of operands!");
1159 if (isShiftedImm()) {
1160 addExpr(Inst, getShiftedImmVal());
1163 addExpr(Inst, getImm());
1168 void addAddSubImmNegOperands(
MCInst &Inst,
unsigned N)
const {
1169 assert(N == 2 &&
"Invalid number of operands!");
1171 const MCExpr *MCE = isShiftedImm() ? getShiftedImmVal() : getImm();
1174 unsigned ShiftAmt = isShiftedImm() ? ShiftedImm.ShiftAmount : 0;
1180 void addCondCodeOperands(
MCInst &Inst,
unsigned N)
const {
1181 assert(N == 1 &&
"Invalid number of operands!");
1185 void addAdrpLabelOperands(
MCInst &Inst,
unsigned N)
const {
1186 assert(N == 1 &&
"Invalid number of operands!");
1189 addExpr(Inst, getImm());
1194 void addAdrLabelOperands(
MCInst &Inst,
unsigned N)
const {
1195 addImmOperands(Inst, N);
1199 void addUImm12OffsetOperands(
MCInst &Inst,
unsigned N)
const {
1200 assert(N == 1 &&
"Invalid number of operands!");
1210 void addSImm9Operands(
MCInst &Inst,
unsigned N)
const {
1211 assert(N == 1 &&
"Invalid number of operands!");
1216 void addSImm7s4Operands(
MCInst &Inst,
unsigned N)
const {
1217 assert(N == 1 &&
"Invalid number of operands!");
1222 void addSImm7s8Operands(
MCInst &Inst,
unsigned N)
const {
1223 assert(N == 1 &&
"Invalid number of operands!");
1228 void addSImm7s16Operands(
MCInst &Inst,
unsigned N)
const {
1229 assert(N == 1 &&
"Invalid number of operands!");
1234 void addImm0_1Operands(
MCInst &Inst,
unsigned N)
const {
1235 assert(N == 1 &&
"Invalid number of operands!");
1240 void addImm0_7Operands(
MCInst &Inst,
unsigned N)
const {
1241 assert(N == 1 &&
"Invalid number of operands!");
1246 void addImm1_8Operands(
MCInst &Inst,
unsigned N)
const {
1247 assert(N == 1 &&
"Invalid number of operands!");
1252 void addImm0_15Operands(
MCInst &Inst,
unsigned N)
const {
1253 assert(N == 1 &&
"Invalid number of operands!");
1258 void addImm1_16Operands(
MCInst &Inst,
unsigned N)
const {
1259 assert(N == 1 &&
"Invalid number of operands!");
1261 assert(MCE &&
"Invalid constant immediate operand!");
1265 void addImm0_31Operands(
MCInst &Inst,
unsigned N)
const {
1266 assert(N == 1 &&
"Invalid number of operands!");
1271 void addImm1_31Operands(
MCInst &Inst,
unsigned N)
const {
1272 assert(N == 1 &&
"Invalid number of operands!");
1277 void addImm1_32Operands(
MCInst &Inst,
unsigned N)
const {
1278 assert(N == 1 &&
"Invalid number of operands!");
1283 void addImm0_63Operands(
MCInst &Inst,
unsigned N)
const {
1284 assert(N == 1 &&
"Invalid number of operands!");
1289 void addImm1_63Operands(
MCInst &Inst,
unsigned N)
const {
1290 assert(N == 1 &&
"Invalid number of operands!");
1295 void addImm1_64Operands(
MCInst &Inst,
unsigned N)
const {
1296 assert(N == 1 &&
"Invalid number of operands!");
1301 void addImm0_127Operands(
MCInst &Inst,
unsigned N)
const {
1302 assert(N == 1 &&
"Invalid number of operands!");
1307 void addImm0_255Operands(
MCInst &Inst,
unsigned N)
const {
1308 assert(N == 1 &&
"Invalid number of operands!");
1313 void addImm0_65535Operands(
MCInst &Inst,
unsigned N)
const {
1314 assert(N == 1 &&
"Invalid number of operands!");
1319 void addImm32_63Operands(
MCInst &Inst,
unsigned N)
const {
1320 assert(N == 1 &&
"Invalid number of operands!");
1325 void addLogicalImm32Operands(
MCInst &Inst,
unsigned N)
const {
1326 assert(N == 1 &&
"Invalid number of operands!");
1333 void addLogicalImm64Operands(
MCInst &Inst,
unsigned N)
const {
1334 assert(N == 1 &&
"Invalid number of operands!");
1340 void addLogicalImm32NotOperands(
MCInst &Inst,
unsigned N)
const {
1341 assert(N == 1 &&
"Invalid number of operands!");
1343 int64_t Val = ~MCE->
getValue() & 0xFFFFFFFF;
1348 void addLogicalImm64NotOperands(
MCInst &Inst,
unsigned N)
const {
1349 assert(N == 1 &&
"Invalid number of operands!");
1356 void addSIMDImmType10Operands(
MCInst &Inst,
unsigned N)
const {
1357 assert(N == 1 &&
"Invalid number of operands!");
1363 void addBranchTarget26Operands(
MCInst &Inst,
unsigned N)
const {
1367 assert(N == 1 &&
"Invalid number of operands!");
1370 addExpr(Inst, getImm());
1373 assert(MCE &&
"Invalid constant immediate operand!");
1377 void addPCRelLabel19Operands(
MCInst &Inst,
unsigned N)
const {
1381 assert(N == 1 &&
"Invalid number of operands!");
1384 addExpr(Inst, getImm());
1387 assert(MCE &&
"Invalid constant immediate operand!");
1391 void addBranchTarget14Operands(
MCInst &Inst,
unsigned N)
const {
1395 assert(N == 1 &&
"Invalid number of operands!");
1398 addExpr(Inst, getImm());
1401 assert(MCE &&
"Invalid constant immediate operand!");
1405 void addFPImmOperands(
MCInst &Inst,
unsigned N)
const {
1406 assert(N == 1 &&
"Invalid number of operands!");
1410 void addBarrierOperands(
MCInst &Inst,
unsigned N)
const {
1411 assert(N == 1 &&
"Invalid number of operands!");
1415 void addMRSSystemRegisterOperands(
MCInst &Inst,
unsigned N)
const {
1416 assert(N == 1 &&
"Invalid number of operands!");
1421 void addMSRSystemRegisterOperands(
MCInst &Inst,
unsigned N)
const {
1422 assert(N == 1 &&
"Invalid number of operands!");
1427 void addSystemPStateFieldWithImm0_1Operands(
MCInst &Inst,
unsigned N)
const {
1428 assert(N == 1 &&
"Invalid number of operands!");
1433 void addSystemPStateFieldWithImm0_15Operands(
MCInst &Inst,
unsigned N)
const {
1434 assert(N == 1 &&
"Invalid number of operands!");
1439 void addSysCROperands(
MCInst &Inst,
unsigned N)
const {
1440 assert(N == 1 &&
"Invalid number of operands!");
1444 void addPrefetchOperands(
MCInst &Inst,
unsigned N)
const {
1445 assert(N == 1 &&
"Invalid number of operands!");
1449 void addPSBHintOperands(
MCInst &Inst,
unsigned N)
const {
1450 assert(N == 1 &&
"Invalid number of operands!");
1454 void addShifterOperands(
MCInst &Inst,
unsigned N)
const {
1455 assert(N == 1 &&
"Invalid number of operands!");
1461 void addExtendOperands(
MCInst &Inst,
unsigned N)
const {
1462 assert(N == 1 &&
"Invalid number of operands!");
1469 void addExtend64Operands(
MCInst &Inst,
unsigned N)
const {
1470 assert(N == 1 &&
"Invalid number of operands!");
1477 void addMemExtendOperands(
MCInst &Inst,
unsigned N)
const {
1478 assert(N == 2 &&
"Invalid number of operands!");
1489 void addMemExtend8Operands(
MCInst &Inst,
unsigned N)
const {
1490 assert(N == 2 &&
"Invalid number of operands!");
1498 void addMOVZMovAliasOperands(
MCInst &Inst,
unsigned N)
const {
1499 assert(N == 1 &&
"Invalid number of operands!");
1507 void addMOVNMovAliasOperands(
MCInst &Inst,
unsigned N)
const {
1508 assert(N == 1 &&
"Invalid number of operands!");
1517 static std::unique_ptr<AArch64Operand>
1519 auto Op = make_unique<AArch64Operand>(k_Token, Ctx);
1520 Op->Tok.Data = Str.
data();
1521 Op->Tok.Length = Str.
size();
1522 Op->Tok.IsSuffix = IsSuffix;
1528 static std::unique_ptr<AArch64Operand>
1530 auto Op = make_unique<AArch64Operand>(k_Register, Ctx);
1531 Op->Reg.RegNum = RegNum;
1538 static std::unique_ptr<AArch64Operand>
1539 CreateVectorList(
unsigned RegNum,
unsigned Count,
unsigned NumElements,
1541 auto Op = make_unique<AArch64Operand>(k_VectorList, Ctx);
1542 Op->VectorList.RegNum = RegNum;
1543 Op->VectorList.Count = Count;
1544 Op->VectorList.NumElements = NumElements;
1545 Op->VectorList.ElementKind = ElementKind;
1551 static std::unique_ptr<AArch64Operand>
1553 auto Op = make_unique<AArch64Operand>(k_VectorIndex, Ctx);
1554 Op->VectorIndex.Val = Idx;
1560 static std::unique_ptr<AArch64Operand> CreateImm(
const MCExpr *Val,
SMLoc S,
1562 auto Op = make_unique<AArch64Operand>(k_Immediate, Ctx);
1569 static std::unique_ptr<AArch64Operand> CreateShiftedImm(
const MCExpr *Val,
1570 unsigned ShiftAmount,
1573 auto Op = make_unique<AArch64Operand>(k_ShiftedImm, Ctx);
1574 Op->ShiftedImm .Val = Val;
1575 Op->ShiftedImm.ShiftAmount = ShiftAmount;
1581 static std::unique_ptr<AArch64Operand>
1583 auto Op = make_unique<AArch64Operand>(k_CondCode, Ctx);
1584 Op->CondCode.Code =
Code;
1590 static std::unique_ptr<AArch64Operand> CreateFPImm(
unsigned Val,
SMLoc S,
1592 auto Op = make_unique<AArch64Operand>(k_FPImm, Ctx);
1593 Op->FPImm.Val = Val;
1599 static std::unique_ptr<AArch64Operand> CreateBarrier(
unsigned Val,
1603 auto Op = make_unique<AArch64Operand>(k_Barrier, Ctx);
1604 Op->Barrier.Val = Val;
1605 Op->Barrier.Data = Str.
data();
1606 Op->Barrier.Length = Str.
size();
1612 static std::unique_ptr<AArch64Operand> CreateSysReg(
StringRef Str,
SMLoc S,
1617 auto Op = make_unique<AArch64Operand>(k_SysReg, Ctx);
1618 Op->SysReg.Data = Str.
data();
1619 Op->SysReg.Length = Str.
size();
1620 Op->SysReg.MRSReg = MRSReg;
1621 Op->SysReg.MSRReg = MSRReg;
1622 Op->SysReg.PStateField = PStateField;
1628 static std::unique_ptr<AArch64Operand> CreateSysCR(
unsigned Val,
SMLoc S,
1630 auto Op = make_unique<AArch64Operand>(k_SysCR, Ctx);
1631 Op->SysCRImm.Val = Val;
1637 static std::unique_ptr<AArch64Operand> CreatePrefetch(
unsigned Val,
1641 auto Op = make_unique<AArch64Operand>(k_Prefetch, Ctx);
1642 Op->Prefetch.Val = Val;
1643 Op->Barrier.Data = Str.
data();
1644 Op->Barrier.Length = Str.
size();
1650 static std::unique_ptr<AArch64Operand> CreatePSBHint(
unsigned Val,
1654 auto Op = make_unique<AArch64Operand>(k_PSBHint, Ctx);
1655 Op->PSBHint.Val = Val;
1656 Op->PSBHint.Data = Str.
data();
1657 Op->PSBHint.Length = Str.
size();
1663 static std::unique_ptr<AArch64Operand>
1666 auto Op = make_unique<AArch64Operand>(k_ShiftExtend, Ctx);
1667 Op->ShiftExtend.Type = ShOp;
1668 Op->ShiftExtend.Amount = Val;
1669 Op->ShiftExtend.HasExplicitAmount = HasExplicitAmount;
1678 void AArch64Operand::print(
raw_ostream &OS)
const {
1681 OS <<
"<fpimm " << getFPImm() <<
"("
1687 OS <<
"<barrier " << Name <<
">";
1689 OS <<
"<barrier invalid #" << getBarrier() <<
">";
1695 case k_ShiftedImm: {
1696 unsigned Shift = getShiftedImmShift();
1697 OS <<
"<shiftedimm ";
1698 OS << *getShiftedImmVal();
1703 OS <<
"<condcode " << getCondCode() <<
">";
1706 OS <<
"<register " <<
getReg() <<
">";
1708 case k_VectorList: {
1709 OS <<
"<vectorlist ";
1710 unsigned Reg = getVectorListStart();
1711 for (
unsigned i = 0, e = getVectorListCount(); i != e; ++i)
1712 OS << Reg + i <<
" ";
1717 OS <<
"<vectorindex " << getVectorIndex() <<
">";
1720 OS <<
"<sysreg: " << getSysReg() <<
'>';
1726 OS <<
"c" << getSysCR();
1731 OS <<
"<prfop " << Name <<
">";
1733 OS <<
"<prfop invalid #" << getPrefetch() <<
">";
1737 OS << getPSBHintName();
1741 << getShiftExtendAmount();
1742 if (!hasShiftExtendAmount())
1752 static unsigned MatchRegisterName(StringRef Name);
1756 static unsigned matchVectorRegName(StringRef Name) {
1757 return StringSwitch<unsigned>(Name.lower())
1758 .Case("v0", AArch64::Q0)
1759 .Case("v1", AArch64::Q1)
1760 .Case("v2", AArch64::Q2)
1761 .Case("v3", AArch64::Q3)
1762 .Case("v4", AArch64::Q4)
1763 .Case("v5", AArch64::Q5)
1764 .Case("v6", AArch64::Q6)
1765 .Case("v7", AArch64::Q7)
1766 .Case("v8", AArch64::Q8)
1767 .Case("v9", AArch64::Q9)
1768 .Case("v10", AArch64::Q10)
1769 .Case("v11", AArch64::Q11)
1770 .Case("v12", AArch64::Q12)
1771 .Case("v13", AArch64::Q13)
1772 .Case("v14", AArch64::Q14)
1773 .Case("v15", AArch64::Q15)
1774 .Case("v16", AArch64::Q16)
1775 .Case("v17", AArch64::Q17)
1776 .Case("v18", AArch64::Q18)
1777 .Case("v19", AArch64::Q19)
1778 .Case("v20", AArch64::Q20)
1779 .Case("v21", AArch64::Q21)
1780 .Case("v22", AArch64::Q22)
1781 .Case("v23", AArch64::Q23)
1782 .Case("v24", AArch64::Q24)
1783 .Case("v25", AArch64::Q25)
1784 .Case("v26", AArch64::Q26)
1785 .Case("v27", AArch64::Q27)
1786 .Case("v28", AArch64::Q28)
1787 .Case("v29", AArch64::Q29)
1788 .Case("v30", AArch64::Q30)
1789 .Case("v31", AArch64::Q31)
1793 static bool isValidVectorKind(StringRef Name) {
1794 return StringSwitch<bool>(Name.lower())
1804 // Accept the width neutral ones, too, for verbose syntax. If those
1805 // aren'
t used in the right places, the token operand won
't match so
1806 // all will work out.
1811 // Needed for fp16 scalar pairwise reductions
1816 static void parseValidVectorKind(StringRef Name, unsigned &NumElements,
1817 char &ElementKind) {
1818 assert(isValidVectorKind(Name));
1820 ElementKind = Name.lower()[Name.size() - 1];
1823 if (Name.size() == 2)
1826 // Parse the lane count
1827 Name = Name.drop_front();
1828 while (isdigit(Name.front())) {
1829 NumElements = 10 * NumElements + (Name.front() - '0
');
1830 Name = Name.drop_front();
1834 bool AArch64AsmParser::ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
1836 StartLoc = getLoc();
1837 RegNo = tryParseRegister();
1838 EndLoc = SMLoc::getFromPointer(getLoc().getPointer() - 1);
1839 return (RegNo == (unsigned)-1);
1842 // Matches a register name or register alias previously defined by '.req
'
1843 unsigned AArch64AsmParser::matchRegisterNameAlias(StringRef Name,
1845 unsigned RegNum = isVector ? matchVectorRegName(Name)
1846 : MatchRegisterName(Name);
1849 // Check for aliases registered via .req. Canonicalize to lower case.
1850 // That's more consistent since
register names are
case insensitive, and
1852 auto Entry = RegisterReqs.find(Name.
lower());
1853 if (Entry == RegisterReqs.end())
1856 if (
isVector == Entry->getValue().first)
1857 RegNum = Entry->getValue().second;
1865 int AArch64AsmParser::tryParseRegister() {
1872 unsigned RegNum = matchRegisterNameAlias(lowerCase,
false);
1876 .Case(
"fp", AArch64::FP)
1877 .
Case(
"lr", AArch64::LR)
1878 .
Case(
"x31", AArch64::XZR)
1879 .
Case(
"w31", AArch64::WZR)
1891 int AArch64AsmParser::tryMatchVectorRegister(
StringRef &
Kind,
bool expected) {
1894 TokError(
"vector register expected");
1901 size_t Start = 0, Next = Name.
find(
'.');
1903 unsigned RegNum = matchRegisterNameAlias(Head,
true);
1909 TokError(
"invalid vector kind qualifier");
1918 TokError(
"vector register expected");
1924 AArch64AsmParser::tryParseSysCROperand(
OperandVector &Operands) {
1929 Error(S,
"Expected cN operand where 0 <= N <= 15");
1934 if (Tok[0] !=
'c' && Tok[0] !=
'C') {
1935 Error(S,
"Expected cN operand where 0 <= N <= 15");
1941 if (BadNum || CRNum > 15) {
1942 Error(S,
"Expected cN operand where 0 <= N <= 15");
1948 AArch64Operand::CreateSysCR(CRNum, S, getLoc(), getContext()));
1954 AArch64AsmParser::tryParsePrefetch(
OperandVector &Operands) {
1963 if (getParser().parseExpression(ImmVal))
1968 TokError(
"immediate value expected for prefetch operand");
1973 TokError(
"prefetch operand out of range, [0,31] expected");
1977 auto PRFM = AArch64PRFM::lookupPRFMByEncoding(MCE->
getValue());
1978 Operands.
push_back(AArch64Operand::CreatePrefetch(
1979 prfop, PRFM ? PRFM->Name :
"", S, getContext()));
1984 TokError(
"pre-fetch hint expected");
1988 auto PRFM = AArch64PRFM::lookupPRFMByName(Tok.
getString());
1990 TokError(
"pre-fetch hint expected");
1995 Operands.
push_back(AArch64Operand::CreatePrefetch(
1996 PRFM->Encoding, Tok.
getString(), S, getContext()));
2002 AArch64AsmParser::tryParsePSBHint(
OperandVector &Operands) {
2007 TokError(
"invalid operand for instruction");
2011 auto PSB = AArch64PSBHint::lookupPSBByName(Tok.
getString());
2013 TokError(
"invalid operand for instruction");
2018 Operands.
push_back(AArch64Operand::CreatePSBHint(
2019 PSB->Encoding, Tok.
getString(), S, getContext()));
2026 AArch64AsmParser::tryParseAdrpLabel(
OperandVector &Operands) {
2035 if (parseSymbolicImmVal(Expr))
2041 if (classifySymbolRef(Expr, ELFRefKind, DarwinRefKind, Addend)) {
2051 Error(S,
"gotpage label reference not allowed an addend");
2060 Error(S,
"page or gotpage label reference expected");
2069 Operands.
push_back(AArch64Operand::CreateImm(Expr, S, E, getContext()));
2077 AArch64AsmParser::tryParseAdrLabel(
OperandVector &Operands) {
2082 if (getParser().parseExpression(Expr))
2086 Operands.
push_back(AArch64Operand::CreateImm(Expr, S, E, getContext()));
2107 if (Val > 255 || Val < 0) {
2108 TokError(
"encoded floating point value out of range");
2116 uint64_t
IntVal = RealVal.bitcastToAPInt().getZExtValue();
2122 if (RealVal.isPosZero()) {
2124 Operands.
push_back(AArch64Operand::CreateToken(
"#0",
false, S, getContext()));
2125 Operands.
push_back(AArch64Operand::CreateToken(
".0",
false, S, getContext()));
2127 }
else if (Val == -1) {
2128 TokError(
"expected compatible register or floating-point constant");
2133 Operands.
push_back(AArch64Operand::CreateFPImm(Val, S, getContext()));
2140 TokError(
"invalid floating point immediate");
2146 AArch64AsmParser::tryParseAddSubImm(
OperandVector &Operands) {
2157 if (parseSymbolicImmVal(Imm))
2160 uint64_t ShiftAmount = 0;
2164 if (Val > 0xfff && (Val & 0xfff) == 0) {
2170 Operands.
push_back(AArch64Operand::CreateShiftedImm(Imm, ShiftAmount, S, E,
2197 if (ShiftAmount < 0) {
2204 Operands.
push_back(AArch64Operand::CreateShiftedImm(Imm, ShiftAmount,
2205 S, E, getContext()));
2235 bool AArch64AsmParser::parseCondCode(
OperandVector &Operands,
2236 bool invertCondCode) {
2245 return TokError(
"invalid condition code");
2248 if (invertCondCode) {
2250 return TokError(
"condition codes AL and NV are invalid for this instruction");
2255 AArch64Operand::CreateCondCode(CC, S, getLoc(), getContext()));
2262 AArch64AsmParser::tryParseOptionalShiftExtend(
OperandVector &Operands) {
2296 TokError(
"expected #imm after shift specifier");
2303 AArch64Operand::CreateShiftExtend(ShOp, 0,
false, S, E, getContext()));
2313 Error(E,
"expected integer shift amount");
2318 if (getParser().parseExpression(ImmVal))
2323 Error(E,
"expected constant '#imm' after shift specifier");
2328 Operands.
push_back(AArch64Operand::CreateShiftExtend(
2329 ShOp, MCE->
getValue(),
true, S,
E, getContext()));
2334 if (FBS[AArch64::HasV8_1aOps])
2336 else if (FBS[AArch64::HasV8_2aOps])
2342 void AArch64AsmParser::createSysAlias(uint16_t Encoding,
OperandVector &Operands,
2344 const uint16_t Op2 = Encoding & 7;
2345 const uint16_t Cm = (Encoding & 0x78) >> 3;
2346 const uint16_t Cn = (Encoding & 0x780) >> 7;
2347 const uint16_t Op1 = (Encoding & 0x3800) >> 11;
2352 AArch64Operand::CreateImm(Expr, S, getLoc(), getContext()));
2354 AArch64Operand::CreateSysCR(Cn, S, getLoc(), getContext()));
2356 AArch64Operand::CreateSysCR(Cm, S, getLoc(), getContext()));
2359 AArch64Operand::CreateImm(Expr, S, getLoc(), getContext()));
2364 bool AArch64AsmParser::parseSysAlias(
StringRef Name,
SMLoc NameLoc,
2367 return TokError(
"invalid operand");
2371 AArch64Operand::CreateToken(
"sys",
false, NameLoc, getContext()));
2378 if (Mnemonic ==
"ic") {
2381 return TokError(
"invalid operand for IC instruction");
2382 else if (!IC->
haveFeatures(getSTI().getFeatureBits())) {
2383 std::string Str(
"IC " + std::string(IC->
Name) +
" requires ");
2385 return TokError(Str.c_str());
2387 createSysAlias(IC->
Encoding, Operands, S);
2388 }
else if (Mnemonic ==
"dc") {
2391 return TokError(
"invalid operand for DC instruction");
2392 else if (!DC->
haveFeatures(getSTI().getFeatureBits())) {
2393 std::string Str(
"DC " + std::string(DC->
Name) +
" requires ");
2395 return TokError(Str.c_str());
2397 createSysAlias(DC->
Encoding, Operands, S);
2398 }
else if (Mnemonic ==
"at") {
2401 return TokError(
"invalid operand for AT instruction");
2402 else if (!AT->
haveFeatures(getSTI().getFeatureBits())) {
2403 std::string Str(
"AT " + std::string(AT->
Name) +
" requires ");
2405 return TokError(Str.c_str());
2407 createSysAlias(AT->
Encoding, Operands, S);
2408 }
else if (Mnemonic ==
"tlbi") {
2411 return TokError(
"invalid operand for TLBI instruction");
2412 else if (!TLBI->
haveFeatures(getSTI().getFeatureBits())) {
2413 std::string Str(
"TLBI " + std::string(TLBI->
Name) +
" requires ");
2415 return TokError(Str.c_str());
2417 createSysAlias(TLBI->
Encoding, Operands, S);
2423 bool HasRegister =
false;
2428 return TokError(
"expected register operand");
2432 if (ExpectRegister && !HasRegister)
2433 return TokError(
"specified " + Mnemonic +
" op requires a register");
2434 else if (!ExpectRegister && HasRegister)
2435 return TokError(
"specified " + Mnemonic +
" op does not use a register");
2444 AArch64AsmParser::tryParseBarrierOperand(
OperandVector &Operands) {
2453 SMLoc ExprLoc = getLoc();
2454 if (getParser().parseExpression(ImmVal))
2458 Error(ExprLoc,
"immediate value expected for barrier operand");
2462 Error(ExprLoc,
"barrier operand out of range");
2465 auto DB = AArch64DB::lookupDBByEncoding(MCE->
getValue());
2466 Operands.
push_back(AArch64Operand::CreateBarrier(
2467 MCE->
getValue(), DB ? DB->Name :
"", ExprLoc, getContext()));
2472 TokError(
"invalid operand for instruction");
2477 auto DB = AArch64DB::lookupDBByName(Tok.
getString());
2478 if (Mnemonic ==
"isb" && (!DB || DB->Encoding != AArch64DB::sy)) {
2479 TokError(
"'sy' or #imm operand expected");
2482 TokError(
"invalid barrier option name");
2486 Operands.
push_back(AArch64Operand::CreateBarrier(
2487 DB->Encoding, Tok.
getString(), getLoc(), getContext()));
2503 if (SysReg && SysReg->haveFeatures(getSTI().getFeatureBits())) {
2504 MRSReg = SysReg->
Readable ? SysReg->Encoding : -1;
2505 MSRReg = SysReg->Writeable ? SysReg->Encoding : -1;
2509 auto PState = AArch64PState::lookupPStateByName(Tok.
getString());
2510 unsigned PStateImm = -1;
2511 if (PState && PState->haveFeatures(getSTI().getFeatureBits()))
2512 PStateImm = PState->Encoding;
2515 AArch64Operand::CreateSysReg(Tok.
getString(), getLoc(), MRSReg, MSRReg,
2516 PStateImm, getContext()));
2523 bool AArch64AsmParser::tryParseVectorRegister(
OperandVector &Operands) {
2531 int64_t Reg = tryMatchVectorRegister(Kind,
false);
2535 AArch64Operand::CreateReg(Reg,
true, S, getLoc(), getContext()));
2540 AArch64Operand::CreateToken(Kind,
false, S, getContext()));
2543 SMLoc SIdx = getLoc();
2546 if (getParser().parseExpression(ImmVal))
2550 TokError(
"immediate value expected for vector index");
2567 bool AArch64AsmParser::parseRegister(
OperandVector &Operands) {
2570 if (!tryParseVectorRegister(Operands))
2574 int64_t Reg = tryParseRegister();
2578 AArch64Operand::CreateReg(Reg,
false, S, getLoc(), getContext()));
2583 bool AArch64AsmParser::parseSymbolicImmVal(
const MCExpr *&ImmVal) {
2585 bool HasELFModifier =
false;
2589 HasELFModifier =
true;
2592 return TokError(
"expect relocation specifier in operand after ':'");
2634 return TokError(
"expect relocation specifier in operand after ':'");
2638 if (parseToken(
AsmToken::Colon,
"expect ':' after relocation specifier"))
2642 if (getParser().parseExpression(ImmVal))
2652 bool AArch64AsmParser::parseVectorList(
OperandVector &Operands) {
2658 int64_t FirstReg = tryMatchVectorRegister(Kind,
true);
2661 int64_t PrevReg = FirstReg;
2665 SMLoc Loc = getLoc();
2667 int64_t Reg = tryMatchVectorRegister(NextKind,
true);
2671 if (Kind != NextKind)
2672 return Error(Loc,
"mismatched register size suffix");
2674 unsigned Space = (PrevReg <
Reg) ? (Reg - PrevReg) : (Reg + 32 - PrevReg);
2676 if (Space == 0 || Space > 3) {
2677 return Error(Loc,
"invalid number of vectors");
2684 SMLoc Loc = getLoc();
2686 int64_t Reg = tryMatchVectorRegister(NextKind,
true);
2690 if (Kind != NextKind)
2691 return Error(Loc,
"mismatched register size suffix");
2694 if (getContext().getRegisterInfo()->getEncodingValue(Reg) !=
2695 (getContext().getRegisterInfo()->getEncodingValue(PrevReg) + 1) % 32)
2696 return Error(Loc,
"registers must be sequential");
2707 return Error(S,
"invalid number of vectors");
2709 unsigned NumElements = 0;
2710 char ElementKind = 0;
2714 Operands.
push_back(AArch64Operand::CreateVectorList(
2715 FirstReg, Count, NumElements, ElementKind, S, getLoc(), getContext()));
2718 SMLoc SIdx = getLoc();
2721 if (getParser().parseExpression(ImmVal))
2725 TokError(
"immediate value expected for vector index");
2740 AArch64AsmParser::tryParseGPR64sp0Operand(
OperandVector &Operands) {
2746 unsigned RegNum = matchRegisterNameAlias(Tok.
getString().
lower(),
false);
2758 AArch64Operand::CreateReg(RegNum,
false, S, getLoc(), Ctx));
2765 Error(getLoc(),
"index must be absent or #0");
2771 cast<MCConstantExpr>(ImmVal)->getValue() != 0) {
2772 Error(getLoc(),
"index must be absent or #0");
2777 AArch64Operand::CreateReg(RegNum,
false, S, getLoc(), Ctx));
2783 bool AArch64AsmParser::parseOperand(
OperandVector &Operands,
bool isCondCode,
2784 bool invertCondCode) {
2799 switch (getLexer().getKind()) {
2803 if (parseSymbolicImmVal(Expr))
2804 return Error(S,
"invalid operand");
2807 Operands.
push_back(AArch64Operand::CreateImm(Expr, S, E, getContext()));
2812 Operands.
push_back(AArch64Operand::CreateToken(
"[",
false, Loc,
2818 return parseOperand(Operands,
false,
false);
2821 return parseVectorList(Operands);
2825 return parseCondCode(Operands, invertCondCode);
2828 if (!parseRegister(Operands))
2841 if (getParser().parseExpression(IdVal))
2844 Operands.
push_back(AArch64Operand::CreateImm(IdVal, S, E, getContext()));
2856 bool isNegative =
false;
2872 if (Mnemonic !=
"fcmp" && Mnemonic !=
"fcmpe" && Mnemonic !=
"fcmeq" &&
2873 Mnemonic !=
"fcmge" && Mnemonic !=
"fcmgt" && Mnemonic !=
"fcmle" &&
2874 Mnemonic !=
"fcmlt")
2875 return TokError(
"unexpected floating point literal");
2876 else if (IntVal != 0 || isNegative)
2877 return TokError(
"expected floating-point constant #0.0");
2881 AArch64Operand::CreateToken(
"#0",
false, S, getContext()));
2883 AArch64Operand::CreateToken(
".0",
false, S, getContext()));
2888 if (parseSymbolicImmVal(ImmVal))
2892 Operands.
push_back(AArch64Operand::CreateImm(ImmVal, S, E, getContext()));
2896 SMLoc Loc = getLoc();
2897 if (Mnemonic !=
"ldr")
2898 return TokError(
"unexpected token in operand");
2900 const MCExpr *SubExprVal;
2901 if (getParser().parseExpression(SubExprVal))
2904 if (Operands.
size() < 2 ||
2905 !
static_cast<AArch64Operand &
>(*Operands[1]).
isReg())
2906 return Error(Loc,
"Only valid when first operand is register");
2909 AArch64MCRegisterClasses[AArch64::GPR64allRegClassID].contains(
2915 if (isa<MCConstantExpr>(SubExprVal)) {
2916 uint64_t Imm = (cast<MCConstantExpr>(SubExprVal))->getValue();
2917 uint32_t ShiftAmt = 0, MaxShiftAmt = IsXReg ? 48 : 16;
2922 if (ShiftAmt <= MaxShiftAmt && Imm <= 0xFFFF) {
2923 Operands[0] = AArch64Operand::CreateToken(
"movz",
false, Loc, Ctx);
2924 Operands.
push_back(AArch64Operand::CreateImm(
2928 ShiftAmt,
true, S, E, Ctx));
2934 return Error(Loc,
"Immediate too large for register");
2938 getTargetStreamer().addConstantPoolEntry(SubExprVal, IsXReg ? 8 : 4, Loc);
2939 Operands.
push_back(AArch64Operand::CreateImm(CPLoc, S, E, Ctx));
2952 .Case(
"beq",
"b.eq")
2953 .
Case(
"bne",
"b.ne")
2954 .
Case(
"bhs",
"b.hs")
2955 .
Case(
"bcs",
"b.cs")
2956 .
Case(
"blo",
"b.lo")
2957 .
Case(
"bcc",
"b.cc")
2958 .
Case(
"bmi",
"b.mi")
2959 .
Case(
"bpl",
"b.pl")
2960 .
Case(
"bvs",
"b.vs")
2961 .
Case(
"bvc",
"b.vc")
2962 .
Case(
"bhi",
"b.hi")
2963 .
Case(
"bls",
"b.ls")
2964 .
Case(
"bge",
"b.ge")
2965 .
Case(
"blt",
"b.lt")
2966 .
Case(
"bgt",
"b.gt")
2967 .
Case(
"ble",
"b.le")
2968 .
Case(
"bal",
"b.al")
2969 .
Case(
"bnv",
"b.nv")
2975 parseDirectiveReq(Name, NameLoc);
2982 size_t Start = 0, Next = Name.
find(
'.');
2986 if (Head ==
"ic" || Head ==
"dc" || Head ==
"at" || Head ==
"tlbi")
2987 return parseSysAlias(Head, NameLoc, Operands);
2990 AArch64Operand::CreateToken(Head,
false, NameLoc, getContext()));
2996 Next = Name.
find(
'.', Start + 1);
2997 Head = Name.
slice(Start + 1, Next);
3003 return Error(SuffixLoc,
"invalid condition code");
3005 AArch64Operand::CreateToken(
".",
true, SuffixLoc, getContext()));
3007 AArch64Operand::CreateCondCode(CC, NameLoc, NameLoc, getContext()));
3013 Next = Name.
find(
'.', Start + 1);
3014 Head = Name.
slice(Start, Next);
3018 AArch64Operand::CreateToken(Head,
true, SuffixLoc, getContext()));
3023 bool condCodeFourthOperand =
3024 (Head ==
"ccmp" || Head ==
"ccmn" || Head ==
"fccmp" ||
3025 Head ==
"fccmpe" || Head ==
"fcsel" || Head ==
"csel" ||
3026 Head ==
"csinc" || Head ==
"csinv" || Head ==
"csneg");
3034 bool condCodeSecondOperand = (Head ==
"cset" || Head ==
"csetm");
3035 bool condCodeThirdOperand =
3036 (Head ==
"cinc" || Head ==
"cinv" || Head ==
"cneg");
3041 if (parseOperand(Operands,
false,
false)) {
3048 if (parseOperand(Operands, (N == 4 && condCodeFourthOperand) ||
3049 (N == 3 && condCodeThirdOperand) ||
3050 (N == 2 && condCodeSecondOperand),
3051 condCodeSecondOperand || condCodeThirdOperand)) {
3067 AArch64Operand::CreateToken(
"]",
false, RLoc, getContext()));
3071 AArch64Operand::CreateToken(
"!",
false, ELoc, getContext()));
3086 bool AArch64AsmParser::validateInstruction(
MCInst &Inst,
3093 case AArch64::LDPSWpre:
3094 case AArch64::LDPWpost:
3095 case AArch64::LDPWpre:
3096 case AArch64::LDPXpost:
3097 case AArch64::LDPXpre: {
3102 return Error(Loc[0],
"unpredictable LDP instruction, writeback base "
3103 "is also a destination");
3105 return Error(Loc[1],
"unpredictable LDP instruction, writeback base "
3106 "is also a destination");
3109 case AArch64::LDPDi:
3110 case AArch64::LDPQi:
3111 case AArch64::LDPSi:
3112 case AArch64::LDPSWi:
3113 case AArch64::LDPWi:
3114 case AArch64::LDPXi: {
3118 return Error(Loc[1],
"unpredictable LDP instruction, Rt2==Rt");
3121 case AArch64::LDPDpost:
3122 case AArch64::LDPDpre:
3123 case AArch64::LDPQpost:
3124 case AArch64::LDPQpre:
3125 case AArch64::LDPSpost:
3126 case AArch64::LDPSpre:
3127 case AArch64::LDPSWpost: {
3131 return Error(Loc[1],
"unpredictable LDP instruction, Rt2==Rt");
3134 case AArch64::STPDpost:
3135 case AArch64::STPDpre:
3136 case AArch64::STPQpost:
3137 case AArch64::STPQpre:
3138 case AArch64::STPSpost:
3139 case AArch64::STPSpre:
3140 case AArch64::STPWpost:
3141 case AArch64::STPWpre:
3142 case AArch64::STPXpost:
3143 case AArch64::STPXpre: {
3148 return Error(Loc[0],
"unpredictable STP instruction, writeback base "
3149 "is also a source");
3151 return Error(Loc[1],
"unpredictable STP instruction, writeback base "
3152 "is also a source");
3155 case AArch64::LDRBBpre:
3156 case AArch64::LDRBpre:
3157 case AArch64::LDRHHpre:
3158 case AArch64::LDRHpre:
3159 case AArch64::LDRSBWpre:
3160 case AArch64::LDRSBXpre:
3161 case AArch64::LDRSHWpre:
3162 case AArch64::LDRSHXpre:
3163 case AArch64::LDRSWpre:
3164 case AArch64::LDRWpre:
3165 case AArch64::LDRXpre:
3166 case AArch64::LDRBBpost:
3167 case AArch64::LDRBpost:
3168 case AArch64::LDRHHpost:
3169 case AArch64::LDRHpost:
3170 case AArch64::LDRSBWpost:
3171 case AArch64::LDRSBXpost:
3172 case AArch64::LDRSHWpost:
3173 case AArch64::LDRSHXpost:
3174 case AArch64::LDRSWpost:
3175 case AArch64::LDRWpost:
3176 case AArch64::LDRXpost: {
3180 return Error(Loc[0],
"unpredictable LDR instruction, writeback base "
3181 "is also a source");
3184 case AArch64::STRBBpost:
3185 case AArch64::STRBpost:
3186 case AArch64::STRHHpost:
3187 case AArch64::STRHpost:
3188 case AArch64::STRWpost:
3189 case AArch64::STRXpost:
3190 case AArch64::STRBBpre:
3191 case AArch64::STRBpre:
3192 case AArch64::STRHHpre:
3193 case AArch64::STRHpre:
3194 case AArch64::STRWpre:
3195 case AArch64::STRXpre: {
3199 return Error(Loc[0],
"unpredictable STR instruction, writeback base "
3200 "is also a source");
3209 case AArch64::ADDSWri:
3210 case AArch64::ADDSXri:
3211 case AArch64::ADDWri:
3212 case AArch64::ADDXri:
3213 case AArch64::SUBSWri:
3214 case AArch64::SUBSXri:
3215 case AArch64::SUBWri:
3216 case AArch64::SUBXri: {
3224 if (classifySymbolRef(Expr, ELFRefKind, DarwinRefKind, Addend)) {
3249 return Error(Loc.
back(),
"invalid immediate expression");
3262 bool AArch64AsmParser::showMatchError(
SMLoc Loc,
unsigned ErrCode,
3265 case Match_MissingFeature:
3267 "instruction requires a CPU feature not currently enabled");
3268 case Match_InvalidOperand:
3269 return Error(Loc,
"invalid operand for instruction");
3270 case Match_InvalidSuffix:
3271 return Error(Loc,
"invalid type suffix for instruction");
3272 case Match_InvalidCondCode:
3273 return Error(Loc,
"expected AArch64 condition code");
3274 case Match_AddSubRegExtendSmall:
3276 "expected '[su]xt[bhw]' or 'lsl' with optional integer in range [0, 4]");
3277 case Match_AddSubRegExtendLarge:
3279 "expected 'sxtx' 'uxtx' or 'lsl' with optional integer in range [0, 4]");
3280 case Match_AddSubSecondSource:
3282 "expected compatible register, symbol or integer in range [0, 4095]");
3283 case Match_LogicalSecondSource:
3284 return Error(Loc,
"expected compatible register or logical immediate");
3285 case Match_InvalidMovImm32Shift:
3286 return Error(Loc,
"expected 'lsl' with optional integer 0 or 16");
3287 case Match_InvalidMovImm64Shift:
3288 return Error(Loc,
"expected 'lsl' with optional integer 0, 16, 32 or 48");
3289 case Match_AddSubRegShift32:
3291 "expected 'lsl', 'lsr' or 'asr' with optional integer in range [0, 31]");
3292 case Match_AddSubRegShift64:
3294 "expected 'lsl', 'lsr' or 'asr' with optional integer in range [0, 63]");
3295 case Match_InvalidFPImm:
3297 "expected compatible register or floating-point constant");
3298 case Match_InvalidMemoryIndexedSImm9:
3299 return Error(Loc,
"index must be an integer in range [-256, 255].");
3300 case Match_InvalidMemoryIndexed4SImm7:
3301 return Error(Loc,
"index must be a multiple of 4 in range [-256, 252].");
3302 case Match_InvalidMemoryIndexed8SImm7:
3303 return Error(Loc,
"index must be a multiple of 8 in range [-512, 504].");
3304 case Match_InvalidMemoryIndexed16SImm7:
3305 return Error(Loc,
"index must be a multiple of 16 in range [-1024, 1008].");
3306 case Match_InvalidMemoryWExtend8:
3308 "expected 'uxtw' or 'sxtw' with optional shift of #0");
3309 case Match_InvalidMemoryWExtend16:
3311 "expected 'uxtw' or 'sxtw' with optional shift of #0 or #1");
3312 case Match_InvalidMemoryWExtend32:
3314 "expected 'uxtw' or 'sxtw' with optional shift of #0 or #2");
3315 case Match_InvalidMemoryWExtend64:
3317 "expected 'uxtw' or 'sxtw' with optional shift of #0 or #3");
3318 case Match_InvalidMemoryWExtend128:
3320 "expected 'uxtw' or 'sxtw' with optional shift of #0 or #4");
3321 case Match_InvalidMemoryXExtend8:
3323 "expected 'lsl' or 'sxtx' with optional shift of #0");
3324 case Match_InvalidMemoryXExtend16:
3326 "expected 'lsl' or 'sxtx' with optional shift of #0 or #1");
3327 case Match_InvalidMemoryXExtend32:
3329 "expected 'lsl' or 'sxtx' with optional shift of #0 or #2");
3330 case Match_InvalidMemoryXExtend64:
3332 "expected 'lsl' or 'sxtx' with optional shift of #0 or #3");
3333 case Match_InvalidMemoryXExtend128:
3335 "expected 'lsl' or 'sxtx' with optional shift of #0 or #4");
3336 case Match_InvalidMemoryIndexed1:
3337 return Error(Loc,
"index must be an integer in range [0, 4095].");
3338 case Match_InvalidMemoryIndexed2:
3339 return Error(Loc,
"index must be a multiple of 2 in range [0, 8190].");
3340 case Match_InvalidMemoryIndexed4:
3341 return Error(Loc,
"index must be a multiple of 4 in range [0, 16380].");
3342 case Match_InvalidMemoryIndexed8:
3343 return Error(Loc,
"index must be a multiple of 8 in range [0, 32760].");
3344 case Match_InvalidMemoryIndexed16:
3345 return Error(Loc,
"index must be a multiple of 16 in range [0, 65520].");
3346 case Match_InvalidImm0_1:
3347 return Error(Loc,
"immediate must be an integer in range [0, 1].");
3348 case Match_InvalidImm0_7:
3349 return Error(Loc,
"immediate must be an integer in range [0, 7].");
3350 case Match_InvalidImm0_15:
3351 return Error(Loc,
"immediate must be an integer in range [0, 15].");
3352 case Match_InvalidImm0_31:
3353 return Error(Loc,
"immediate must be an integer in range [0, 31].");
3354 case Match_InvalidImm0_63:
3355 return Error(Loc,
"immediate must be an integer in range [0, 63].");
3356 case Match_InvalidImm0_127:
3357 return Error(Loc,
"immediate must be an integer in range [0, 127].");
3358 case Match_InvalidImm0_255:
3359 return Error(Loc,
"immediate must be an integer in range [0, 255].");
3360 case Match_InvalidImm0_65535:
3361 return Error(Loc,
"immediate must be an integer in range [0, 65535].");
3362 case Match_InvalidImm1_8:
3363 return Error(Loc,
"immediate must be an integer in range [1, 8].");
3364 case Match_InvalidImm1_16:
3365 return Error(Loc,
"immediate must be an integer in range [1, 16].");
3366 case Match_InvalidImm1_32:
3367 return Error(Loc,
"immediate must be an integer in range [1, 32].");
3368 case Match_InvalidImm1_64:
3369 return Error(Loc,
"immediate must be an integer in range [1, 64].");
3370 case Match_InvalidIndex1:
3371 return Error(Loc,
"expected lane specifier '[1]'");
3372 case Match_InvalidIndexB:
3373 return Error(Loc,
"vector lane must be an integer in range [0, 15].");
3374 case Match_InvalidIndexH:
3375 return Error(Loc,
"vector lane must be an integer in range [0, 7].");
3376 case Match_InvalidIndexS:
3377 return Error(Loc,
"vector lane must be an integer in range [0, 3].");
3378 case Match_InvalidIndexD:
3379 return Error(Loc,
"vector lane must be an integer in range [0, 1].");
3380 case Match_InvalidLabel:
3381 return Error(Loc,
"expected label or encodable integer pc offset");
3383 return Error(Loc,
"expected readable system register");
3385 return Error(Loc,
"expected writable system register or pstate");
3386 case Match_MnemonicFail: {
3388 ((AArch64Operand &)*Operands[0]).
getToken(),
3389 ComputeAvailableFeatures(STI->getFeatureBits()));
3390 return Error(Loc,
"unrecognized instruction mnemonic" + Suggestion);
3399 bool AArch64AsmParser::MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
3403 bool MatchingInlineAsm) {
3404 assert(!Operands.
empty() &&
"Unexpect empty operand list!");
3405 AArch64Operand &Op =
static_cast<AArch64Operand &
>(*Operands[0]);
3406 assert(Op.isToken() &&
"Leading operand should always be a mnemonic!");
3409 unsigned NumOperands = Operands.
size();
3411 if (NumOperands == 4 && Tok ==
"lsl") {
3412 AArch64Operand &Op2 =
static_cast<AArch64Operand &
>(*Operands[2]);
3413 AArch64Operand &Op3 =
static_cast<AArch64Operand &
>(*Operands[3]);
3414 if (Op2.isReg() && Op3.isImm()) {
3417 uint64_t Op3Val = Op3CE->
getValue();
3418 uint64_t NewOp3Val = 0;
3419 uint64_t NewOp4Val = 0;
3420 if (AArch64MCRegisterClasses[AArch64::GPR32allRegClassID].
contains(
3422 NewOp3Val = (32 - Op3Val) & 0x1f;
3423 NewOp4Val = 31 - Op3Val;
3425 NewOp3Val = (64 - Op3Val) & 0x3f;
3426 NewOp4Val = 63 - Op3Val;
3432 Operands[0] = AArch64Operand::CreateToken(
3433 "ubfm",
false, Op.getStartLoc(), getContext());
3434 Operands.
push_back(AArch64Operand::CreateImm(
3435 NewOp4, Op3.getStartLoc(), Op3.getEndLoc(), getContext()));
3436 Operands[3] = AArch64Operand::CreateImm(NewOp3, Op3.getStartLoc(),
3437 Op3.getEndLoc(), getContext());
3440 }
else if (NumOperands == 4 && Tok ==
"bfc") {
3442 AArch64Operand &Op1 =
static_cast<AArch64Operand &
>(*Operands[1]);
3443 AArch64Operand LSBOp =
static_cast<AArch64Operand &
>(*Operands[2]);
3444 AArch64Operand WidthOp =
static_cast<AArch64Operand &
>(*Operands[3]);
3446 if (Op1.isReg() && LSBOp.isImm() && WidthOp.isImm()) {
3450 if (LSBCE && WidthCE) {
3452 uint64_t Width = WidthCE->getValue();
3454 uint64_t RegWidth = 0;
3455 if (AArch64MCRegisterClasses[AArch64::GPR64allRegClassID].
contains(
3461 if (LSB >= RegWidth)
3462 return Error(LSBOp.getStartLoc(),
3463 "expected integer in range [0, 31]");
3464 if (Width < 1 || Width > RegWidth)
3465 return Error(WidthOp.getStartLoc(),
3466 "expected integer in range [1, 32]");
3470 ImmR = (32 - LSB) & 0x1f;
3472 ImmR = (64 - LSB) & 0x3f;
3474 uint64_t ImmS = Width - 1;
3476 if (ImmR != 0 && ImmS >= ImmR)
3477 return Error(WidthOp.getStartLoc(),
3478 "requested insert overflows register");
3482 Operands[0] = AArch64Operand::CreateToken(
3483 "bfm",
false, Op.getStartLoc(), getContext());
3484 Operands[2] = AArch64Operand::CreateReg(
3485 RegWidth == 32 ? AArch64::WZR : AArch64::XZR,
false,
SMLoc(),
3486 SMLoc(), getContext());
3487 Operands[3] = AArch64Operand::CreateImm(
3488 ImmRExpr, LSBOp.getStartLoc(), LSBOp.getEndLoc(), getContext());
3489 Operands.emplace_back(
3490 AArch64Operand::CreateImm(ImmSExpr, WidthOp.getStartLoc(),
3491 WidthOp.getEndLoc(), getContext()));
3494 }
else if (NumOperands == 5) {
3497 if (Tok ==
"bfi" || Tok ==
"sbfiz" || Tok ==
"ubfiz") {
3498 AArch64Operand &Op1 =
static_cast<AArch64Operand &
>(*Operands[1]);
3499 AArch64Operand &Op3 =
static_cast<AArch64Operand &
>(*Operands[3]);
3500 AArch64Operand &Op4 =
static_cast<AArch64Operand &
>(*Operands[4]);
3502 if (Op1.isReg() && Op3.isImm() && Op4.isImm()) {
3506 if (Op3CE && Op4CE) {
3507 uint64_t Op3Val = Op3CE->
getValue();
3508 uint64_t Op4Val = Op4CE->getValue();
3510 uint64_t RegWidth = 0;
3511 if (AArch64MCRegisterClasses[AArch64::GPR64allRegClassID].
contains(
3517 if (Op3Val >= RegWidth)
3518 return Error(Op3.getStartLoc(),
3519 "expected integer in range [0, 31]");
3520 if (Op4Val < 1 || Op4Val > RegWidth)
3521 return Error(Op4.getStartLoc(),
3522 "expected integer in range [1, 32]");
3524 uint64_t NewOp3Val = 0;
3526 NewOp3Val = (32 - Op3Val) & 0x1f;
3528 NewOp3Val = (64 - Op3Val) & 0x3f;
3530 uint64_t NewOp4Val = Op4Val - 1;
3532 if (NewOp3Val != 0 && NewOp4Val >= NewOp3Val)
3533 return Error(Op4.getStartLoc(),
3534 "requested insert overflows register");
3540 Operands[3] = AArch64Operand::CreateImm(
3541 NewOp3, Op3.getStartLoc(), Op3.getEndLoc(), getContext());
3542 Operands[4] = AArch64Operand::CreateImm(
3543 NewOp4, Op4.getStartLoc(), Op4.getEndLoc(), getContext());
3545 Operands[0] = AArch64Operand::CreateToken(
3546 "bfm",
false, Op.getStartLoc(), getContext());
3547 else if (Tok ==
"sbfiz")
3548 Operands[0] = AArch64Operand::CreateToken(
3549 "sbfm",
false, Op.getStartLoc(), getContext());
3550 else if (Tok ==
"ubfiz")
3551 Operands[0] = AArch64Operand::CreateToken(
3552 "ubfm",
false, Op.getStartLoc(), getContext());
3560 }
else if (NumOperands == 5 &&
3561 (Tok ==
"bfxil" || Tok ==
"sbfx" || Tok ==
"ubfx")) {
3562 AArch64Operand &Op1 =
static_cast<AArch64Operand &
>(*Operands[1]);
3563 AArch64Operand &Op3 =
static_cast<AArch64Operand &
>(*Operands[3]);
3564 AArch64Operand &Op4 =
static_cast<AArch64Operand &
>(*Operands[4]);
3566 if (Op1.isReg() && Op3.isImm() && Op4.isImm()) {
3570 if (Op3CE && Op4CE) {
3571 uint64_t Op3Val = Op3CE->
getValue();
3572 uint64_t Op4Val = Op4CE->getValue();
3574 uint64_t RegWidth = 0;
3575 if (AArch64MCRegisterClasses[AArch64::GPR64allRegClassID].
contains(
3581 if (Op3Val >= RegWidth)
3582 return Error(Op3.getStartLoc(),
3583 "expected integer in range [0, 31]");
3584 if (Op4Val < 1 || Op4Val > RegWidth)
3585 return Error(Op4.getStartLoc(),
3586 "expected integer in range [1, 32]");
3588 uint64_t NewOp4Val = Op3Val + Op4Val - 1;
3590 if (NewOp4Val >= RegWidth || NewOp4Val < Op3Val)
3591 return Error(Op4.getStartLoc(),
3592 "requested extract overflows register");
3596 Operands[4] = AArch64Operand::CreateImm(
3597 NewOp4, Op4.getStartLoc(), Op4.getEndLoc(), getContext());
3599 Operands[0] = AArch64Operand::CreateToken(
3600 "bfm",
false, Op.getStartLoc(), getContext());
3601 else if (Tok ==
"sbfx")
3602 Operands[0] = AArch64Operand::CreateToken(
3603 "sbfm",
false, Op.getStartLoc(), getContext());
3604 else if (Tok ==
"ubfx")
3605 Operands[0] = AArch64Operand::CreateToken(
3606 "ubfm",
false, Op.getStartLoc(), getContext());
3616 if (NumOperands == 3 && (Tok ==
"sxtw" || Tok ==
"uxtw")) {
3619 AArch64Operand &Op =
static_cast<AArch64Operand &
>(*Operands[2]);
3622 Operands[2] = AArch64Operand::CreateReg(Reg,
false, Op.getStartLoc(),
3623 Op.getEndLoc(), getContext());
3627 else if (NumOperands == 3 && (Tok ==
"sxtb" || Tok ==
"sxth")) {
3628 AArch64Operand &Op =
static_cast<AArch64Operand &
>(*Operands[1]);
3630 AArch64MCRegisterClasses[AArch64::GPR64allRegClassID].contains(
3634 AArch64Operand &Op =
static_cast<AArch64Operand &
>(*Operands[2]);
3637 Operands[2] = AArch64Operand::CreateReg(Reg,
false, Op.getStartLoc(),
3638 Op.getEndLoc(), getContext());
3643 else if (NumOperands == 3 && (Tok ==
"uxtb" || Tok ==
"uxth")) {
3644 AArch64Operand &Op =
static_cast<AArch64Operand &
>(*Operands[1]);
3646 AArch64MCRegisterClasses[AArch64::GPR64allRegClassID].contains(
3650 AArch64Operand &Op =
static_cast<AArch64Operand &
>(*Operands[1]);
3653 Operands[1] = AArch64Operand::CreateReg(Reg,
false, Op.getStartLoc(),
3654 Op.getEndLoc(), getContext());
3662 unsigned MatchResult =
3663 MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm, 1);
3667 if (MatchResult != Match_Success) {
3670 auto ShortFormNEONErrorInfo = ErrorInfo;
3671 auto ShortFormNEONMatchResult = MatchResult;
3674 MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm, 0);
3679 if (MatchResult == Match_InvalidOperand && ErrorInfo == 1 &&
3680 Operands.size() > 1 && ((AArch64Operand &)*Operands[1]).isToken() &&
3681 ((AArch64Operand &)*Operands[1]).isTokenSuffix()) {
3682 MatchResult = ShortFormNEONMatchResult;
3683 ErrorInfo = ShortFormNEONErrorInfo;
3687 switch (MatchResult) {
3688 case Match_Success: {
3691 NumOperands = Operands.size();
3692 for (
unsigned i = 1; i < NumOperands; ++i)
3693 OperandLocs.
push_back(Operands[i]->getStartLoc());
3694 if (validateInstruction(Inst, OperandLocs))
3701 case Match_MissingFeature: {
3702 assert(ErrorInfo &&
"Unknown missing feature!");
3705 std::string Msg =
"instruction requires:";
3707 for (
unsigned i = 0; i < (
sizeof(ErrorInfo)*8-1); ++i) {
3708 if (ErrorInfo & Mask) {
3714 return Error(IDLoc, Msg);
3716 case Match_MnemonicFail:
3717 return showMatchError(IDLoc, MatchResult, Operands);
3718 case Match_InvalidOperand: {
3719 SMLoc ErrorLoc = IDLoc;
3721 if (ErrorInfo != ~0ULL) {
3722 if (ErrorInfo >= Operands.size())
3723 return Error(IDLoc,
"too few operands for instruction",
3724 SMRange(IDLoc, getTok().getLoc()));
3726 ErrorLoc = ((AArch64Operand &)*Operands[ErrorInfo]).getStartLoc();
3727 if (ErrorLoc ==
SMLoc())
3732 if (((AArch64Operand &)*Operands[ErrorInfo]).isToken() &&
3733 ((AArch64Operand &)*Operands[ErrorInfo]).isTokenSuffix())
3734 MatchResult = Match_InvalidSuffix;
3736 return showMatchError(ErrorLoc, MatchResult, Operands);
3738 case Match_InvalidMemoryIndexed1:
3739 case Match_InvalidMemoryIndexed2:
3740 case Match_InvalidMemoryIndexed4:
3741 case Match_InvalidMemoryIndexed8:
3742 case Match_InvalidMemoryIndexed16:
3743 case Match_InvalidCondCode:
3744 case Match_AddSubRegExtendSmall:
3745 case Match_AddSubRegExtendLarge:
3746 case Match_AddSubSecondSource:
3747 case Match_LogicalSecondSource:
3748 case Match_AddSubRegShift32:
3749 case Match_AddSubRegShift64:
3750 case Match_InvalidMovImm32Shift:
3751 case Match_InvalidMovImm64Shift:
3752 case Match_InvalidFPImm:
3753 case Match_InvalidMemoryWExtend8:
3754 case Match_InvalidMemoryWExtend16:
3755 case Match_InvalidMemoryWExtend32:
3756 case Match_InvalidMemoryWExtend64:
3757 case Match_InvalidMemoryWExtend128:
3758 case Match_InvalidMemoryXExtend8:
3759 case Match_InvalidMemoryXExtend16:
3760 case Match_InvalidMemoryXExtend32:
3761 case Match_InvalidMemoryXExtend64:
3762 case Match_InvalidMemoryXExtend128:
3763 case Match_InvalidMemoryIndexed4SImm7:
3764 case Match_InvalidMemoryIndexed8SImm7:
3765 case Match_InvalidMemoryIndexed16SImm7:
3766 case Match_InvalidMemoryIndexedSImm9:
3767 case Match_InvalidImm0_1:
3768 case Match_InvalidImm0_7:
3769 case Match_InvalidImm0_15:
3770 case Match_InvalidImm0_31:
3771 case Match_InvalidImm0_63:
3772 case Match_InvalidImm0_127:
3773 case Match_InvalidImm0_255:
3774 case Match_InvalidImm0_65535:
3775 case Match_InvalidImm1_8:
3776 case Match_InvalidImm1_16:
3777 case Match_InvalidImm1_32:
3778 case Match_InvalidImm1_64:
3779 case Match_InvalidIndex1:
3780 case Match_InvalidIndexB:
3781 case Match_InvalidIndexH:
3782 case Match_InvalidIndexS:
3783 case Match_InvalidIndexD:
3784 case Match_InvalidLabel:
3787 if (ErrorInfo >= Operands.size())
3788 return Error(IDLoc,
"too few operands for instruction",
SMRange(IDLoc, (*Operands.back()).getEndLoc()));
3791 SMLoc ErrorLoc = ((AArch64Operand &)*Operands[ErrorInfo]).getStartLoc();
3792 if (ErrorLoc ==
SMLoc())
3794 return showMatchError(ErrorLoc, MatchResult, Operands);
3802 bool AArch64AsmParser::ParseDirective(
AsmToken DirectiveID) {
3804 getContext().getObjectFileInfo()->getObjectFileType();
3810 if (IDVal ==
".arch")
3811 parseDirectiveArch(Loc);
3812 else if (IDVal ==
".cpu")
3813 parseDirectiveCPU(Loc);
3814 else if (IDVal ==
".hword")
3815 parseDirectiveWord(2, Loc);
3816 else if (IDVal ==
".word")
3817 parseDirectiveWord(4, Loc);
3818 else if (IDVal ==
".xword")
3819 parseDirectiveWord(8, Loc);
3820 else if (IDVal ==
".tlsdesccall")
3821 parseDirectiveTLSDescCall(Loc);
3822 else if (IDVal ==
".ltorg" || IDVal ==
".pool")
3823 parseDirectiveLtorg(Loc);
3824 else if (IDVal ==
".unreq")
3825 parseDirectiveUnreq(Loc);
3826 else if (!IsMachO && !IsCOFF) {
3827 if (IDVal ==
".inst")
3828 parseDirectiveInst(Loc);
3832 parseDirectiveLOH(IDVal, Loc);
3838 static const struct {
3842 {
"crc", {AArch64::FeatureCRC} },
3843 {
"crypto", {AArch64::FeatureCrypto} },
3844 {
"fp", {AArch64::FeatureFPARMv8} },
3845 {
"simd", {AArch64::FeatureNEON} },
3846 {
"ras", {AArch64::FeatureRAS} },
3847 {
"lse", {AArch64::FeatureLSE} },
3858 bool AArch64AsmParser::parseDirectiveArch(
SMLoc L) {
3859 SMLoc ArchLoc = getLoc();
3862 std::tie(Arch, ExtensionString) =
3863 getParser().parseStringToEndOfStatement().
trim().
split(
'+');
3866 if (ID == static_cast<unsigned>(AArch64::ArchKind::AK_INVALID))
3867 return Error(ArchLoc,
"unknown arch name");
3873 std::vector<StringRef> AArch64Features;
3879 std::vector<std::string> ArchFeatures(AArch64Features.begin(), AArch64Features.end());
3883 if (!ExtensionString.
empty())
3884 ExtensionString.
split(RequestedExtensions,
'+');
3887 for (
auto Name : RequestedExtensions) {
3888 bool EnableFeature =
true;
3891 EnableFeature =
false;
3896 if (Extension.Name != Name)
3899 if (Extension.Features.none())
3903 ? (~Features & Extension.Features)
3904 : ( Features & Extension.Features);
3906 ComputeAvailableFeatures(STI.
ToggleFeature(ToggleFeatures));
3907 setAvailableFeatures(Features);
3920 bool AArch64AsmParser::parseDirectiveCPU(
SMLoc L) {
3921 SMLoc CurLoc = getLoc();
3924 std::tie(CPU, ExtensionString) =
3925 getParser().parseStringToEndOfStatement().
trim().
split(
'+');
3931 if (!ExtensionString.
empty())
3932 ExtensionString.
split(RequestedExtensions,
'+');
3936 if (!getSTI().isCPUStringValid(CPU)) {
3937 Error(CurLoc,
"unknown CPU name");
3946 for (
auto Name : RequestedExtensions) {
3950 bool EnableFeature =
true;
3953 EnableFeature =
false;
3957 bool FoundExtension =
false;
3958 for (
const auto &Extension : ExtensionMap) {
3959 if (Extension.Name != Name)
3962 if (Extension.Features.none())
3966 ? (~Features & Extension.Features)
3967 : ( Features & Extension.Features);
3969 ComputeAvailableFeatures(STI.
ToggleFeature(ToggleFeatures));
3970 setAvailableFeatures(Features);
3971 FoundExtension =
true;
3976 if (!FoundExtension)
3977 Error(CurLoc,
"unsupported architectural extension");
3986 bool AArch64AsmParser::parseDirectiveWord(
unsigned Size,
SMLoc L) {
3987 auto parseOp = [&]() ->
bool {
3989 if (getParser().parseExpression(Value))
3991 getParser().getStreamer().EmitValue(Value, Size, L);
3995 if (parseMany(parseOp))
4002 bool AArch64AsmParser::parseDirectiveInst(
SMLoc Loc) {
4004 return Error(Loc,
"expected expression following '.inst' directive");
4006 auto parseOp = [&]() ->
bool {
4009 if (check(getParser().parseExpression(Expr), L,
"expected expression"))
4011 const MCConstantExpr *Value = dyn_cast_or_null<MCConstantExpr>(Expr);
4012 if (check(!Value, L,
"expected constant expression"))
4014 getTargetStreamer().emitInst(Value->
getValue());
4018 if (parseMany(parseOp))
4019 return addErrorSuffix(
" in '.inst' directive");
4025 bool AArch64AsmParser::parseDirectiveTLSDescCall(
SMLoc L) {
4027 if (check(getParser().parseIdentifier(Name), L,
4028 "expected symbol after directive") ||
4032 MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
4040 getParser().getStreamer().EmitInstruction(Inst, getSTI());
4046 bool AArch64AsmParser::parseDirectiveLOH(
StringRef IDVal,
SMLoc Loc) {
4050 return TokError(
"expected an identifier or a number in directive");
4053 int64_t
Id = getParser().getTok().getIntVal();
4055 return TokError(
"invalid numeric identifier in directive");
4058 StringRef Name = getTok().getIdentifier();
4064 return TokError(
"invalid identifier in directive");
4072 assert(NbArgs != -1 &&
"Invalid number of arguments");
4075 for (
int Idx = 0; Idx < NbArgs; ++Idx) {
4077 if (getParser().parseIdentifier(Name))
4078 return TokError(
"expected identifier in directive");
4079 Args.
push_back(getContext().getOrCreateSymbol(Name));
4081 if (Idx + 1 == NbArgs)
4084 "unexpected token in '" +
Twine(IDVal) +
"' directive"))
4088 "unexpected token in '" +
Twine(IDVal) +
"' directive"))
4091 getStreamer().EmitLOHDirective((
MCLOHType)Kind, Args);
4097 bool AArch64AsmParser::parseDirectiveLtorg(
SMLoc L) {
4100 getTargetStreamer().emitCurrentConstantPool();
4106 bool AArch64AsmParser::parseDirectiveReq(
StringRef Name,
SMLoc L) {
4109 SMLoc SRegLoc = getLoc();
4110 unsigned RegNum = tryParseRegister();
4111 bool IsVector =
false;
4113 if (RegNum == static_cast<unsigned>(-1)) {
4115 RegNum = tryMatchVectorRegister(Kind,
false);
4117 return Error(SRegLoc,
"vector register without type specifier expected");
4121 if (RegNum == static_cast<unsigned>(-1))
4122 return Error(SRegLoc,
"register name or alias expected");
4126 "unexpected input in .req directive"))
4129 auto pair = std::make_pair(IsVector, RegNum);
4130 if (RegisterReqs.insert(std::make_pair(Name, pair)).first->second != pair)
4131 Warning(L,
"ignoring redefinition of register alias '" + Name +
"'");
4138 bool AArch64AsmParser::parseDirectiveUnreq(
SMLoc L) {
4141 return TokError(
"unexpected input in .unreq directive.");
4145 return addErrorSuffix(
"in '.unreq' directive");
4150 AArch64AsmParser::classifySymbolRef(
const MCExpr *Expr,
4158 if (
const AArch64MCExpr *AE = dyn_cast<AArch64MCExpr>(Expr)) {
4159 ELFRefKind = AE->getKind();
4160 Expr = AE->getSubExpr();
4166 DarwinRefKind = SE->
getKind();
4177 DarwinRefKind = SE->
getKind();
4206 #define GET_REGISTER_MATCHER
4207 #define GET_SUBTARGET_FEATURE_NAME
4208 #define GET_MATCHER_IMPLEMENTATION
4209 #include "AArch64GenAsmMatcher.inc"
4215 AArch64Operand &Op =
static_cast<AArch64Operand &
>(AsmOp);
4219 int64_t ExpectedVal;
4222 return Match_InvalidOperand;
4264 return Match_InvalidOperand;
4267 return Match_InvalidOperand;
4269 return Match_Success;
4270 return Match_InvalidOperand;
4274 AArch64AsmParser::tryParseGPRSeqPair(
OperandVector &Operands) {
4279 Error(S,
"expected register");
4283 int FirstReg = tryParseRegister();
4284 if (FirstReg == -1) {
4288 AArch64MCRegisterClasses[AArch64::GPR32RegClassID];
4290 AArch64MCRegisterClasses[AArch64::GPR64RegClassID];
4292 bool isXReg = XRegClass.
contains(FirstReg),
4293 isWReg = WRegClass.
contains(FirstReg);
4294 if (!isXReg && !isWReg) {
4295 Error(S,
"expected first even register of a "
4296 "consecutive same-size even/odd register pair");
4303 if (FirstEncoding & 0x1) {
4304 Error(S,
"expected first even register of a "
4305 "consecutive same-size even/odd register pair");
4311 Error(M,
"expected comma");
4318 int SecondReg = tryParseRegister();
4319 if (SecondReg ==-1) {
4324 (isXReg && !XRegClass.
contains(SecondReg)) ||
4325 (isWReg && !WRegClass.
contains(SecondReg))) {
4326 Error(E,
"expected second odd register of a "
4327 "consecutive same-size even/odd register pair");
4334 &AArch64MCRegisterClasses[AArch64::XSeqPairsClassRegClassID]);
4337 &AArch64MCRegisterClasses[AArch64::WSeqPairsClassRegClassID]);
4340 Operands.
push_back(AArch64Operand::CreateReg(Pair,
false, S, getLoc(),
static bool isValidVectorKind(StringRef Name)
static bool isReg(const MCInst &MI, unsigned OpNo)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
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.
Represents a range in source code.
void push_back(const T &Elt)
Target & getTheAArch64beTarget()
static float getFPImmFloat(unsigned Imm)
uint64_t getZExtValue() const
Get zero extended value.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
const char * getPointer() const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static const AArch64MCExpr * create(const MCExpr *Expr, VariantKind Kind, MCContext &Ctx)
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.
Target & getTheAArch64leTarget()
static MCOperand createExpr(const MCExpr *Val)
MCTargetAsmParser - Generic interface to target specific assembly parsers.
static CondCode getInvertedCondCode(CondCode Code)
Target specific streamer interface.
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...
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
bool isNot(TokenKind K) const
static unsigned getXRegFromWReg(unsigned Reg)
static bool isMOVZMovAlias(uint64_t Value, int Shift, int RegWidth)
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI, bool PrintSchedInfo=false)
Emit the given Instruction into the current section.
return AArch64::GPR64RegClass contains(Reg)
static SMLoc incrementLoc(SMLoc L, int Offset)
bool isSubRegisterEq(unsigned RegA, unsigned RegB) const
Returns true if RegB is a sub-register of RegA or if RegB == RegA.
static MCOperand createReg(unsigned Reg)
static ManagedStatic< DebugCounter > DC
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
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_ATTRIBUTE_ALWAYS_INLINE R Default(const T &Value) const
Reg
All possible values of the reg field in the ModR/M byte.
Target independent representation for an assembler token.
APInt bitcastToAPInt() const
Represent a reference to a symbol from inside an expression.
bool getExtensionFeatures(unsigned Extensions, std::vector< StringRef > &Features)
static bool isLogicalImmediate(uint64_t imm, unsigned regSize)
isLogicalImmediate - Return true if the immediate is valid for a logical immediate instruction of the...
std::string join(IteratorT Begin, IteratorT End, StringRef Separator)
Joins the strings in the range [Begin, End), adding Separator between the elements.
Windows NT (Windows on ARM)
Target & getTheARM64Target()
bool isIntN(unsigned N) const
Check if this APInt has an N-bits unsigned integer value.
static bool isMem(const MachineInstr &MI, unsigned Op)
zlib-gnu style compression
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand...
This file implements a class to represent arbitrary precision integral constant values and operations...
LLVM_NODISCARD bool empty() const
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
static bool isMOVNMovAlias(uint64_t Value, int Shift, int RegWidth)
Context object for machine code objects.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(const char(&S)[N], const T &Value)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
unsigned getReg() const
Returns the register number.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
bool getArchFeatures(unsigned ArchKind, std::vector< StringRef > &Features)
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
FeatureBitset getRequiredFeatures() const
static const fltSemantics & IEEEdouble() LLVM_READNONE
int64_t getIntVal() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
MCRegisterClass - Base class of TargetRegisterClass.
const AsmToken & getTok() const
Get the current AsmToken from the stream.
size_t size() const
size - Get the array size.
Instances of this class represent a single low-level machine instruction.
static unsigned getShifterImm(AArch64_AM::ShiftExtendType ST, unsigned Imm)
getShifterImm - Encode the shift type and amount: imm: 6-bit shift amount shifter: 000 ==> lsl 001 ==...
static unsigned getWRegFromXReg(unsigned Reg)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
FeatureBitset ToggleFeature(uint64_t FB)
ToggleFeature - Toggle a feature and returns the re-computed feature bits.
static unsigned getShiftValue(unsigned Imm)
getShiftValue - Extract the shift value.
const MCExpr * getExpr() const
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
A switch()-like statement whose cases are string literals.
Streaming machine code generation interface.
MCTargetStreamer * getTargetStreamer()
Container class for subtarget features.
std::size_t countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static const char * getShiftExtendName(AArch64_AM::ShiftExtendType ST)
getShiftName - Get the string encoding for the shift type.
const MCRegisterClass & getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static int MCLOHNameToId(StringRef 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.
unsigned getRegister(unsigned i) const
getRegister - Return the specified register in the class.
virtual MCAsmLexer & getLexer()=0
This file declares a class to represent arbitrary precision floating point values and provide a varie...
LLVM_NODISCARD StringRef trim(char Char) const
Return string with consecutive Char characters starting from the left and right removed.
MCLOHType
Linker Optimization Hint Type.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
const AsmToken peekTok(bool ShouldSkipSpace=true)
Look ahead at the next token to be lexed.
Binary assembler expressions.
unsigned getMatchingSuperReg(unsigned Reg, unsigned SubIdx, const MCRegisterClass *RC) const
Return a super-register of the specified register Reg so its sub-register of index SubIdx is Reg...
static uint64_t encodeLogicalImmediate(uint64_t imm, unsigned regSize)
encodeLogicalImmediate - Return the encoded immediate value for a logical immediate instruction of th...
static int getFP64Imm(const APInt &Imm)
getFP64Imm - Return an 8-bit floating-point version of the 64-bit floating-point value.
unsigned parseArch(StringRef Arch)
MCStreamer & getStreamer()
void setOpcode(unsigned Op)
bool contains(unsigned Reg) const
contains - Return true if the specified register is included in this register class.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
const FeatureBitset & getFeatureBits() const
getFeatureBits - Return the feature bits.
bool is(TokenKind K) const
static StringRef MCLOHDirectiveName()
StringRef getABIName() const
getABIName - If this returns a non-empty string this represents the textual name of the ABI that we w...
static void setRequiredFeatureString(FeatureBitset FBS, std::string &Str)
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
bool haveFeatures(FeatureBitset ActiveFeatures) const
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
unsigned getOpcode() const
Class for arbitrary precision integers.
bool isSignedIntN(unsigned N) const
Check if this APInt has an N-bits signed integer value.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static uint8_t encodeAdvSIMDModImmType10(uint64_t Imm)
const SysReg * lookupSysRegByName(StringRef)
Base class for user error types.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
uint32_t parseGenericRegister(StringRef Name)
static unsigned getArithExtendImm(AArch64_AM::ShiftExtendType ET, unsigned Imm)
getArithExtendImm - Encode the extend type and shift amount for an arithmetic instruction: imm: 3-bit...
loop data Loop Data Prefetch
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.
static bool isAdvSIMDModImmType10(uint64_t Imm)
StringRef getIdentifier() const
Get the identifier string for the current token, which should be an identifier or a string...
RegisterMCAsmParser - Helper template for registering a target specific assembly parser, for use in the target machine initialization function.
Opcode getOpcode() const
Get the kind of this binary expression.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
static bool isValidMCLOHType(unsigned Kind)
MCSubtargetInfo - Generic base class for all target subtargets.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
VariantKind getKind() const
std::string AArch64MnemonicSpellCheck(StringRef S, uint64_t FBS)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static int MCLOHIdToNbArgs(MCLOHType Kind)
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
LLVM Value Representation.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
const FeatureBitset Features
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.
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).
std::string Hash(const Unit &U)
void addOperand(const MCOperand &Op)
StringRef - Represent a constant reference to a string, i.e.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
unsigned getDefaultExtensions(StringRef CPU, unsigned ArchKind)
Represents a location in source code.
static const char * getSubtargetFeatureName(uint64_t Val)
LLVM_NODISCARD bool startswith_lower(StringRef Prefix) const
Check if this string starts with the given Prefix, ignoring case.
static MCOperand createImm(int64_t Val)
LLVM_NODISCARD std::string lower() const
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
const MCOperand & getOperand(unsigned i) const
static void parseValidVectorKind(StringRef Name, unsigned &NumElements, char &ElementKind)
void LLVMInitializeAArch64AsmParser()
Force static initialization.
void setDefaultFeatures(StringRef CPU, StringRef FS)
Set the features to the default for the given CPU with an appended feature string.
static const struct @315 ExtensionMap[]