68#define GET_INSTRINFO_CTOR_DTOR
69#include "AArch64GenInstrInfo.inc"
71#define DEBUG_TYPE "AArch64InstrInfo"
73STATISTIC(NumCopyInstrs,
"Number of COPY instructions expanded");
74STATISTIC(NumZCRegMoveInstrsGPR,
"Number of zero-cycle GPR register move "
75 "instructions expanded from canonical COPY");
76STATISTIC(NumZCRegMoveInstrsFPR,
"Number of zero-cycle FPR register move "
77 "instructions expanded from canonical COPY");
78STATISTIC(NumZCZeroingInstrsGPR,
"Number of zero-cycle GPR zeroing "
79 "instructions expanded from canonical COPY");
84 cl::desc(
"Restrict range of CB instructions (DEBUG)"));
88 cl::desc(
"Restrict range of TB[N]Z instructions (DEBUG)"));
92 cl::desc(
"Restrict range of CB[N]Z instructions (DEBUG)"));
96 cl::desc(
"Restrict range of Bcc instructions (DEBUG)"));
100 cl::desc(
"Restrict range of B instructions (DEBUG)"));
104 cl::desc(
"Restrict range of instructions to search for the "
105 "machine-combiner gather pattern optimization"));
109 cl::desc(
"Use a frame record for Mach-O non-leaf outlined functions"));
114 RI(STI.getTargetTriple(), STI.getHwMode()), Subtarget(STI) {}
124 switch (
MI.getOpcode()) {
135 if (
MI.getOperand(0).getReg() != AArch64::LR)
148 case AArch64::BLRAAZ:
150 case AArch64::BLRABZ:
154 case AArch64::AUTIASP:
155 case AArch64::AUTIBSP:
156 case AArch64::AUTIAZ:
157 case AArch64::AUTIBZ:
158 case AArch64::XPACLRI:
163 if (
MI.getOperand(0).getImm() == 3 &&
MI.getOperand(1).getImm() == 7 &&
164 MI.getOperand(3).getImm() == 1)
172 bool ModifiesLR =
false;
173 bool ModifiesSP =
false;
177 if (MO.getReg() == AArch64::LR)
179 else if (MO.getReg() == AArch64::SP)
188 if (
MI.mayLoadOrStore()) {
196 if (ModifiesSP || ModifiesLR)
214 auto Op =
MI.getOpcode();
215 if (
Op == AArch64::INLINEASM ||
Op == AArch64::INLINEASM_BR)
216 return getInlineAsmLength(
MI.getOperand(0).getSymbolName(), MAI);
220 if (
MI.isMetaInstruction())
225 unsigned NumBytes = 0;
235 NumBytes =
Desc.getSize() ?
Desc.getSize() : 4;
238 if (!MFI->shouldSignReturnAddress(*MF))
241 auto Method = STI.getAuthenticatedLRCheckMethod(*MF);
249 switch (
Desc.getOpcode()) {
252 return Desc.getSize();
259 case TargetOpcode::STACKMAP:
262 assert(NumBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
264 case TargetOpcode::PATCHPOINT:
267 assert(NumBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
269 case TargetOpcode::STATEPOINT:
271 assert(NumBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
276 case TargetOpcode::PATCHABLE_FUNCTION_ENTER:
281 F.getFnAttributeAsParsedInteger(
"patchable-function-entry", 9) * 4;
283 case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
284 case TargetOpcode::PATCHABLE_TAIL_CALL:
285 case TargetOpcode::PATCHABLE_TYPED_EVENT_CALL:
289 case TargetOpcode::PATCHABLE_EVENT_CALL:
295 NumBytes =
MI.getOperand(1).getImm();
297 case AArch64::MOVaddr:
298 case AArch64::MOVaddrJT:
299 case AArch64::MOVaddrCP:
300 case AArch64::MOVaddrBA:
301 case AArch64::MOVaddrTLS:
302 case AArch64::MOVaddrEXT: {
306 MI.getOperand(1).getTargetFlags(),
307 Subtarget.isTargetMachO(), Insn);
308 NumBytes = Insn.
size() * 4;
312 case AArch64::MOVi32imm:
313 case AArch64::MOVi64imm: {
315 unsigned BitSize =
Desc.getOpcode() == AArch64::MOVi32imm ? 32 : 64;
318 NumBytes = Insn.
size() * 4;
322 case TargetOpcode::BUNDLE:
323 NumBytes = getInstBundleSize(
MI);
359 case AArch64::CBWPri:
360 case AArch64::CBXPri:
361 case AArch64::CBWPrr:
362 case AArch64::CBXPrr:
370 case AArch64::CBBAssertExt:
371 case AArch64::CBHAssertExt:
402 case AArch64::CBWPri:
403 case AArch64::CBXPri:
404 case AArch64::CBBAssertExt:
405 case AArch64::CBHAssertExt:
406 case AArch64::CBWPrr:
407 case AArch64::CBXPrr:
413 int64_t BrOffset)
const {
415 assert(Bits >= 3 &&
"max branch displacement must be enough to jump"
416 "over conditional branch expansion");
417 return isIntN(Bits, BrOffset / 4);
422 switch (
MI.getOpcode()) {
426 return MI.getOperand(0).getMBB();
431 return MI.getOperand(2).getMBB();
437 return MI.getOperand(1).getMBB();
438 case AArch64::CBWPri:
439 case AArch64::CBXPri:
440 case AArch64::CBBAssertExt:
441 case AArch64::CBHAssertExt:
442 case AArch64::CBWPrr:
443 case AArch64::CBXPrr:
444 return MI.getOperand(3).getMBB();
454 assert(RS &&
"RegScavenger required for long branching");
456 "new block should be inserted for expanding unconditional branch");
459 "restore block should be inserted for restoring clobbered registers");
466 "Branch offsets outside of the signed 33-bit range not supported");
477 RS->enterBasicBlockEnd(
MBB);
480 constexpr Register Reg = AArch64::X16;
481 if (!RS->isRegUsed(Reg)) {
482 insertUnconditionalBranch(
MBB, &NewDestBB,
DL);
493 Register Scavenged = RS->FindUnusedReg(&AArch64::GPR64RegClass);
494 if (Scavenged != AArch64::NoRegister) {
495 buildIndirectBranch(Scavenged, NewDestBB);
496 RS->setRegUsed(Scavenged);
505 "Unable to insert indirect branch inside function that has red zone");
528 bool AllowModify)
const {
535 if (
I->getOpcode() == AArch64::SpeculationBarrierISBDSBEndBB ||
536 I->getOpcode() == AArch64::SpeculationBarrierSBEndBB) {
540 if (!isUnpredicatedTerminator(*
I))
547 unsigned LastOpc = LastInst->
getOpcode();
548 if (
I ==
MBB.begin() || !isUnpredicatedTerminator(*--
I)) {
563 unsigned SecondLastOpc = SecondLastInst->
getOpcode();
570 LastInst = SecondLastInst;
572 if (
I ==
MBB.begin() || !isUnpredicatedTerminator(*--
I)) {
577 SecondLastInst = &*
I;
578 SecondLastOpc = SecondLastInst->
getOpcode();
589 LastInst = SecondLastInst;
591 if (
I ==
MBB.begin() || !isUnpredicatedTerminator(*--
I)) {
593 "unreachable unconditional branches removed above");
602 SecondLastInst = &*
I;
603 SecondLastOpc = SecondLastInst->
getOpcode();
607 if (SecondLastInst &&
I !=
MBB.begin() && isUnpredicatedTerminator(*--
I))
623 I->eraseFromParent();
632 I->eraseFromParent();
641 MachineBranchPredicate &MBP,
642 bool AllowModify)
const {
654 assert(MBP.TrueDest &&
"expected!");
655 MBP.FalseDest = FBB ? FBB :
MBB.getNextNode();
657 MBP.ConditionDef =
nullptr;
658 MBP.SingleUseCondition =
false;
668 if (
I ==
MBB.begin())
684 if (
MI.modifiesRegister(AArch64::NZCV,
nullptr)) {
685 MBP.ConditionDef = &
MI;
694 case AArch64::CBNZX: {
698 MBP.Predicate = (
Opc == AArch64::CBNZX ||
Opc == AArch64::CBNZW)
699 ? MachineBranchPredicate::PRED_NE
700 : MachineBranchPredicate::PRED_EQ;
701 Register CondReg = MBP.LHS.getReg();
710 case AArch64::TBNZX: {
731 Cond[1].setImm(AArch64::CBNZW);
734 Cond[1].setImm(AArch64::CBZW);
737 Cond[1].setImm(AArch64::CBNZX);
740 Cond[1].setImm(AArch64::CBZX);
743 Cond[1].setImm(AArch64::TBNZW);
746 Cond[1].setImm(AArch64::TBZW);
749 Cond[1].setImm(AArch64::TBNZX);
752 Cond[1].setImm(AArch64::TBZX);
756 case AArch64::CBWPri:
757 case AArch64::CBXPri:
758 case AArch64::CBBAssertExt:
759 case AArch64::CBHAssertExt:
760 case AArch64::CBWPrr:
761 case AArch64::CBXPrr: {
774 int *BytesRemoved)
const {
784 I->eraseFromParent();
788 if (
I ==
MBB.begin()) {
801 I->eraseFromParent();
808void AArch64InstrInfo::instantiateCondBranch(
833 if (
Cond.size() > 5) {
844 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
871 unsigned Opc =
MI.getOpcode();
878 if (
MI.getOperand(0).getReg() == AArch64::WZR ||
879 MI.getOperand(0).getReg() == AArch64::XZR) {
881 dbgs() <<
"Removing always taken branch: " <<
MI);
884 for (
auto *S : Succs)
886 MBB->removeSuccessor(S);
888 while (
MBB->rbegin() != &
MI)
889 MBB->rbegin()->eraseFromParent();
890 MI.eraseFromParent();
900 if (
MI.getOperand(0).getReg() == AArch64::WZR ||
901 MI.getOperand(0).getReg() == AArch64::XZR) {
903 dbgs() <<
"Removing never taken branch: " <<
MI);
905 MI.getParent()->removeSuccessor(
Target);
906 MI.eraseFromParent();
921 VReg =
DefMI->getOperand(1).getReg();
930 unsigned *NewReg =
nullptr) {
935 bool Is64Bit = AArch64::GPR64allRegClass.hasSubClassEq(MRI.
getRegClass(VReg));
941 switch (
DefMI->getOpcode()) {
942 case AArch64::SUBREG_TO_REG:
946 if (!
DefMI->getOperand(1).isReg())
948 if (!
DefMI->getOperand(2).isImm() ||
949 DefMI->getOperand(2).getImm() != AArch64::sub_32)
952 if (
DefMI->getOpcode() != AArch64::MOVi32imm)
954 if (!
DefMI->getOperand(1).isImm() ||
DefMI->getOperand(1).getImm() != 1)
957 SrcReg = AArch64::XZR;
958 Opc = AArch64::CSINCXr;
961 case AArch64::MOVi32imm:
962 case AArch64::MOVi64imm:
963 if (!
DefMI->getOperand(1).isImm() ||
DefMI->getOperand(1).getImm() != 1)
965 SrcReg = Is64Bit ? AArch64::XZR : AArch64::WZR;
966 Opc = Is64Bit ? AArch64::CSINCXr : AArch64::CSINCWr;
969 case AArch64::ADDSXri:
970 case AArch64::ADDSWri:
972 if (
DefMI->findRegisterDefOperandIdx(AArch64::NZCV,
nullptr,
977 case AArch64::ADDXri:
978 case AArch64::ADDWri:
980 if (!
DefMI->getOperand(2).isImm() ||
DefMI->getOperand(2).getImm() != 1 ||
981 DefMI->getOperand(3).getImm() != 0)
983 SrcReg =
DefMI->getOperand(1).getReg();
984 Opc = Is64Bit ? AArch64::CSINCXr : AArch64::CSINCWr;
987 case AArch64::ORNXrr:
988 case AArch64::ORNWrr: {
991 if (ZReg != AArch64::XZR && ZReg != AArch64::WZR)
993 SrcReg =
DefMI->getOperand(2).getReg();
994 Opc = Is64Bit ? AArch64::CSINVXr : AArch64::CSINVWr;
998 case AArch64::SUBSXrr:
999 case AArch64::SUBSWrr:
1001 if (
DefMI->findRegisterDefOperandIdx(AArch64::NZCV,
nullptr,
1006 case AArch64::SUBXrr:
1007 case AArch64::SUBWrr: {
1010 if (ZReg != AArch64::XZR && ZReg != AArch64::WZR)
1012 SrcReg =
DefMI->getOperand(2).getReg();
1013 Opc = Is64Bit ? AArch64::CSNEGXr : AArch64::CSNEGWr;
1019 assert(
Opc && SrcReg &&
"Missing parameters");
1029 Register FalseReg,
int &CondCycles,
1031 int &FalseCycles)
const {
1042 if (!RI.getCommonSubClass(RC, MRI.
getRegClass(DstReg)))
1046 unsigned ExtraCondLat =
Cond.size() != 1;
1050 if (AArch64::GPR64allRegClass.hasSubClassEq(RC) ||
1051 AArch64::GPR32allRegClass.hasSubClassEq(RC)) {
1053 CondCycles = 1 + ExtraCondLat;
1054 TrueCycles = FalseCycles = 1;
1064 if (AArch64::FPR64RegClass.hasSubClassEq(RC) ||
1065 AArch64::FPR32RegClass.hasSubClassEq(RC)) {
1066 CondCycles = 5 + ExtraCondLat;
1067 TrueCycles = FalseCycles = 2;
1084 switch (
Cond.size()) {
1104 case AArch64::CBNZW:
1108 case AArch64::CBNZX:
1139 case AArch64::TBNZW:
1140 case AArch64::TBNZX:
1162 unsigned SubsOpc, SubsDestReg;
1168 case AArch64::CBWPri:
1169 SubsOpc = AArch64::SUBSWri;
1170 SubsDestReg = AArch64::WZR;
1173 case AArch64::CBXPri:
1174 SubsOpc = AArch64::SUBSXri;
1175 SubsDestReg = AArch64::XZR;
1178 case AArch64::CBWPrr:
1179 SubsOpc = AArch64::SUBSWrr;
1180 SubsDestReg = AArch64::WZR;
1183 case AArch64::CBXPrr:
1184 SubsOpc = AArch64::SUBSXrr;
1185 SubsDestReg = AArch64::XZR;
1214 switch (ExtendType) {
1220 "Unexpected compare-and-branch instruction for SXTB shift-extend");
1221 ExtOpc = AArch64::SBFMWri;
1227 "Unexpected compare-and-branch instruction for SXTH shift-extend");
1228 ExtOpc = AArch64::SBFMWri;
1234 "Unexpected compare-and-branch instruction for UXTB shift-extend");
1235 ExtOpc = AArch64::ANDWri;
1241 "Unexpected compare-and-branch instruction for UXTH shift-extend");
1242 ExtOpc = AArch64::ANDWri;
1251 if (ExtOpc != AArch64::ANDWri)
1253 MBBI.addImm(ExtBits);
1281 bool TryFold =
false;
1283 RC = &AArch64::GPR64RegClass;
1284 Opc = AArch64::CSELXr;
1287 RC = &AArch64::GPR32RegClass;
1288 Opc = AArch64::CSELWr;
1291 RC = &AArch64::FPR64RegClass;
1292 Opc = AArch64::FCSELDrrr;
1294 RC = &AArch64::FPR32RegClass;
1295 Opc = AArch64::FCSELSrrr;
1297 assert(RC &&
"Unsupported regclass");
1301 unsigned NewReg = 0;
1324 (FalseReg.
isVirtual() || FalseReg == AArch64::WZR ||
1325 FalseReg == AArch64::XZR) &&
1326 "FalseReg was folded into a non-virtual register other than WZR or XZR");
1343 assert(BitSize == 64 &&
"Only bit sizes of 32 or 64 allowed");
1348 return Is.
size() <= 2;
1353 assert(
MI.isCopy() &&
"Expected COPY instruction");
1359 if (
Reg.isVirtual())
1361 if (
Reg.isPhysical())
1362 return RI.getMinimalPhysRegClass(
Reg);
1367 if (DstRC && SrcRC && !RI.getCommonSubClass(DstRC, SrcRC))
1370 return MI.isAsCheapAsAMove();
1376 if (Subtarget.hasExynosCheapAsMoveHandling()) {
1377 if (isExynosCheapAsMove(
MI))
1379 return MI.isAsCheapAsAMove();
1382 switch (
MI.getOpcode()) {
1384 return MI.isAsCheapAsAMove();
1386 case TargetOpcode::COPY:
1389 case AArch64::ADDWrs:
1390 case AArch64::ADDXrs:
1391 case AArch64::SUBWrs:
1392 case AArch64::SUBXrs:
1393 return Subtarget.hasALULSLFast() &&
MI.getOperand(3).getImm() <= 4;
1398 case AArch64::MOVi32imm:
1400 case AArch64::MOVi64imm:
1405bool AArch64InstrInfo::isFalkorShiftExtFast(
const MachineInstr &
MI) {
1406 switch (
MI.getOpcode()) {
1410 case AArch64::ADDWrs:
1411 case AArch64::ADDXrs:
1412 case AArch64::ADDSWrs:
1413 case AArch64::ADDSXrs: {
1414 unsigned Imm =
MI.getOperand(3).getImm();
1421 case AArch64::ADDWrx:
1422 case AArch64::ADDXrx:
1423 case AArch64::ADDXrx64:
1424 case AArch64::ADDSWrx:
1425 case AArch64::ADDSXrx:
1426 case AArch64::ADDSXrx64: {
1427 unsigned Imm =
MI.getOperand(3).getImm();
1439 case AArch64::SUBWrs:
1440 case AArch64::SUBSWrs: {
1441 unsigned Imm =
MI.getOperand(3).getImm();
1443 return ShiftVal == 0 ||
1447 case AArch64::SUBXrs:
1448 case AArch64::SUBSXrs: {
1449 unsigned Imm =
MI.getOperand(3).getImm();
1451 return ShiftVal == 0 ||
1455 case AArch64::SUBWrx:
1456 case AArch64::SUBXrx:
1457 case AArch64::SUBXrx64:
1458 case AArch64::SUBSWrx:
1459 case AArch64::SUBSXrx:
1460 case AArch64::SUBSXrx64: {
1461 unsigned Imm =
MI.getOperand(3).getImm();
1473 case AArch64::LDRBBroW:
1474 case AArch64::LDRBBroX:
1475 case AArch64::LDRBroW:
1476 case AArch64::LDRBroX:
1477 case AArch64::LDRDroW:
1478 case AArch64::LDRDroX:
1479 case AArch64::LDRHHroW:
1480 case AArch64::LDRHHroX:
1481 case AArch64::LDRHroW:
1482 case AArch64::LDRHroX:
1483 case AArch64::LDRQroW:
1484 case AArch64::LDRQroX:
1485 case AArch64::LDRSBWroW:
1486 case AArch64::LDRSBWroX:
1487 case AArch64::LDRSBXroW:
1488 case AArch64::LDRSBXroX:
1489 case AArch64::LDRSHWroW:
1490 case AArch64::LDRSHWroX:
1491 case AArch64::LDRSHXroW:
1492 case AArch64::LDRSHXroX:
1493 case AArch64::LDRSWroW:
1494 case AArch64::LDRSWroX:
1495 case AArch64::LDRSroW:
1496 case AArch64::LDRSroX:
1497 case AArch64::LDRWroW:
1498 case AArch64::LDRWroX:
1499 case AArch64::LDRXroW:
1500 case AArch64::LDRXroX:
1501 case AArch64::PRFMroW:
1502 case AArch64::PRFMroX:
1503 case AArch64::STRBBroW:
1504 case AArch64::STRBBroX:
1505 case AArch64::STRBroW:
1506 case AArch64::STRBroX:
1507 case AArch64::STRDroW:
1508 case AArch64::STRDroX:
1509 case AArch64::STRHHroW:
1510 case AArch64::STRHHroX:
1511 case AArch64::STRHroW:
1512 case AArch64::STRHroX:
1513 case AArch64::STRQroW:
1514 case AArch64::STRQroX:
1515 case AArch64::STRSroW:
1516 case AArch64::STRSroX:
1517 case AArch64::STRWroW:
1518 case AArch64::STRWroX:
1519 case AArch64::STRXroW:
1520 case AArch64::STRXroX: {
1521 unsigned IsSigned =
MI.getOperand(3).getImm();
1528 unsigned Opc =
MI.getOpcode();
1532 case AArch64::SEH_StackAlloc:
1533 case AArch64::SEH_SaveFPLR:
1534 case AArch64::SEH_SaveFPLR_X:
1535 case AArch64::SEH_SaveReg:
1536 case AArch64::SEH_SaveReg_X:
1537 case AArch64::SEH_SaveRegP:
1538 case AArch64::SEH_SaveRegP_X:
1539 case AArch64::SEH_SaveFReg:
1540 case AArch64::SEH_SaveFReg_X:
1541 case AArch64::SEH_SaveFRegP:
1542 case AArch64::SEH_SaveFRegP_X:
1543 case AArch64::SEH_SetFP:
1544 case AArch64::SEH_AddFP:
1545 case AArch64::SEH_Nop:
1546 case AArch64::SEH_PrologEnd:
1547 case AArch64::SEH_EpilogStart:
1548 case AArch64::SEH_EpilogEnd:
1549 case AArch64::SEH_PACSignLR:
1550 case AArch64::SEH_SaveAnyRegI:
1551 case AArch64::SEH_SaveAnyRegIP:
1552 case AArch64::SEH_SaveAnyRegQP:
1553 case AArch64::SEH_SaveAnyRegQPX:
1554 case AArch64::SEH_AllocZ:
1555 case AArch64::SEH_SaveZReg:
1556 case AArch64::SEH_SavePReg:
1563 unsigned &SubIdx)
const {
1564 switch (
MI.getOpcode()) {
1567 case AArch64::SBFMXri:
1568 case AArch64::UBFMXri:
1571 if (
MI.getOperand(2).getImm() != 0 ||
MI.getOperand(3).getImm() != 31)
1574 SrcReg =
MI.getOperand(1).getReg();
1575 DstReg =
MI.getOperand(0).getReg();
1576 SubIdx = AArch64::sub_32;
1585 int64_t OffsetA = 0, OffsetB = 0;
1586 TypeSize WidthA(0,
false), WidthB(0,
false);
1587 bool OffsetAIsScalable =
false, OffsetBIsScalable =
false;
1608 OffsetAIsScalable == OffsetBIsScalable) {
1609 int LowOffset = OffsetA < OffsetB ? OffsetA : OffsetB;
1610 int HighOffset = OffsetA < OffsetB ? OffsetB : OffsetA;
1611 TypeSize LowWidth = (LowOffset == OffsetA) ? WidthA : WidthB;
1612 if (LowWidth.
isScalable() == OffsetAIsScalable &&
1630 switch (
MI.getOpcode()) {
1633 if (
MI.getOperand(0).getImm() == 0x14)
1640 case AArch64::MSRpstatesvcrImm1:
1647 auto Next = std::next(
MI.getIterator());
1648 return Next !=
MBB->end() &&
Next->isCFIInstruction();
1655 Register &SrcReg2, int64_t &CmpMask,
1656 int64_t &CmpValue)
const {
1660 assert(
MI.getNumOperands() >= 2 &&
"All AArch64 cmps should have 2 operands");
1661 if (!
MI.getOperand(1).isReg() ||
MI.getOperand(1).getSubReg())
1664 switch (
MI.getOpcode()) {
1667 case AArch64::PTEST_PP:
1668 case AArch64::PTEST_PP_ANY:
1669 case AArch64::PTEST_PP_FIRST:
1670 SrcReg =
MI.getOperand(0).getReg();
1671 SrcReg2 =
MI.getOperand(1).getReg();
1672 if (
MI.getOperand(2).getSubReg())
1679 case AArch64::SUBSWrr:
1680 case AArch64::SUBSWrs:
1681 case AArch64::SUBSWrx:
1682 case AArch64::SUBSXrr:
1683 case AArch64::SUBSXrs:
1684 case AArch64::SUBSXrx:
1685 case AArch64::ADDSWrr:
1686 case AArch64::ADDSWrs:
1687 case AArch64::ADDSWrx:
1688 case AArch64::ADDSXrr:
1689 case AArch64::ADDSXrs:
1690 case AArch64::ADDSXrx:
1692 SrcReg =
MI.getOperand(1).getReg();
1693 SrcReg2 =
MI.getOperand(2).getReg();
1696 if (
MI.getOperand(2).getSubReg())
1702 case AArch64::SUBSWri:
1703 case AArch64::ADDSWri:
1704 case AArch64::SUBSXri:
1705 case AArch64::ADDSXri:
1706 SrcReg =
MI.getOperand(1).getReg();
1709 CmpValue =
MI.getOperand(2).getImm();
1711 case AArch64::ANDSWri:
1712 case AArch64::ANDSXri:
1715 SrcReg =
MI.getOperand(1).getReg();
1719 MI.getOperand(2).getImm(),
1720 MI.getOpcode() == AArch64::ANDSWri ? 32 : 64);
1729 assert(
MBB &&
"Can't get MachineBasicBlock here");
1731 assert(MF &&
"Can't get MachineFunction here");
1736 for (
unsigned OpIdx = 0, EndIdx = Instr.getNumOperands(); OpIdx < EndIdx;
1740 Instr.getRegClassConstraint(OpIdx,
TII,
TRI);
1743 if (!OpRegCstraints)
1751 "Operand has register constraints without being a register!");
1754 if (
Reg.isPhysical()) {
1771 bool MIDefinesZeroReg =
false;
1772 if (
MI.definesRegister(AArch64::WZR,
nullptr) ||
1773 MI.definesRegister(AArch64::XZR,
nullptr))
1774 MIDefinesZeroReg =
true;
1776 switch (
MI.getOpcode()) {
1778 return MI.getOpcode();
1779 case AArch64::ADDSWrr:
1780 return AArch64::ADDWrr;
1781 case AArch64::ADDSWri:
1782 return MIDefinesZeroReg ? AArch64::ADDSWri : AArch64::ADDWri;
1783 case AArch64::ADDSWrs:
1784 return MIDefinesZeroReg ? AArch64::ADDSWrs : AArch64::ADDWrs;
1785 case AArch64::ADDSWrx:
1786 return AArch64::ADDWrx;
1787 case AArch64::ADDSXrr:
1788 return AArch64::ADDXrr;
1789 case AArch64::ADDSXri:
1790 return MIDefinesZeroReg ? AArch64::ADDSXri : AArch64::ADDXri;
1791 case AArch64::ADDSXrs:
1792 return MIDefinesZeroReg ? AArch64::ADDSXrs : AArch64::ADDXrs;
1793 case AArch64::ADDSXrx:
1794 return AArch64::ADDXrx;
1795 case AArch64::SUBSWrr:
1796 return AArch64::SUBWrr;
1797 case AArch64::SUBSWri:
1798 return MIDefinesZeroReg ? AArch64::SUBSWri : AArch64::SUBWri;
1799 case AArch64::SUBSWrs:
1800 return MIDefinesZeroReg ? AArch64::SUBSWrs : AArch64::SUBWrs;
1801 case AArch64::SUBSWrx:
1802 return AArch64::SUBWrx;
1803 case AArch64::SUBSXrr:
1804 return AArch64::SUBXrr;
1805 case AArch64::SUBSXri:
1806 return MIDefinesZeroReg ? AArch64::SUBSXri : AArch64::SUBXri;
1807 case AArch64::SUBSXrs:
1808 return MIDefinesZeroReg ? AArch64::SUBSXrs : AArch64::SUBXrs;
1809 case AArch64::SUBSXrx:
1810 return AArch64::SUBXrx;
1825 if (To == To->getParent()->begin())
1830 if (To->getParent() != From->getParent())
1842 Instr.modifiesRegister(AArch64::NZCV,
TRI)) ||
1843 ((AccessToCheck &
AK_Read) && Instr.readsRegister(AArch64::NZCV,
TRI)))
1849std::optional<unsigned>
1853 unsigned MaskOpcode =
Mask->getOpcode();
1854 unsigned PredOpcode = Pred->
getOpcode();
1855 bool PredIsPTestLike = isPTestLikeOpcode(PredOpcode);
1856 bool PredIsWhileLike = isWhileOpcode(PredOpcode);
1858 if (PredIsWhileLike) {
1862 if ((Mask == Pred) && PTest->
getOpcode() == AArch64::PTEST_PP_ANY)
1869 getElementSizeForOpcode(MaskOpcode) ==
1870 getElementSizeForOpcode(PredOpcode))
1876 if (PTest->
getOpcode() == AArch64::PTEST_PP_FIRST &&
1883 if (PredIsPTestLike) {
1888 if ((Mask == Pred) && PTest->
getOpcode() == AArch64::PTEST_PP_ANY)
1896 if (Mask != PTestLikeMask && PTestLikeMask->isFullCopy() &&
1897 PTestLikeMask->getOperand(1).getReg().isVirtual())
1905 getElementSizeForOpcode(MaskOpcode) ==
1906 getElementSizeForOpcode(PredOpcode)) {
1907 if (Mask == PTestLikeMask || PTest->
getOpcode() == AArch64::PTEST_PP_ANY)
1933 uint64_t PredElementSize = getElementSizeForOpcode(PredOpcode);
1935 PTest->
getOpcode() == AArch64::PTEST_PP_ANY))
1943 switch (PredOpcode) {
1944 case AArch64::AND_PPzPP:
1945 case AArch64::BIC_PPzPP:
1946 case AArch64::EOR_PPzPP:
1947 case AArch64::NAND_PPzPP:
1948 case AArch64::NOR_PPzPP:
1949 case AArch64::ORN_PPzPP:
1950 case AArch64::ORR_PPzPP:
1951 case AArch64::BRKA_PPzP:
1952 case AArch64::BRKPA_PPzPP:
1953 case AArch64::BRKB_PPzP:
1954 case AArch64::BRKPB_PPzPP:
1955 case AArch64::RDFFR_PPz: {
1959 if (Mask != PredMask)
1963 case AArch64::BRKN_PPzP: {
1967 if ((MaskOpcode != AArch64::PTRUE_B) ||
1968 (
Mask->getOperand(1).getImm() != 31))
1972 case AArch64::PTRUE_B:
1985bool AArch64InstrInfo::optimizePTestInstr(
1986 MachineInstr *PTest,
unsigned MaskReg,
unsigned PredReg,
1991 if (Pred->
isCopy() && PTest->
getOpcode() == AArch64::PTEST_PP_FIRST) {
1995 if (
Op.isReg() &&
Op.getReg().isVirtual() &&
1996 Op.getSubReg() == AArch64::psub0)
2000 unsigned PredOpcode = Pred->
getOpcode();
2001 auto NewOp = canRemovePTestInstr(PTest, Mask, Pred, MRI);
2017 if (*NewOp != PredOpcode) {
2028 for (; i !=
e; ++i) {
2059 if (DeadNZCVIdx != -1) {
2078 if (CmpInstr.
getOpcode() == AArch64::PTEST_PP ||
2079 CmpInstr.
getOpcode() == AArch64::PTEST_PP_ANY ||
2080 CmpInstr.
getOpcode() == AArch64::PTEST_PP_FIRST)
2081 return optimizePTestInstr(&CmpInstr, SrcReg, SrcReg2, MRI);
2090 if (CmpValue == 0 && substituteCmpToZero(CmpInstr, SrcReg, *MRI))
2092 return (CmpValue == 0 || CmpValue == 1) &&
2093 removeCmpToZeroOrOne(CmpInstr, SrcReg, CmpValue, *MRI);
2101 switch (Instr.getOpcode()) {
2103 return AArch64::INSTRUCTION_LIST_END;
2105 case AArch64::ADDSWrr:
2106 case AArch64::ADDSWri:
2107 case AArch64::ADDSXrr:
2108 case AArch64::ADDSXri:
2109 case AArch64::ADDSWrx:
2110 case AArch64::ADDSXrx:
2111 case AArch64::ADDSWrs:
2112 case AArch64::ADDSXrs:
2113 case AArch64::SUBSWrr:
2114 case AArch64::SUBSWri:
2115 case AArch64::SUBSWrx:
2116 case AArch64::SUBSWrs:
2117 case AArch64::SUBSXrr:
2118 case AArch64::SUBSXri:
2119 case AArch64::SUBSXrx:
2120 case AArch64::SUBSXrs:
2121 case AArch64::ANDSWri:
2122 case AArch64::ANDSWrr:
2123 case AArch64::ANDSWrs:
2124 case AArch64::ANDSXri:
2125 case AArch64::ANDSXrr:
2126 case AArch64::ANDSXrs:
2127 case AArch64::BICSWrr:
2128 case AArch64::BICSXrr:
2129 case AArch64::BICSWrs:
2130 case AArch64::BICSXrs:
2131 case AArch64::ADCSWr:
2132 case AArch64::ADCSXr:
2133 case AArch64::SBCSWr:
2134 case AArch64::SBCSXr:
2135 return Instr.getOpcode();
2137 case AArch64::ADDWrr:
2138 return AArch64::ADDSWrr;
2139 case AArch64::ADDWri:
2140 return AArch64::ADDSWri;
2141 case AArch64::ADDXrr:
2142 return AArch64::ADDSXrr;
2143 case AArch64::ADDXri:
2144 return AArch64::ADDSXri;
2145 case AArch64::ADDWrx:
2146 return AArch64::ADDSWrx;
2147 case AArch64::ADDXrx:
2148 return AArch64::ADDSXrx;
2149 case AArch64::ADDWrs:
2150 return AArch64::ADDSWrs;
2151 case AArch64::ADDXrs:
2152 return AArch64::ADDSXrs;
2153 case AArch64::ADCWr:
2154 return AArch64::ADCSWr;
2155 case AArch64::ADCXr:
2156 return AArch64::ADCSXr;
2157 case AArch64::SUBWrr:
2158 return AArch64::SUBSWrr;
2159 case AArch64::SUBWri:
2160 return AArch64::SUBSWri;
2161 case AArch64::SUBXrr:
2162 return AArch64::SUBSXrr;
2163 case AArch64::SUBXri:
2164 return AArch64::SUBSXri;
2165 case AArch64::SUBWrx:
2166 return AArch64::SUBSWrx;
2167 case AArch64::SUBXrx:
2168 return AArch64::SUBSXrx;
2169 case AArch64::SUBWrs:
2170 return AArch64::SUBSWrs;
2171 case AArch64::SUBXrs:
2172 return AArch64::SUBSXrs;
2173 case AArch64::SBCWr:
2174 return AArch64::SBCSWr;
2175 case AArch64::SBCXr:
2176 return AArch64::SBCSXr;
2177 case AArch64::ANDWri:
2178 return AArch64::ANDSWri;
2179 case AArch64::ANDXri:
2180 return AArch64::ANDSXri;
2181 case AArch64::ANDWrr:
2182 return AArch64::ANDSWrr;
2183 case AArch64::ANDWrs:
2184 return AArch64::ANDSWrs;
2185 case AArch64::ANDXrr:
2186 return AArch64::ANDSXrr;
2187 case AArch64::ANDXrs:
2188 return AArch64::ANDSXrs;
2189 case AArch64::BICWrr:
2190 return AArch64::BICSWrr;
2191 case AArch64::BICXrr:
2192 return AArch64::BICSXrr;
2193 case AArch64::BICWrs:
2194 return AArch64::BICSWrs;
2195 case AArch64::BICXrs:
2196 return AArch64::BICSXrs;
2202 for (
auto *BB :
MBB->successors())
2203 if (BB->isLiveIn(AArch64::NZCV))
2210int AArch64InstrInfo::findCondCodeUseOperandIdxForBranchOrSelect(
2212 switch (
Instr.getOpcode()) {
2216 case AArch64::Bcc: {
2217 int Idx =
Instr.findRegisterUseOperandIdx(AArch64::NZCV,
nullptr);
2222 case AArch64::CSINVWr:
2223 case AArch64::CSINVXr:
2224 case AArch64::CSINCWr:
2225 case AArch64::CSINCXr:
2226 case AArch64::CSELWr:
2227 case AArch64::CSELXr:
2228 case AArch64::CSNEGWr:
2229 case AArch64::CSNEGXr:
2230 case AArch64::FCSELSrrr:
2231 case AArch64::FCSELDrrr: {
2232 int Idx =
Instr.findRegisterUseOperandIdx(AArch64::NZCV,
nullptr);
2244 AArch64InstrInfo::findCondCodeUseOperandIdxForBranchOrSelect(Instr);
2246 Instr.getOperand(CCIdx).
getImm())
2299std::optional<UsedNZCV>
2304 if (
MI.getParent() != CmpParent)
2305 return std::nullopt;
2308 return std::nullopt;
2313 if (Instr.readsRegister(AArch64::NZCV, &
TRI)) {
2316 return std::nullopt;
2321 if (Instr.modifiesRegister(AArch64::NZCV, &
TRI))
2324 return NZCVUsedAfterCmp;
2328 return Opcode == AArch64::ADDSWri || Opcode == AArch64::ADDSXri;
2332 return Opcode == AArch64::SUBSWri || Opcode == AArch64::SUBSXri;
2338 case AArch64::ANDSWri:
2339 case AArch64::ANDSWrr:
2340 case AArch64::ANDSWrs:
2341 case AArch64::ANDSXri:
2342 case AArch64::ANDSXrr:
2343 case AArch64::ANDSXrs:
2344 case AArch64::BICSWrr:
2345 case AArch64::BICSXrr:
2346 case AArch64::BICSWrs:
2347 case AArch64::BICSXrs:
2373 const unsigned CmpOpcode = CmpInstr.
getOpcode();
2379 "Caller guarantees that CmpInstr compares with constant 0");
2382 if (!NZVCUsed || NZVCUsed->C)
2403bool AArch64InstrInfo::substituteCmpToZero(
2414 if (NewOpc == AArch64::INSTRUCTION_LIST_END)
2421 MI->setDesc(
get(NewOpc));
2426 MI->addRegisterDefined(AArch64::NZCV, &
TRI);
2438 assert((CmpValue == 0 || CmpValue == 1) &&
2439 "Only comparisons to 0 or 1 considered for removal!");
2442 unsigned MIOpc =
MI.getOpcode();
2443 if (MIOpc == AArch64::CSINCWr) {
2444 if (
MI.getOperand(1).getReg() != AArch64::WZR ||
2445 MI.getOperand(2).getReg() != AArch64::WZR)
2447 }
else if (MIOpc == AArch64::CSINCXr) {
2448 if (
MI.getOperand(1).getReg() != AArch64::XZR ||
2449 MI.getOperand(2).getReg() != AArch64::XZR)
2459 if (
MI.findRegisterDefOperandIdx(AArch64::NZCV,
nullptr,
true) != -1)
2463 const unsigned CmpOpcode = CmpInstr.
getOpcode();
2465 if (CmpValue && !IsSubsRegImm)
2467 if (!CmpValue && !IsSubsRegImm && !
isADDSRegImm(CmpOpcode))
2472 if (MIUsedNZCV.
C || MIUsedNZCV.
V)
2475 std::optional<UsedNZCV> NZCVUsedAfterCmp =
2479 if (!NZCVUsedAfterCmp || NZCVUsedAfterCmp->C || NZCVUsedAfterCmp->V)
2482 if ((MIUsedNZCV.
Z && NZCVUsedAfterCmp->N) ||
2483 (MIUsedNZCV.
N && NZCVUsedAfterCmp->Z))
2486 if (MIUsedNZCV.
N && !CmpValue)
2528bool AArch64InstrInfo::removeCmpToZeroOrOne(
2535 SmallVector<MachineInstr *, 4> CCUseInstrs;
2536 bool IsInvertCC =
false;
2544 for (MachineInstr *CCUseInstr : CCUseInstrs) {
2545 int Idx = findCondCodeUseOperandIdxForBranchOrSelect(*CCUseInstr);
2546 assert(Idx >= 0 &&
"Unexpected instruction using CC.");
2547 MachineOperand &CCOperand = CCUseInstr->getOperand(Idx);
2556bool AArch64InstrInfo::expandPostRAPseudo(
MachineInstr &
MI)
const {
2557 if (
MI.getOpcode() != TargetOpcode::LOAD_STACK_GUARD &&
2558 MI.getOpcode() != AArch64::CATCHRET &&
2559 MI.getOpcode() != AArch64::STACK_GUARD_UNMIX)
2564 auto TRI = Subtarget.getRegisterInfo();
2567 if (
MI.getOpcode() == AArch64::STACK_GUARD_UNMIX) {
2581 if (
MI.getOpcode() == AArch64::CATCHRET) {
2583 const TargetInstrInfo *
TII =
2585 MachineBasicBlock *TargetMBB =
MI.getOperand(0).getMBB();
2590 FirstEpilogSEH = std::prev(FirstEpilogSEH);
2592 FirstEpilogSEH = std::next(FirstEpilogSEH);
2607 if (
M.getStackProtectorGuard() ==
"sysreg") {
2608 const AArch64SysReg::SysReg *SrcReg =
2609 AArch64SysReg::lookupSysRegByName(
M.getStackProtectorGuardReg());
2617 int Offset =
M.getStackProtectorGuardOffset();
2668 const GlobalValue *GV =
2671 unsigned OpFlags = Subtarget.ClassifyGlobalReference(GV, TM);
2674 unsigned GuardWidth =
M.getStackProtectorGuardValueWidth().value_or(
2675 Subtarget.isTargetILP32() ? 4 : 8);
2676 if (GuardWidth != 4 && GuardWidth != 8)
2681 if (GuardWidth == 4) {
2682 unsigned Reg32 =
TRI->getSubReg(
Reg, AArch64::sub_32);
2711 if (GuardWidth == 4) {
2712 unsigned Reg32 =
TRI->getSubReg(
Reg, AArch64::sub_32);
2729 if (GuardWidth == 4) {
2730 unsigned Reg32 =
TRI->getSubReg(
Reg, AArch64::sub_32);
2748 if (Subtarget.getTargetTriple().isOSMSVCRT())
2761 switch (
MI.getOpcode()) {
2764 case AArch64::MOVZWi:
2765 case AArch64::MOVZXi:
2766 if (
MI.getOperand(1).isImm() &&
MI.getOperand(1).getImm() == 0) {
2767 assert(
MI.getDesc().getNumOperands() == 3 &&
2768 MI.getOperand(2).getImm() == 0 &&
"invalid MOVZi operands");
2772 case AArch64::ANDWri:
2773 return MI.getOperand(1).getReg() == AArch64::WZR;
2774 case AArch64::ANDXri:
2775 return MI.getOperand(1).getReg() == AArch64::XZR;
2776 case TargetOpcode::COPY:
2777 return MI.getOperand(1).getReg() == AArch64::WZR;
2785 switch (
MI.getOpcode()) {
2788 case TargetOpcode::COPY: {
2791 return (AArch64::GPR32RegClass.
contains(DstReg) ||
2792 AArch64::GPR64RegClass.
contains(DstReg));
2794 case AArch64::ORRXrs:
2795 if (
MI.getOperand(1).getReg() == AArch64::XZR) {
2796 assert(
MI.getDesc().getNumOperands() == 4 &&
2797 MI.getOperand(3).getImm() == 0 &&
"invalid ORRrs operands");
2801 case AArch64::ADDXri:
2802 if (
MI.getOperand(2).getImm() == 0) {
2803 assert(
MI.getDesc().getNumOperands() == 4 &&
2804 MI.getOperand(3).getImm() == 0 &&
"invalid ADDXri operands");
2815 switch (
MI.getOpcode()) {
2818 case TargetOpcode::COPY: {
2820 return AArch64::FPR128RegClass.contains(DstReg);
2822 case AArch64::ORRv16i8:
2823 if (
MI.getOperand(1).getReg() ==
MI.getOperand(2).getReg()) {
2824 assert(
MI.getDesc().getNumOperands() == 3 &&
MI.getOperand(0).isReg() &&
2825 "invalid ORRv16i8 operands");
2837 case AArch64::LDRWui:
2838 case AArch64::LDRXui:
2839 case AArch64::LDRBui:
2840 case AArch64::LDRHui:
2841 case AArch64::LDRSui:
2842 case AArch64::LDRDui:
2843 case AArch64::LDRQui:
2844 case AArch64::LDR_PXI:
2850 int &FrameIndex)
const {
2854 if (
MI.getOperand(0).getSubReg() == 0 &&
MI.getOperand(1).isFI() &&
2855 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0) {
2856 FrameIndex =
MI.getOperand(1).getIndex();
2857 return MI.getOperand(0).getReg();
2866 case AArch64::STRWui:
2867 case AArch64::STRXui:
2868 case AArch64::STRBui:
2869 case AArch64::STRHui:
2870 case AArch64::STRSui:
2871 case AArch64::STRDui:
2872 case AArch64::STRQui:
2873 case AArch64::STR_PXI:
2879 int &FrameIndex)
const {
2883 if (
MI.getOperand(0).getSubReg() == 0 &&
MI.getOperand(1).isFI() &&
2884 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0) {
2885 FrameIndex =
MI.getOperand(1).getIndex();
2886 return MI.getOperand(0).getReg();
2892 int &FrameIndex)
const {
2907 return MI.getOperand(0).getReg();
2913 int &FrameIndex)
const {
2928 return MI.getOperand(0).getReg();
2936 return MMO->getFlags() & MOSuppressPair;
2942 if (
MI.memoperands_empty())
2950 return MMO->getFlags() & MOStridedAccess;
2958 case AArch64::STURSi:
2959 case AArch64::STRSpre:
2960 case AArch64::STURDi:
2961 case AArch64::STRDpre:
2962 case AArch64::STURQi:
2963 case AArch64::STRQpre:
2964 case AArch64::STURBBi:
2965 case AArch64::STURHHi:
2966 case AArch64::STURWi:
2967 case AArch64::STRWpre:
2968 case AArch64::STURXi:
2969 case AArch64::STRXpre:
2970 case AArch64::LDURSi:
2971 case AArch64::LDRSpre:
2972 case AArch64::LDURDi:
2973 case AArch64::LDRDpre:
2974 case AArch64::LDURQi:
2975 case AArch64::LDRQpre:
2976 case AArch64::LDURWi:
2977 case AArch64::LDRWpre:
2978 case AArch64::LDURXi:
2979 case AArch64::LDRXpre:
2980 case AArch64::LDRSWpre:
2981 case AArch64::LDURSWi:
2982 case AArch64::LDURHHi:
2983 case AArch64::LDURBBi:
2984 case AArch64::LDURSBWi:
2985 case AArch64::LDURSHWi:
2993 case AArch64::PRFMui:
return AArch64::PRFUMi;
2994 case AArch64::LDRXui:
return AArch64::LDURXi;
2995 case AArch64::LDRWui:
return AArch64::LDURWi;
2996 case AArch64::LDRBui:
return AArch64::LDURBi;
2997 case AArch64::LDRHui:
return AArch64::LDURHi;
2998 case AArch64::LDRSui:
return AArch64::LDURSi;
2999 case AArch64::LDRDui:
return AArch64::LDURDi;
3000 case AArch64::LDRQui:
return AArch64::LDURQi;
3001 case AArch64::LDRBBui:
return AArch64::LDURBBi;
3002 case AArch64::LDRHHui:
return AArch64::LDURHHi;
3003 case AArch64::LDRSBXui:
return AArch64::LDURSBXi;
3004 case AArch64::LDRSBWui:
return AArch64::LDURSBWi;
3005 case AArch64::LDRSHXui:
return AArch64::LDURSHXi;
3006 case AArch64::LDRSHWui:
return AArch64::LDURSHWi;
3007 case AArch64::LDRSWui:
return AArch64::LDURSWi;
3008 case AArch64::STRXui:
return AArch64::STURXi;
3009 case AArch64::STRWui:
return AArch64::STURWi;
3010 case AArch64::STRBui:
return AArch64::STURBi;
3011 case AArch64::STRHui:
return AArch64::STURHi;
3012 case AArch64::STRSui:
return AArch64::STURSi;
3013 case AArch64::STRDui:
return AArch64::STURDi;
3014 case AArch64::STRQui:
return AArch64::STURQi;
3015 case AArch64::STRBBui:
return AArch64::STURBBi;
3016 case AArch64::STRHHui:
return AArch64::STURHHi;
3025 case AArch64::LDAPURBi:
3026 case AArch64::LDAPURHi:
3027 case AArch64::LDAPURi:
3028 case AArch64::LDAPURSBWi:
3029 case AArch64::LDAPURSBXi:
3030 case AArch64::LDAPURSHWi:
3031 case AArch64::LDAPURSHXi:
3032 case AArch64::LDAPURSWi:
3033 case AArch64::LDAPURXi:
3034 case AArch64::LDR_PPXI:
3035 case AArch64::LDR_PXI:
3036 case AArch64::LDR_ZXI:
3037 case AArch64::LDR_ZZXI:
3038 case AArch64::LDR_ZZXI_STRIDED_CONTIGUOUS:
3039 case AArch64::LDR_ZZZXI:
3040 case AArch64::LDR_ZZZZXI:
3041 case AArch64::LDR_ZZZZXI_STRIDED_CONTIGUOUS:
3042 case AArch64::LDRBBui:
3043 case AArch64::LDRBui:
3044 case AArch64::LDRDui:
3045 case AArch64::LDRHHui:
3046 case AArch64::LDRHui:
3047 case AArch64::LDRQui:
3048 case AArch64::LDRSBWui:
3049 case AArch64::LDRSBXui:
3050 case AArch64::LDRSHWui:
3051 case AArch64::LDRSHXui:
3052 case AArch64::LDRSui:
3053 case AArch64::LDRSWui:
3054 case AArch64::LDRWui:
3055 case AArch64::LDRXui:
3056 case AArch64::LDURBBi:
3057 case AArch64::LDURBi:
3058 case AArch64::LDURDi:
3059 case AArch64::LDURHHi:
3060 case AArch64::LDURHi:
3061 case AArch64::LDURQi:
3062 case AArch64::LDURSBWi:
3063 case AArch64::LDURSBXi:
3064 case AArch64::LDURSHWi:
3065 case AArch64::LDURSHXi:
3066 case AArch64::LDURSi:
3067 case AArch64::LDURSWi:
3068 case AArch64::LDURWi:
3069 case AArch64::LDURXi:
3070 case AArch64::PRFMui:
3071 case AArch64::PRFUMi:
3072 case AArch64::ST2Gi:
3074 case AArch64::STLURBi:
3075 case AArch64::STLURHi:
3076 case AArch64::STLURWi:
3077 case AArch64::STLURXi:
3078 case AArch64::StoreSwiftAsyncContext:
3079 case AArch64::STR_PPXI:
3080 case AArch64::STR_PXI:
3081 case AArch64::STR_ZXI:
3082 case AArch64::STR_ZZXI:
3083 case AArch64::STR_ZZXI_STRIDED_CONTIGUOUS:
3084 case AArch64::STR_ZZZXI:
3085 case AArch64::STR_ZZZZXI:
3086 case AArch64::STR_ZZZZXI_STRIDED_CONTIGUOUS:
3087 case AArch64::STRBBui:
3088 case AArch64::STRBui:
3089 case AArch64::STRDui:
3090 case AArch64::STRHHui:
3091 case AArch64::STRHui:
3092 case AArch64::STRQui:
3093 case AArch64::STRSui:
3094 case AArch64::STRWui:
3095 case AArch64::STRXui:
3096 case AArch64::STURBBi:
3097 case AArch64::STURBi:
3098 case AArch64::STURDi:
3099 case AArch64::STURHHi:
3100 case AArch64::STURHi:
3101 case AArch64::STURQi:
3102 case AArch64::STURSi:
3103 case AArch64::STURWi:
3104 case AArch64::STURXi:
3105 case AArch64::STZ2Gi:
3106 case AArch64::STZGi:
3107 case AArch64::TAGPstack:
3109 case AArch64::LD1B_D_IMM:
3110 case AArch64::LD1B_H_IMM:
3111 case AArch64::LD1B_IMM:
3112 case AArch64::LD1B_S_IMM:
3113 case AArch64::LD1D_IMM:
3114 case AArch64::LD1H_D_IMM:
3115 case AArch64::LD1H_IMM:
3116 case AArch64::LD1H_S_IMM:
3117 case AArch64::LD1RB_D_IMM:
3118 case AArch64::LD1RB_H_IMM:
3119 case AArch64::LD1RB_IMM:
3120 case AArch64::LD1RB_S_IMM:
3121 case AArch64::LD1RD_IMM:
3122 case AArch64::LD1RH_D_IMM:
3123 case AArch64::LD1RH_IMM:
3124 case AArch64::LD1RH_S_IMM:
3125 case AArch64::LD1RSB_D_IMM:
3126 case AArch64::LD1RSB_H_IMM:
3127 case AArch64::LD1RSB_S_IMM:
3128 case AArch64::LD1RSH_D_IMM:
3129 case AArch64::LD1RSH_S_IMM:
3130 case AArch64::LD1RSW_IMM:
3131 case AArch64::LD1RW_D_IMM:
3132 case AArch64::LD1RW_IMM:
3133 case AArch64::LD1SB_D_IMM:
3134 case AArch64::LD1SB_H_IMM:
3135 case AArch64::LD1SB_S_IMM:
3136 case AArch64::LD1SH_D_IMM:
3137 case AArch64::LD1SH_S_IMM:
3138 case AArch64::LD1SW_D_IMM:
3139 case AArch64::LD1W_D_IMM:
3140 case AArch64::LD1W_IMM:
3141 case AArch64::LD2B_IMM:
3142 case AArch64::LD2D_IMM:
3143 case AArch64::LD2H_IMM:
3144 case AArch64::LD2W_IMM:
3145 case AArch64::LD3B_IMM:
3146 case AArch64::LD3D_IMM:
3147 case AArch64::LD3H_IMM:
3148 case AArch64::LD3W_IMM:
3149 case AArch64::LD4B_IMM:
3150 case AArch64::LD4D_IMM:
3151 case AArch64::LD4H_IMM:
3152 case AArch64::LD4W_IMM:
3154 case AArch64::LDNF1B_D_IMM:
3155 case AArch64::LDNF1B_H_IMM:
3156 case AArch64::LDNF1B_IMM:
3157 case AArch64::LDNF1B_S_IMM:
3158 case AArch64::LDNF1D_IMM:
3159 case AArch64::LDNF1H_D_IMM:
3160 case AArch64::LDNF1H_IMM:
3161 case AArch64::LDNF1H_S_IMM:
3162 case AArch64::LDNF1SB_D_IMM:
3163 case AArch64::LDNF1SB_H_IMM:
3164 case AArch64::LDNF1SB_S_IMM:
3165 case AArch64::LDNF1SH_D_IMM:
3166 case AArch64::LDNF1SH_S_IMM:
3167 case AArch64::LDNF1SW_D_IMM:
3168 case AArch64::LDNF1W_D_IMM:
3169 case AArch64::LDNF1W_IMM:
3170 case AArch64::LDNPDi:
3171 case AArch64::LDNPQi:
3172 case AArch64::LDNPSi:
3173 case AArch64::LDNPWi:
3174 case AArch64::LDNPXi:
3175 case AArch64::LDNT1B_ZRI:
3176 case AArch64::LDNT1D_ZRI:
3177 case AArch64::LDNT1H_ZRI:
3178 case AArch64::LDNT1W_ZRI:
3179 case AArch64::LDPDi:
3180 case AArch64::LDPQi:
3181 case AArch64::LDPSi:
3182 case AArch64::LDPWi:
3183 case AArch64::LDPXi:
3184 case AArch64::LDRBBpost:
3185 case AArch64::LDRBBpre:
3186 case AArch64::LDRBpost:
3187 case AArch64::LDRBpre:
3188 case AArch64::LDRDpost:
3189 case AArch64::LDRDpre:
3190 case AArch64::LDRHHpost:
3191 case AArch64::LDRHHpre:
3192 case AArch64::LDRHpost:
3193 case AArch64::LDRHpre:
3194 case AArch64::LDRQpost:
3195 case AArch64::LDRQpre:
3196 case AArch64::LDRSpost:
3197 case AArch64::LDRSpre:
3198 case AArch64::LDRWpost:
3199 case AArch64::LDRWpre:
3200 case AArch64::LDRXpost:
3201 case AArch64::LDRXpre:
3202 case AArch64::ST1B_D_IMM:
3203 case AArch64::ST1B_H_IMM:
3204 case AArch64::ST1B_IMM:
3205 case AArch64::ST1B_S_IMM:
3206 case AArch64::ST1D_IMM:
3207 case AArch64::ST1H_D_IMM:
3208 case AArch64::ST1H_IMM:
3209 case AArch64::ST1H_S_IMM:
3210 case AArch64::ST1W_D_IMM:
3211 case AArch64::ST1W_IMM:
3212 case AArch64::ST2B_IMM:
3213 case AArch64::ST2D_IMM:
3214 case AArch64::ST2H_IMM:
3215 case AArch64::ST2W_IMM:
3216 case AArch64::ST3B_IMM:
3217 case AArch64::ST3D_IMM:
3218 case AArch64::ST3H_IMM:
3219 case AArch64::ST3W_IMM:
3220 case AArch64::ST4B_IMM:
3221 case AArch64::ST4D_IMM:
3222 case AArch64::ST4H_IMM:
3223 case AArch64::ST4W_IMM:
3224 case AArch64::STGPi:
3225 case AArch64::STGPreIndex:
3226 case AArch64::STZGPreIndex:
3227 case AArch64::ST2GPreIndex:
3228 case AArch64::STZ2GPreIndex:
3229 case AArch64::STGPostIndex:
3230 case AArch64::STZGPostIndex:
3231 case AArch64::ST2GPostIndex:
3232 case AArch64::STZ2GPostIndex:
3233 case AArch64::STNPDi:
3234 case AArch64::STNPQi:
3235 case AArch64::STNPSi:
3236 case AArch64::STNPWi:
3237 case AArch64::STNPXi:
3238 case AArch64::STNT1B_ZRI:
3239 case AArch64::STNT1D_ZRI:
3240 case AArch64::STNT1H_ZRI:
3241 case AArch64::STNT1W_ZRI:
3242 case AArch64::STPDi:
3243 case AArch64::STPQi:
3244 case AArch64::STPSi:
3245 case AArch64::STPWi:
3246 case AArch64::STPXi:
3247 case AArch64::STRBBpost:
3248 case AArch64::STRBBpre:
3249 case AArch64::STRBpost:
3250 case AArch64::STRBpre:
3251 case AArch64::STRDpost:
3252 case AArch64::STRDpre:
3253 case AArch64::STRHHpost:
3254 case AArch64::STRHHpre:
3255 case AArch64::STRHpost:
3256 case AArch64::STRHpre:
3257 case AArch64::STRQpost:
3258 case AArch64::STRQpre:
3259 case AArch64::STRSpost:
3260 case AArch64::STRSpre:
3261 case AArch64::STRWpost:
3262 case AArch64::STRWpre:
3263 case AArch64::STRXpost:
3264 case AArch64::STRXpre:
3265 case AArch64::LD1B_2Z_IMM:
3266 case AArch64::LD1B_2Z_STRIDED_IMM:
3267 case AArch64::LD1H_2Z_IMM:
3268 case AArch64::LD1H_2Z_STRIDED_IMM:
3269 case AArch64::LD1W_2Z_IMM:
3270 case AArch64::LD1W_2Z_STRIDED_IMM:
3271 case AArch64::LD1D_2Z_IMM:
3272 case AArch64::LD1D_2Z_STRIDED_IMM:
3273 case AArch64::LD1B_4Z_IMM:
3274 case AArch64::LD1B_4Z_STRIDED_IMM:
3275 case AArch64::LD1H_4Z_IMM:
3276 case AArch64::LD1H_4Z_STRIDED_IMM:
3277 case AArch64::LD1W_4Z_IMM:
3278 case AArch64::LD1W_4Z_STRIDED_IMM:
3279 case AArch64::LD1D_4Z_IMM:
3280 case AArch64::LD1D_4Z_STRIDED_IMM:
3281 case AArch64::LD1B_2Z_IMM_PSEUDO:
3282 case AArch64::LD1H_2Z_IMM_PSEUDO:
3283 case AArch64::LD1W_2Z_IMM_PSEUDO:
3284 case AArch64::LD1D_2Z_IMM_PSEUDO:
3285 case AArch64::LD1B_4Z_IMM_PSEUDO:
3286 case AArch64::LD1H_4Z_IMM_PSEUDO:
3287 case AArch64::LD1W_4Z_IMM_PSEUDO:
3288 case AArch64::LD1D_4Z_IMM_PSEUDO:
3289 case AArch64::ST1B_2Z_IMM:
3290 case AArch64::ST1B_2Z_STRIDED_IMM:
3291 case AArch64::ST1H_2Z_IMM:
3292 case AArch64::ST1H_2Z_STRIDED_IMM:
3293 case AArch64::ST1W_2Z_IMM:
3294 case AArch64::ST1W_2Z_STRIDED_IMM:
3295 case AArch64::ST1D_2Z_IMM:
3296 case AArch64::ST1D_2Z_STRIDED_IMM:
3297 case AArch64::LDNT1B_2Z_IMM_PSEUDO:
3298 case AArch64::LDNT1B_2Z_IMM:
3299 case AArch64::LDNT1B_2Z_STRIDED_IMM:
3300 case AArch64::LDNT1H_2Z_IMM_PSEUDO:
3301 case AArch64::LDNT1H_2Z_IMM:
3302 case AArch64::LDNT1H_2Z_STRIDED_IMM:
3303 case AArch64::LDNT1W_2Z_IMM_PSEUDO:
3304 case AArch64::LDNT1W_2Z_IMM:
3305 case AArch64::LDNT1W_2Z_STRIDED_IMM:
3306 case AArch64::LDNT1D_2Z_IMM_PSEUDO:
3307 case AArch64::LDNT1D_2Z_IMM:
3308 case AArch64::LDNT1D_2Z_STRIDED_IMM:
3309 case AArch64::STNT1B_2Z_IMM:
3310 case AArch64::STNT1B_2Z_STRIDED_IMM:
3311 case AArch64::STNT1H_2Z_IMM:
3312 case AArch64::STNT1H_2Z_STRIDED_IMM:
3313 case AArch64::STNT1W_2Z_IMM:
3314 case AArch64::STNT1W_2Z_STRIDED_IMM:
3315 case AArch64::STNT1D_2Z_IMM:
3316 case AArch64::STNT1D_2Z_STRIDED_IMM:
3317 case AArch64::ST1B_2Z_IMM_PSEUDO:
3318 case AArch64::ST1H_2Z_IMM_PSEUDO:
3319 case AArch64::ST1W_2Z_IMM_PSEUDO:
3320 case AArch64::ST1D_2Z_IMM_PSEUDO:
3321 case AArch64::STNT1B_2Z_IMM_PSEUDO:
3322 case AArch64::STNT1H_2Z_IMM_PSEUDO:
3323 case AArch64::STNT1W_2Z_IMM_PSEUDO:
3324 case AArch64::STNT1D_2Z_IMM_PSEUDO:
3325 case AArch64::ST1B_4Z_IMM:
3326 case AArch64::ST1B_4Z_STRIDED_IMM:
3327 case AArch64::ST1H_4Z_IMM:
3328 case AArch64::ST1H_4Z_STRIDED_IMM:
3329 case AArch64::ST1W_4Z_IMM:
3330 case AArch64::ST1W_4Z_STRIDED_IMM:
3331 case AArch64::ST1D_4Z_IMM:
3332 case AArch64::ST1D_4Z_STRIDED_IMM:
3333 case AArch64::LDNT1B_4Z_IMM_PSEUDO:
3334 case AArch64::LDNT1B_4Z_IMM:
3335 case AArch64::LDNT1B_4Z_STRIDED_IMM:
3336 case AArch64::LDNT1H_4Z_IMM_PSEUDO:
3337 case AArch64::LDNT1H_4Z_IMM:
3338 case AArch64::LDNT1H_4Z_STRIDED_IMM:
3339 case AArch64::LDNT1W_4Z_IMM_PSEUDO:
3340 case AArch64::LDNT1W_4Z_IMM:
3341 case AArch64::LDNT1W_4Z_STRIDED_IMM:
3342 case AArch64::LDNT1D_4Z_IMM_PSEUDO:
3343 case AArch64::LDNT1D_4Z_IMM:
3344 case AArch64::LDNT1D_4Z_STRIDED_IMM:
3345 case AArch64::STNT1B_4Z_IMM:
3346 case AArch64::STNT1B_4Z_STRIDED_IMM:
3347 case AArch64::STNT1H_4Z_IMM:
3348 case AArch64::STNT1H_4Z_STRIDED_IMM:
3349 case AArch64::STNT1W_4Z_IMM:
3350 case AArch64::STNT1W_4Z_STRIDED_IMM:
3351 case AArch64::STNT1D_4Z_IMM:
3352 case AArch64::STNT1D_4Z_STRIDED_IMM:
3353 case AArch64::ST1B_4Z_IMM_PSEUDO:
3354 case AArch64::ST1H_4Z_IMM_PSEUDO:
3355 case AArch64::ST1W_4Z_IMM_PSEUDO:
3356 case AArch64::ST1D_4Z_IMM_PSEUDO:
3357 case AArch64::STNT1B_4Z_IMM_PSEUDO:
3358 case AArch64::STNT1H_4Z_IMM_PSEUDO:
3359 case AArch64::STNT1W_4Z_IMM_PSEUDO:
3360 case AArch64::STNT1D_4Z_IMM_PSEUDO:
3362 case AArch64::LDPDpost:
3363 case AArch64::LDPDpre:
3364 case AArch64::LDPQpost:
3365 case AArch64::LDPQpre:
3366 case AArch64::LDPSpost:
3367 case AArch64::LDPSpre:
3368 case AArch64::LDPWpost:
3369 case AArch64::LDPWpre:
3370 case AArch64::LDPXpost:
3371 case AArch64::LDPXpre:
3372 case AArch64::STGPpre:
3373 case AArch64::STGPpost:
3374 case AArch64::STPDpost:
3375 case AArch64::STPDpre:
3376 case AArch64::STPQpost:
3377 case AArch64::STPQpre:
3378 case AArch64::STPSpost:
3379 case AArch64::STPSpre:
3380 case AArch64::STPWpost:
3381 case AArch64::STPWpre:
3382 case AArch64::STPXpost:
3383 case AArch64::STPXpre:
3389 switch (
MI.getOpcode()) {
3393 case AArch64::STRSui:
3394 case AArch64::STRDui:
3395 case AArch64::STRQui:
3396 case AArch64::STRXui:
3397 case AArch64::STRWui:
3398 case AArch64::LDRSui:
3399 case AArch64::LDRDui:
3400 case AArch64::LDRQui:
3401 case AArch64::LDRXui:
3402 case AArch64::LDRWui:
3403 case AArch64::LDRSWui:
3405 case AArch64::STURSi:
3406 case AArch64::STRSpre:
3407 case AArch64::STURDi:
3408 case AArch64::STRDpre:
3409 case AArch64::STURQi:
3410 case AArch64::STRQpre:
3411 case AArch64::STURWi:
3412 case AArch64::STRWpre:
3413 case AArch64::STURXi:
3414 case AArch64::STRXpre:
3415 case AArch64::LDURSi:
3416 case AArch64::LDRSpre:
3417 case AArch64::LDURDi:
3418 case AArch64::LDRDpre:
3419 case AArch64::LDURQi:
3420 case AArch64::LDRQpre:
3421 case AArch64::LDURWi:
3422 case AArch64::LDRWpre:
3423 case AArch64::LDURXi:
3424 case AArch64::LDRXpre:
3425 case AArch64::LDURSWi:
3426 case AArch64::LDRSWpre:
3428 case AArch64::LDR_ZXI:
3429 case AArch64::STR_ZXI:
3435 switch (
MI.getOpcode()) {
3438 "Unexpected instruction - was a new tail call opcode introduced?");
3440 case AArch64::TCRETURNdi:
3441 case AArch64::TCRETURNri:
3442 case AArch64::TCRETURNrix16x17:
3443 case AArch64::TCRETURNrix17:
3444 case AArch64::TCRETURNrinotx16:
3445 case AArch64::TCRETURNriALL:
3446 case AArch64::AUTH_TCRETURN:
3447 case AArch64::AUTH_TCRETURN_BTI:
3457 case AArch64::ADDWri:
3458 return AArch64::ADDSWri;
3459 case AArch64::ADDWrr:
3460 return AArch64::ADDSWrr;
3461 case AArch64::ADDWrs:
3462 return AArch64::ADDSWrs;
3463 case AArch64::ADDWrx:
3464 return AArch64::ADDSWrx;
3465 case AArch64::ANDWri:
3466 return AArch64::ANDSWri;
3467 case AArch64::ANDWrr:
3468 return AArch64::ANDSWrr;
3469 case AArch64::ANDWrs:
3470 return AArch64::ANDSWrs;
3471 case AArch64::BICWrr:
3472 return AArch64::BICSWrr;
3473 case AArch64::BICWrs:
3474 return AArch64::BICSWrs;
3475 case AArch64::SUBWri:
3476 return AArch64::SUBSWri;
3477 case AArch64::SUBWrr:
3478 return AArch64::SUBSWrr;
3479 case AArch64::SUBWrs:
3480 return AArch64::SUBSWrs;
3481 case AArch64::SUBWrx:
3482 return AArch64::SUBSWrx;
3484 case AArch64::ADDXri:
3485 return AArch64::ADDSXri;
3486 case AArch64::ADDXrr:
3487 return AArch64::ADDSXrr;
3488 case AArch64::ADDXrs:
3489 return AArch64::ADDSXrs;
3490 case AArch64::ADDXrx:
3491 return AArch64::ADDSXrx;
3492 case AArch64::ANDXri:
3493 return AArch64::ANDSXri;
3494 case AArch64::ANDXrr:
3495 return AArch64::ANDSXrr;
3496 case AArch64::ANDXrs:
3497 return AArch64::ANDSXrs;
3498 case AArch64::BICXrr:
3499 return AArch64::BICSXrr;
3500 case AArch64::BICXrs:
3501 return AArch64::BICSXrs;
3502 case AArch64::SUBXri:
3503 return AArch64::SUBSXri;
3504 case AArch64::SUBXrr:
3505 return AArch64::SUBSXrr;
3506 case AArch64::SUBXrs:
3507 return AArch64::SUBSXrs;
3508 case AArch64::SUBXrx:
3509 return AArch64::SUBSXrx;
3511 case AArch64::AND_PPzPP:
3512 return AArch64::ANDS_PPzPP;
3513 case AArch64::BIC_PPzPP:
3514 return AArch64::BICS_PPzPP;
3515 case AArch64::EOR_PPzPP:
3516 return AArch64::EORS_PPzPP;
3517 case AArch64::NAND_PPzPP:
3518 return AArch64::NANDS_PPzPP;
3519 case AArch64::NOR_PPzPP:
3520 return AArch64::NORS_PPzPP;
3521 case AArch64::ORN_PPzPP:
3522 return AArch64::ORNS_PPzPP;
3523 case AArch64::ORR_PPzPP:
3524 return AArch64::ORRS_PPzPP;
3525 case AArch64::BRKA_PPzP:
3526 return AArch64::BRKAS_PPzP;
3527 case AArch64::BRKPA_PPzPP:
3528 return AArch64::BRKPAS_PPzPP;
3529 case AArch64::BRKB_PPzP:
3530 return AArch64::BRKBS_PPzP;
3531 case AArch64::BRKPB_PPzPP:
3532 return AArch64::BRKPBS_PPzPP;
3533 case AArch64::BRKN_PPzP:
3534 return AArch64::BRKNS_PPzP;
3535 case AArch64::RDFFR_PPz:
3536 return AArch64::RDFFRS_PPz;
3537 case AArch64::PTRUE_B:
3538 return AArch64::PTRUES_B;
3549 if (
MI.hasOrderedMemoryRef())
3554 assert((
MI.getOperand(IsPreLdSt ? 2 : 1).isReg() ||
3555 MI.getOperand(IsPreLdSt ? 2 : 1).isFI()) &&
3556 "Expected a reg or frame index operand.");
3560 bool IsImmPreLdSt = IsPreLdSt &&
MI.getOperand(3).isImm();
3562 if (!
MI.getOperand(2).isImm() && !IsImmPreLdSt)
3575 if (
MI.getOperand(1).isReg() && !IsPreLdSt) {
3576 Register BaseReg =
MI.getOperand(1).getReg();
3578 if (
MI.modifiesRegister(BaseReg,
TRI))
3584 switch (
MI.getOpcode()) {
3587 case AArch64::LDR_ZXI:
3588 case AArch64::STR_ZXI:
3589 if (!Subtarget.isLittleEndian() ||
3590 Subtarget.getSVEVectorSizeInBits() != 128)
3603 const MCAsmInfo &MAI =
MI.getMF()->getTarget().getMCAsmInfo();
3611 if (Subtarget.isPaired128Slow()) {
3612 switch (
MI.getOpcode()) {
3615 case AArch64::LDURQi:
3616 case AArch64::STURQi:
3617 case AArch64::LDRQui:
3618 case AArch64::STRQui:
3645std::optional<ExtAddrMode>
3650 bool OffsetIsScalable;
3651 if (!getMemOperandWithOffset(MemI,
Base,
Offset, OffsetIsScalable,
TRI))
3652 return std::nullopt;
3655 return std::nullopt;
3670 int64_t OffsetScale = 1;
3675 case AArch64::LDURQi:
3676 case AArch64::STURQi:
3680 case AArch64::LDURDi:
3681 case AArch64::STURDi:
3682 case AArch64::LDURXi:
3683 case AArch64::STURXi:
3687 case AArch64::LDURWi:
3688 case AArch64::LDURSWi:
3689 case AArch64::STURWi:
3693 case AArch64::LDURHi:
3694 case AArch64::STURHi:
3695 case AArch64::LDURHHi:
3696 case AArch64::STURHHi:
3697 case AArch64::LDURSHXi:
3698 case AArch64::LDURSHWi:
3702 case AArch64::LDRBroX:
3703 case AArch64::LDRBBroX:
3704 case AArch64::LDRSBXroX:
3705 case AArch64::LDRSBWroX:
3706 case AArch64::STRBroX:
3707 case AArch64::STRBBroX:
3708 case AArch64::LDURBi:
3709 case AArch64::LDURBBi:
3710 case AArch64::LDURSBXi:
3711 case AArch64::LDURSBWi:
3712 case AArch64::STURBi:
3713 case AArch64::STURBBi:
3714 case AArch64::LDRBui:
3715 case AArch64::LDRBBui:
3716 case AArch64::LDRSBXui:
3717 case AArch64::LDRSBWui:
3718 case AArch64::STRBui:
3719 case AArch64::STRBBui:
3723 case AArch64::LDRQroX:
3724 case AArch64::STRQroX:
3725 case AArch64::LDRQui:
3726 case AArch64::STRQui:
3731 case AArch64::LDRDroX:
3732 case AArch64::STRDroX:
3733 case AArch64::LDRXroX:
3734 case AArch64::STRXroX:
3735 case AArch64::LDRDui:
3736 case AArch64::STRDui:
3737 case AArch64::LDRXui:
3738 case AArch64::STRXui:
3743 case AArch64::LDRWroX:
3744 case AArch64::LDRSWroX:
3745 case AArch64::STRWroX:
3746 case AArch64::LDRWui:
3747 case AArch64::LDRSWui:
3748 case AArch64::STRWui:
3753 case AArch64::LDRHroX:
3754 case AArch64::STRHroX:
3755 case AArch64::LDRHHroX:
3756 case AArch64::STRHHroX:
3757 case AArch64::LDRSHXroX:
3758 case AArch64::LDRSHWroX:
3759 case AArch64::LDRHui:
3760 case AArch64::STRHui:
3761 case AArch64::LDRHHui:
3762 case AArch64::STRHHui:
3763 case AArch64::LDRSHXui:
3764 case AArch64::LDRSHWui:
3772 if (BaseRegOp.
isReg() && BaseRegOp.
getReg() == Reg)
3796 case AArch64::SBFMXri:
3809 AM.
Scale = OffsetScale;
3814 case TargetOpcode::SUBREG_TO_REG: {
3830 if (
DefMI.getOpcode() != AArch64::ORRWrs ||
3831 DefMI.getOperand(1).getReg() != AArch64::WZR ||
3832 DefMI.getOperand(3).getImm() != 0)
3839 AM.
Scale = OffsetScale;
3850 auto validateOffsetForLDP = [](
unsigned NumBytes, int64_t OldOffset,
3851 int64_t NewOffset) ->
bool {
3852 int64_t MinOffset, MaxOffset;
3869 return OldOffset < MinOffset || OldOffset > MaxOffset ||
3870 (NewOffset >= MinOffset && NewOffset <= MaxOffset);
3872 auto canFoldAddSubImmIntoAddrMode = [&](int64_t Disp) ->
bool {
3874 int64_t NewOffset = OldOffset + Disp;
3875 if (!isLegalAddressingMode(NumBytes, NewOffset, 0))
3879 if (!validateOffsetForLDP(NumBytes, OldOffset, NewOffset))
3889 auto canFoldAddRegIntoAddrMode =
3894 if ((
unsigned)Scale != Scale)
3896 if (!isLegalAddressingMode(NumBytes, 0, Scale))
3908 return (Opcode == AArch64::STURQi || Opcode == AArch64::STRQui) &&
3909 Subtarget.isSTRQroSlow();
3918 case AArch64::ADDXri:
3924 return canFoldAddSubImmIntoAddrMode(Disp);
3926 case AArch64::SUBXri:
3932 return canFoldAddSubImmIntoAddrMode(-Disp);
3934 case AArch64::ADDXrs: {
3947 if (Shift != 2 && Shift != 3 && Subtarget.hasAddrLSLSlow14())
3949 if (avoidSlowSTRQ(MemI))
3952 return canFoldAddRegIntoAddrMode(1ULL << Shift);
3955 case AArch64::ADDXrr:
3963 if (!OptSize && avoidSlowSTRQ(MemI))
3965 return canFoldAddRegIntoAddrMode(1);
3967 case AArch64::ADDXrx:
3975 if (!OptSize && avoidSlowSTRQ(MemI))
3984 return canFoldAddRegIntoAddrMode(
3999 case AArch64::LDURQi:
4000 case AArch64::LDRQui:
4001 return AArch64::LDRQroX;
4002 case AArch64::STURQi:
4003 case AArch64::STRQui:
4004 return AArch64::STRQroX;
4005 case AArch64::LDURDi:
4006 case AArch64::LDRDui:
4007 return AArch64::LDRDroX;
4008 case AArch64::STURDi:
4009 case AArch64::STRDui:
4010 return AArch64::STRDroX;
4011 case AArch64::LDURXi:
4012 case AArch64::LDRXui:
4013 return AArch64::LDRXroX;
4014 case AArch64::STURXi:
4015 case AArch64::STRXui:
4016 return AArch64::STRXroX;
4017 case AArch64::LDURWi:
4018 case AArch64::LDRWui:
4019 return AArch64::LDRWroX;
4020 case AArch64::LDURSWi:
4021 case AArch64::LDRSWui:
4022 return AArch64::LDRSWroX;
4023 case AArch64::STURWi:
4024 case AArch64::STRWui:
4025 return AArch64::STRWroX;
4026 case AArch64::LDURHi:
4027 case AArch64::LDRHui:
4028 return AArch64::LDRHroX;
4029 case AArch64::STURHi:
4030 case AArch64::STRHui:
4031 return AArch64::STRHroX;
4032 case AArch64::LDURHHi:
4033 case AArch64::LDRHHui:
4034 return AArch64::LDRHHroX;
4035 case AArch64::STURHHi:
4036 case AArch64::STRHHui:
4037 return AArch64::STRHHroX;
4038 case AArch64::LDURSHXi:
4039 case AArch64::LDRSHXui:
4040 return AArch64::LDRSHXroX;
4041 case AArch64::LDURSHWi:
4042 case AArch64::LDRSHWui:
4043 return AArch64::LDRSHWroX;
4044 case AArch64::LDURBi:
4045 case AArch64::LDRBui:
4046 return AArch64::LDRBroX;
4047 case AArch64::LDURBBi:
4048 case AArch64::LDRBBui:
4049 return AArch64::LDRBBroX;
4050 case AArch64::LDURSBXi:
4051 case AArch64::LDRSBXui:
4052 return AArch64::LDRSBXroX;
4053 case AArch64::LDURSBWi:
4054 case AArch64::LDRSBWui:
4055 return AArch64::LDRSBWroX;
4056 case AArch64::STURBi:
4057 case AArch64::STRBui:
4058 return AArch64::STRBroX;
4059 case AArch64::STURBBi:
4060 case AArch64::STRBBui:
4061 return AArch64::STRBBroX;
4073 case AArch64::LDURQi:
4075 return AArch64::LDRQui;
4076 case AArch64::STURQi:
4078 return AArch64::STRQui;
4079 case AArch64::LDURDi:
4081 return AArch64::LDRDui;
4082 case AArch64::STURDi:
4084 return AArch64::STRDui;
4085 case AArch64::LDURXi:
4087 return AArch64::LDRXui;
4088 case AArch64::STURXi:
4090 return AArch64::STRXui;
4091 case AArch64::LDURWi:
4093 return AArch64::LDRWui;
4094 case AArch64::LDURSWi:
4096 return AArch64::LDRSWui;
4097 case AArch64::STURWi:
4099 return AArch64::STRWui;
4100 case AArch64::LDURHi:
4102 return AArch64::LDRHui;
4103 case AArch64::STURHi:
4105 return AArch64::STRHui;
4106 case AArch64::LDURHHi:
4108 return AArch64::LDRHHui;
4109 case AArch64::STURHHi:
4111 return AArch64::STRHHui;
4112 case AArch64::LDURSHXi:
4114 return AArch64::LDRSHXui;
4115 case AArch64::LDURSHWi:
4117 return AArch64::LDRSHWui;
4118 case AArch64::LDURBi:
4120 return AArch64::LDRBui;
4121 case AArch64::LDURBBi:
4123 return AArch64::LDRBBui;
4124 case AArch64::LDURSBXi:
4126 return AArch64::LDRSBXui;
4127 case AArch64::LDURSBWi:
4129 return AArch64::LDRSBWui;
4130 case AArch64::STURBi:
4132 return AArch64::STRBui;
4133 case AArch64::STURBBi:
4135 return AArch64::STRBBui;
4136 case AArch64::LDRQui:
4137 case AArch64::STRQui:
4140 case AArch64::LDRDui:
4141 case AArch64::STRDui:
4142 case AArch64::LDRXui:
4143 case AArch64::STRXui:
4146 case AArch64::LDRWui:
4147 case AArch64::LDRSWui:
4148 case AArch64::STRWui:
4151 case AArch64::LDRHui:
4152 case AArch64::STRHui:
4153 case AArch64::LDRHHui:
4154 case AArch64::STRHHui:
4155 case AArch64::LDRSHXui:
4156 case AArch64::LDRSHWui:
4159 case AArch64::LDRBui:
4160 case AArch64::LDRBBui:
4161 case AArch64::LDRSBXui:
4162 case AArch64::LDRSBWui:
4163 case AArch64::STRBui:
4164 case AArch64::STRBBui:
4178 case AArch64::LDURQi:
4179 case AArch64::STURQi:
4180 case AArch64::LDURDi:
4181 case AArch64::STURDi:
4182 case AArch64::LDURXi:
4183 case AArch64::STURXi:
4184 case AArch64::LDURWi:
4185 case AArch64::LDURSWi:
4186 case AArch64::STURWi:
4187 case AArch64::LDURHi:
4188 case AArch64::STURHi:
4189 case AArch64::LDURHHi:
4190 case AArch64::STURHHi:
4191 case AArch64::LDURSHXi:
4192 case AArch64::LDURSHWi:
4193 case AArch64::LDURBi:
4194 case AArch64::STURBi:
4195 case AArch64::LDURBBi:
4196 case AArch64::STURBBi:
4197 case AArch64::LDURSBWi:
4198 case AArch64::LDURSBXi:
4200 case AArch64::LDRQui:
4201 return AArch64::LDURQi;
4202 case AArch64::STRQui:
4203 return AArch64::STURQi;
4204 case AArch64::LDRDui:
4205 return AArch64::LDURDi;
4206 case AArch64::STRDui:
4207 return AArch64::STURDi;
4208 case AArch64::LDRXui:
4209 return AArch64::LDURXi;
4210 case AArch64::STRXui:
4211 return AArch64::STURXi;
4212 case AArch64::LDRWui:
4213 return AArch64::LDURWi;
4214 case AArch64::LDRSWui:
4215 return AArch64::LDURSWi;
4216 case AArch64::STRWui:
4217 return AArch64::STURWi;
4218 case AArch64::LDRHui:
4219 return AArch64::LDURHi;
4220 case AArch64::STRHui:
4221 return AArch64::STURHi;
4222 case AArch64::LDRHHui:
4223 return AArch64::LDURHHi;
4224 case AArch64::STRHHui:
4225 return AArch64::STURHHi;
4226 case AArch64::LDRSHXui:
4227 return AArch64::LDURSHXi;
4228 case AArch64::LDRSHWui:
4229 return AArch64::LDURSHWi;
4230 case AArch64::LDRBBui:
4231 return AArch64::LDURBBi;
4232 case AArch64::LDRBui:
4233 return AArch64::LDURBi;
4234 case AArch64::STRBBui:
4235 return AArch64::STURBBi;
4236 case AArch64::STRBui:
4237 return AArch64::STURBi;
4238 case AArch64::LDRSBWui:
4239 return AArch64::LDURSBWi;
4240 case AArch64::LDRSBXui:
4241 return AArch64::LDURSBXi;
4254 case AArch64::LDRQroX:
4255 case AArch64::LDURQi:
4256 case AArch64::LDRQui:
4257 return AArch64::LDRQroW;
4258 case AArch64::STRQroX:
4259 case AArch64::STURQi:
4260 case AArch64::STRQui:
4261 return AArch64::STRQroW;
4262 case AArch64::LDRDroX:
4263 case AArch64::LDURDi:
4264 case AArch64::LDRDui:
4265 return AArch64::LDRDroW;
4266 case AArch64::STRDroX:
4267 case AArch64::STURDi:
4268 case AArch64::STRDui:
4269 return AArch64::STRDroW;
4270 case AArch64::LDRXroX:
4271 case AArch64::LDURXi:
4272 case AArch64::LDRXui:
4273 return AArch64::LDRXroW;
4274 case AArch64::STRXroX:
4275 case AArch64::STURXi:
4276 case AArch64::STRXui:
4277 return AArch64::STRXroW;
4278 case AArch64::LDRWroX:
4279 case AArch64::LDURWi:
4280 case AArch64::LDRWui:
4281 return AArch64::LDRWroW;
4282 case AArch64::LDRSWroX:
4283 case AArch64::LDURSWi:
4284 case AArch64::LDRSWui:
4285 return AArch64::LDRSWroW;
4286 case AArch64::STRWroX:
4287 case AArch64::STURWi:
4288 case AArch64::STRWui:
4289 return AArch64::STRWroW;
4290 case AArch64::LDRHroX:
4291 case AArch64::LDURHi:
4292 case AArch64::LDRHui:
4293 return AArch64::LDRHroW;
4294 case AArch64::STRHroX:
4295 case AArch64::STURHi:
4296 case AArch64::STRHui:
4297 return AArch64::STRHroW;
4298 case AArch64::LDRHHroX:
4299 case AArch64::LDURHHi:
4300 case AArch64::LDRHHui:
4301 return AArch64::LDRHHroW;
4302 case AArch64::STRHHroX:
4303 case AArch64::STURHHi:
4304 case AArch64::STRHHui:
4305 return AArch64::STRHHroW;
4306 case AArch64::LDRSHXroX:
4307 case AArch64::LDURSHXi:
4308 case AArch64::LDRSHXui:
4309 return AArch64::LDRSHXroW;
4310 case AArch64::LDRSHWroX:
4311 case AArch64::LDURSHWi:
4312 case AArch64::LDRSHWui:
4313 return AArch64::LDRSHWroW;
4314 case AArch64::LDRBroX:
4315 case AArch64::LDURBi:
4316 case AArch64::LDRBui:
4317 return AArch64::LDRBroW;
4318 case AArch64::LDRBBroX:
4319 case AArch64::LDURBBi:
4320 case AArch64::LDRBBui:
4321 return AArch64::LDRBBroW;
4322 case AArch64::LDRSBXroX:
4323 case AArch64::LDURSBXi:
4324 case AArch64::LDRSBXui:
4325 return AArch64::LDRSBXroW;
4326 case AArch64::LDRSBWroX:
4327 case AArch64::LDURSBWi:
4328 case AArch64::LDRSBWui:
4329 return AArch64::LDRSBWroW;
4330 case AArch64::STRBroX:
4331 case AArch64::STURBi:
4332 case AArch64::STRBui:
4333 return AArch64::STRBroW;
4334 case AArch64::STRBBroX:
4335 case AArch64::STURBBi:
4336 case AArch64::STRBBui:
4337 return AArch64::STRBBroW;
4362 return B.getInstr();
4366 "Addressing mode not supported for folding");
4383 return B.getInstr();
4390 "Address offset can be a register or an immediate, but not both");
4411 return B.getInstr();
4415 "Function must not be called with an addressing mode it can't handle");
4424 case AArch64::LD1Fourv16b_POST:
4425 case AArch64::LD1Fourv1d_POST:
4426 case AArch64::LD1Fourv2d_POST:
4427 case AArch64::LD1Fourv2s_POST:
4428 case AArch64::LD1Fourv4h_POST:
4429 case AArch64::LD1Fourv4s_POST:
4430 case AArch64::LD1Fourv8b_POST:
4431 case AArch64::LD1Fourv8h_POST:
4432 case AArch64::LD1Onev16b_POST:
4433 case AArch64::LD1Onev1d_POST:
4434 case AArch64::LD1Onev2d_POST:
4435 case AArch64::LD1Onev2s_POST:
4436 case AArch64::LD1Onev4h_POST:
4437 case AArch64::LD1Onev4s_POST:
4438 case AArch64::LD1Onev8b_POST:
4439 case AArch64::LD1Onev8h_POST:
4440 case AArch64::LD1Rv16b_POST:
4441 case AArch64::LD1Rv1d_POST:
4442 case AArch64::LD1Rv2d_POST:
4443 case AArch64::LD1Rv2s_POST:
4444 case AArch64::LD1Rv4h_POST:
4445 case AArch64::LD1Rv4s_POST:
4446 case AArch64::LD1Rv8b_POST:
4447 case AArch64::LD1Rv8h_POST:
4448 case AArch64::LD1Threev16b_POST:
4449 case AArch64::LD1Threev1d_POST:
4450 case AArch64::LD1Threev2d_POST:
4451 case AArch64::LD1Threev2s_POST:
4452 case AArch64::LD1Threev4h_POST:
4453 case AArch64::LD1Threev4s_POST:
4454 case AArch64::LD1Threev8b_POST:
4455 case AArch64::LD1Threev8h_POST:
4456 case AArch64::LD1Twov16b_POST:
4457 case AArch64::LD1Twov1d_POST:
4458 case AArch64::LD1Twov2d_POST:
4459 case AArch64::LD1Twov2s_POST:
4460 case AArch64::LD1Twov4h_POST:
4461 case AArch64::LD1Twov4s_POST:
4462 case AArch64::LD1Twov8b_POST:
4463 case AArch64::LD1Twov8h_POST:
4464 case AArch64::LD1i16_POST:
4465 case AArch64::LD1i32_POST:
4466 case AArch64::LD1i64_POST:
4467 case AArch64::LD1i8_POST:
4468 case AArch64::LD2Rv16b_POST:
4469 case AArch64::LD2Rv1d_POST:
4470 case AArch64::LD2Rv2d_POST:
4471 case AArch64::LD2Rv2s_POST:
4472 case AArch64::LD2Rv4h_POST:
4473 case AArch64::LD2Rv4s_POST:
4474 case AArch64::LD2Rv8b_POST:
4475 case AArch64::LD2Rv8h_POST:
4476 case AArch64::LD2Twov16b_POST:
4477 case AArch64::LD2Twov2d_POST:
4478 case AArch64::LD2Twov2s_POST:
4479 case AArch64::LD2Twov4h_POST:
4480 case AArch64::LD2Twov4s_POST:
4481 case AArch64::LD2Twov8b_POST:
4482 case AArch64::LD2Twov8h_POST:
4483 case AArch64::LD2i16_POST:
4484 case AArch64::LD2i32_POST:
4485 case AArch64::LD2i64_POST:
4486 case AArch64::LD2i8_POST:
4487 case AArch64::LD3Rv16b_POST:
4488 case AArch64::LD3Rv1d_POST:
4489 case AArch64::LD3Rv2d_POST:
4490 case AArch64::LD3Rv2s_POST:
4491 case AArch64::LD3Rv4h_POST:
4492 case AArch64::LD3Rv4s_POST:
4493 case AArch64::LD3Rv8b_POST:
4494 case AArch64::LD3Rv8h_POST:
4495 case AArch64::LD3Threev16b_POST:
4496 case AArch64::LD3Threev2d_POST:
4497 case AArch64::LD3Threev2s_POST:
4498 case AArch64::LD3Threev4h_POST:
4499 case AArch64::LD3Threev4s_POST:
4500 case AArch64::LD3Threev8b_POST:
4501 case AArch64::LD3Threev8h_POST:
4502 case AArch64::LD3i16_POST:
4503 case AArch64::LD3i32_POST:
4504 case AArch64::LD3i64_POST:
4505 case AArch64::LD3i8_POST:
4506 case AArch64::LD4Fourv16b_POST:
4507 case AArch64::LD4Fourv2d_POST:
4508 case AArch64::LD4Fourv2s_POST:
4509 case AArch64::LD4Fourv4h_POST:
4510 case AArch64::LD4Fourv4s_POST:
4511 case AArch64::LD4Fourv8b_POST:
4512 case AArch64::LD4Fourv8h_POST:
4513 case AArch64::LD4Rv16b_POST:
4514 case AArch64::LD4Rv1d_POST:
4515 case AArch64::LD4Rv2d_POST:
4516 case AArch64::LD4Rv2s_POST:
4517 case AArch64::LD4Rv4h_POST:
4518 case AArch64::LD4Rv4s_POST:
4519 case AArch64::LD4Rv8b_POST:
4520 case AArch64::LD4Rv8h_POST:
4521 case AArch64::LD4i16_POST:
4522 case AArch64::LD4i32_POST:
4523 case AArch64::LD4i64_POST:
4524 case AArch64::LD4i8_POST:
4525 case AArch64::LDAPRWpost:
4526 case AArch64::LDAPRXpost:
4527 case AArch64::LDIAPPWpost:
4528 case AArch64::LDIAPPXpost:
4529 case AArch64::LDPDpost:
4530 case AArch64::LDPQpost:
4531 case AArch64::LDPSWpost:
4532 case AArch64::LDPSpost:
4533 case AArch64::LDPWpost:
4534 case AArch64::LDPXpost:
4535 case AArch64::LDRBBpost:
4536 case AArch64::LDRBpost:
4537 case AArch64::LDRDpost:
4538 case AArch64::LDRHHpost:
4539 case AArch64::LDRHpost:
4540 case AArch64::LDRQpost:
4541 case AArch64::LDRSBWpost:
4542 case AArch64::LDRSBXpost:
4543 case AArch64::LDRSHWpost:
4544 case AArch64::LDRSHXpost:
4545 case AArch64::LDRSWpost:
4546 case AArch64::LDRSpost:
4547 case AArch64::LDRWpost:
4548 case AArch64::LDRXpost:
4549 case AArch64::ST1Fourv16b_POST:
4550 case AArch64::ST1Fourv1d_POST:
4551 case AArch64::ST1Fourv2d_POST:
4552 case AArch64::ST1Fourv2s_POST:
4553 case AArch64::ST1Fourv4h_POST:
4554 case AArch64::ST1Fourv4s_POST:
4555 case AArch64::ST1Fourv8b_POST:
4556 case AArch64::ST1Fourv8h_POST:
4557 case AArch64::ST1Onev16b_POST:
4558 case AArch64::ST1Onev1d_POST:
4559 case AArch64::ST1Onev2d_POST:
4560 case AArch64::ST1Onev2s_POST:
4561 case AArch64::ST1Onev4h_POST:
4562 case AArch64::ST1Onev4s_POST:
4563 case AArch64::ST1Onev8b_POST:
4564 case AArch64::ST1Onev8h_POST:
4565 case AArch64::ST1Threev16b_POST:
4566 case AArch64::ST1Threev1d_POST:
4567 case AArch64::ST1Threev2d_POST:
4568 case AArch64::ST1Threev2s_POST:
4569 case AArch64::ST1Threev4h_POST:
4570 case AArch64::ST1Threev4s_POST:
4571 case AArch64::ST1Threev8b_POST:
4572 case AArch64::ST1Threev8h_POST:
4573 case AArch64::ST1Twov16b_POST:
4574 case AArch64::ST1Twov1d_POST:
4575 case AArch64::ST1Twov2d_POST:
4576 case AArch64::ST1Twov2s_POST:
4577 case AArch64::ST1Twov4h_POST:
4578 case AArch64::ST1Twov4s_POST:
4579 case AArch64::ST1Twov8b_POST:
4580 case AArch64::ST1Twov8h_POST:
4581 case AArch64::ST1i16_POST:
4582 case AArch64::ST1i32_POST:
4583 case AArch64::ST1i64_POST:
4584 case AArch64::ST1i8_POST:
4585 case AArch64::ST2GPostIndex:
4586 case AArch64::ST2Twov16b_POST:
4587 case AArch64::ST2Twov2d_POST:
4588 case AArch64::ST2Twov2s_POST:
4589 case AArch64::ST2Twov4h_POST:
4590 case AArch64::ST2Twov4s_POST:
4591 case AArch64::ST2Twov8b_POST:
4592 case AArch64::ST2Twov8h_POST:
4593 case AArch64::ST2i16_POST:
4594 case AArch64::ST2i32_POST:
4595 case AArch64::ST2i64_POST:
4596 case AArch64::ST2i8_POST:
4597 case AArch64::ST3Threev16b_POST:
4598 case AArch64::ST3Threev2d_POST:
4599 case AArch64::ST3Threev2s_POST:
4600 case AArch64::ST3Threev4h_POST:
4601 case AArch64::ST3Threev4s_POST:
4602 case AArch64::ST3Threev8b_POST:
4603 case AArch64::ST3Threev8h_POST:
4604 case AArch64::ST3i16_POST:
4605 case AArch64::ST3i32_POST:
4606 case AArch64::ST3i64_POST:
4607 case AArch64::ST3i8_POST:
4608 case AArch64::ST4Fourv16b_POST:
4609 case AArch64::ST4Fourv2d_POST:
4610 case AArch64::ST4Fourv2s_POST:
4611 case AArch64::ST4Fourv4h_POST:
4612 case AArch64::ST4Fourv4s_POST:
4613 case AArch64::ST4Fourv8b_POST:
4614 case AArch64::ST4Fourv8h_POST:
4615 case AArch64::ST4i16_POST:
4616 case AArch64::ST4i32_POST:
4617 case AArch64::ST4i64_POST:
4618 case AArch64::ST4i8_POST:
4619 case AArch64::STGPostIndex:
4620 case AArch64::STGPpost:
4621 case AArch64::STPDpost:
4622 case AArch64::STPQpost:
4623 case AArch64::STPSpost:
4624 case AArch64::STPWpost:
4625 case AArch64::STPXpost:
4626 case AArch64::STRBBpost:
4627 case AArch64::STRBpost:
4628 case AArch64::STRDpost:
4629 case AArch64::STRHHpost:
4630 case AArch64::STRHpost:
4631 case AArch64::STRQpost:
4632 case AArch64::STRSpost:
4633 case AArch64::STRWpost:
4634 case AArch64::STRXpost:
4635 case AArch64::STZ2GPostIndex:
4636 case AArch64::STZGPostIndex:
4643 bool &OffsetIsScalable,
TypeSize &Width,
4664 int64_t Dummy1, Dummy2;
4686 return BaseOp->
isReg() || BaseOp->
isFI();
4693 assert(OfsOp.
isImm() &&
"Offset operand wasn't immediate.");
4698 TypeSize &Width, int64_t &MinOffset,
4699 int64_t &MaxOffset) {
4704 MinOffset = MaxOffset = 0;
4707 case AArch64::LDRQui:
4708 case AArch64::STRQui:
4713 case AArch64::LDRXui:
4714 case AArch64::LDRDui:
4715 case AArch64::STRXui:
4716 case AArch64::STRDui:
4717 case AArch64::PRFMui:
4722 case AArch64::LDRWui:
4723 case AArch64::LDRSui:
4724 case AArch64::LDRSWui:
4725 case AArch64::STRWui:
4726 case AArch64::STRSui:
4731 case AArch64::LDRHui:
4732 case AArch64::LDRHHui:
4733 case AArch64::LDRSHWui:
4734 case AArch64::LDRSHXui:
4735 case AArch64::STRHui:
4736 case AArch64::STRHHui:
4741 case AArch64::LDRBui:
4742 case AArch64::LDRBBui:
4743 case AArch64::LDRSBWui:
4744 case AArch64::LDRSBXui:
4745 case AArch64::STRBui:
4746 case AArch64::STRBBui:
4752 case AArch64::STRQpre:
4753 case AArch64::LDRQpost:
4759 case AArch64::LDRDpost:
4760 case AArch64::LDRDpre:
4761 case AArch64::LDRXpost:
4762 case AArch64::LDRXpre:
4763 case AArch64::STRDpost:
4764 case AArch64::STRDpre:
4765 case AArch64::STRXpost:
4766 case AArch64::STRXpre:
4772 case AArch64::STRWpost:
4773 case AArch64::STRWpre:
4774 case AArch64::LDRWpost:
4775 case AArch64::LDRWpre:
4776 case AArch64::STRSpost:
4777 case AArch64::STRSpre:
4778 case AArch64::LDRSpost:
4779 case AArch64::LDRSpre:
4785 case AArch64::LDRHpost:
4786 case AArch64::LDRHpre:
4787 case AArch64::STRHpost:
4788 case AArch64::STRHpre:
4789 case AArch64::LDRHHpost:
4790 case AArch64::LDRHHpre:
4791 case AArch64::STRHHpost:
4792 case AArch64::STRHHpre:
4798 case AArch64::LDRBpost:
4799 case AArch64::LDRBpre:
4800 case AArch64::STRBpost:
4801 case AArch64::STRBpre:
4802 case AArch64::LDRBBpost:
4803 case AArch64::LDRBBpre:
4804 case AArch64::STRBBpost:
4805 case AArch64::STRBBpre:
4811 case AArch64::LDURQi:
4812 case AArch64::STURQi:
4818 case AArch64::LDURXi:
4819 case AArch64::LDURDi:
4820 case AArch64::LDAPURXi:
4821 case AArch64::STURXi:
4822 case AArch64::STURDi:
4823 case AArch64::STLURXi:
4824 case AArch64::PRFUMi:
4830 case AArch64::LDURWi:
4831 case AArch64::LDURSi:
4832 case AArch64::LDURSWi:
4833 case AArch64::LDAPURi:
4834 case AArch64::LDAPURSWi:
4835 case AArch64::STURWi:
4836 case AArch64::STURSi:
4837 case AArch64::STLURWi:
4843 case AArch64::LDURHi:
4844 case AArch64::LDURHHi:
4845 case AArch64::LDURSHXi:
4846 case AArch64::LDURSHWi:
4847 case AArch64::LDAPURHi:
4848 case AArch64::LDAPURSHWi:
4849 case AArch64::LDAPURSHXi:
4850 case AArch64::STURHi:
4851 case AArch64::STURHHi:
4852 case AArch64::STLURHi:
4858 case AArch64::LDURBi:
4859 case AArch64::LDURBBi:
4860 case AArch64::LDURSBXi:
4861 case AArch64::LDURSBWi:
4862 case AArch64::LDAPURBi:
4863 case AArch64::LDAPURSBWi:
4864 case AArch64::LDAPURSBXi:
4865 case AArch64::STURBi:
4866 case AArch64::STURBBi:
4867 case AArch64::STLURBi:
4873 case AArch64::LDPQi:
4874 case AArch64::LDNPQi:
4875 case AArch64::STPQi:
4876 case AArch64::STNPQi:
4877 case AArch64::LDPQpost:
4878 case AArch64::LDPQpre:
4879 case AArch64::STPQpost:
4880 case AArch64::STPQpre:
4886 case AArch64::LDPXi:
4887 case AArch64::LDPDi:
4888 case AArch64::LDNPXi:
4889 case AArch64::LDNPDi:
4890 case AArch64::STPXi:
4891 case AArch64::STPDi:
4892 case AArch64::STNPXi:
4893 case AArch64::STNPDi:
4894 case AArch64::LDPDpost:
4895 case AArch64::LDPDpre:
4896 case AArch64::LDPXpost:
4897 case AArch64::LDPXpre:
4898 case AArch64::STPDpost:
4899 case AArch64::STPDpre:
4900 case AArch64::STPXpost:
4901 case AArch64::STPXpre:
4907 case AArch64::LDPWi:
4908 case AArch64::LDPSi:
4909 case AArch64::LDNPWi:
4910 case AArch64::LDNPSi:
4911 case AArch64::STPWi:
4912 case AArch64::STPSi:
4913 case AArch64::STNPWi:
4914 case AArch64::STNPSi:
4915 case AArch64::LDPSpost:
4916 case AArch64::LDPSpre:
4917 case AArch64::LDPWpost:
4918 case AArch64::LDPWpre:
4919 case AArch64::STPSpost:
4920 case AArch64::STPSpre:
4921 case AArch64::STPWpost:
4922 case AArch64::STPWpre:
4928 case AArch64::StoreSwiftAsyncContext:
4941 case AArch64::TAGPstack:
4951 case AArch64::STGPreIndex:
4952 case AArch64::STGPostIndex:
4953 case AArch64::STZGi:
4954 case AArch64::STZGPreIndex:
4955 case AArch64::STZGPostIndex:
4961 case AArch64::STR_ZZZZXI:
4962 case AArch64::STR_ZZZZXI_STRIDED_CONTIGUOUS:
4963 case AArch64::LDR_ZZZZXI:
4964 case AArch64::LDR_ZZZZXI_STRIDED_CONTIGUOUS:
4970 case AArch64::STR_ZZZXI:
4971 case AArch64::LDR_ZZZXI:
4977 case AArch64::STR_ZZXI:
4978 case AArch64::STR_ZZXI_STRIDED_CONTIGUOUS:
4979 case AArch64::LDR_ZZXI:
4980 case AArch64::LDR_ZZXI_STRIDED_CONTIGUOUS:
4986 case AArch64::LDR_PXI:
4987 case AArch64::STR_PXI:
4992 case AArch64::LDR_PPXI:
4993 case AArch64::STR_PPXI:
4999 case AArch64::LDR_ZXI:
5000 case AArch64::STR_ZXI:
5005 case AArch64::LD1B_IMM:
5006 case AArch64::LD1H_IMM:
5007 case AArch64::LD1W_IMM:
5008 case AArch64::LD1D_IMM:
5009 case AArch64::LDNT1B_ZRI:
5010 case AArch64::LDNT1H_ZRI:
5011 case AArch64::LDNT1W_ZRI:
5012 case AArch64::LDNT1D_ZRI:
5013 case AArch64::ST1B_IMM:
5014 case AArch64::ST1H_IMM:
5015 case AArch64::ST1W_IMM:
5016 case AArch64::ST1D_IMM:
5017 case AArch64::STNT1B_ZRI:
5018 case AArch64::STNT1H_ZRI:
5019 case AArch64::STNT1W_ZRI:
5020 case AArch64::STNT1D_ZRI:
5021 case AArch64::LDNF1B_IMM:
5022 case AArch64::LDNF1H_IMM:
5023 case AArch64::LDNF1W_IMM:
5024 case AArch64::LDNF1D_IMM:
5031 case AArch64::LD2B_IMM:
5032 case AArch64::LD2H_IMM:
5033 case AArch64::LD2W_IMM:
5034 case AArch64::LD2D_IMM:
5035 case AArch64::ST2B_IMM:
5036 case AArch64::ST2H_IMM:
5037 case AArch64::ST2W_IMM:
5038 case AArch64::ST2D_IMM:
5039 case AArch64::LD1B_2Z_IMM:
5040 case AArch64::LD1B_2Z_STRIDED_IMM:
5041 case AArch64::LD1H_2Z_IMM:
5042 case AArch64::LD1H_2Z_STRIDED_IMM:
5043 case AArch64::LD1W_2Z_IMM:
5044 case AArch64::LD1W_2Z_STRIDED_IMM:
5045 case AArch64::LD1D_2Z_IMM:
5046 case AArch64::LD1D_2Z_STRIDED_IMM:
5047 case AArch64::LD1B_2Z_IMM_PSEUDO:
5048 case AArch64::LD1H_2Z_IMM_PSEUDO:
5049 case AArch64::LD1W_2Z_IMM_PSEUDO:
5050 case AArch64::LD1D_2Z_IMM_PSEUDO:
5051 case AArch64::ST1B_2Z_IMM:
5052 case AArch64::ST1B_2Z_STRIDED_IMM:
5053 case AArch64::ST1H_2Z_IMM:
5054 case AArch64::ST1H_2Z_STRIDED_IMM:
5055 case AArch64::ST1W_2Z_IMM:
5056 case AArch64::ST1W_2Z_STRIDED_IMM:
5057 case AArch64::ST1D_2Z_IMM:
5058 case AArch64::ST1D_2Z_STRIDED_IMM:
5059 case AArch64::LDNT1B_2Z_IMM_PSEUDO:
5060 case AArch64::LDNT1B_2Z_IMM:
5061 case AArch64::LDNT1B_2Z_STRIDED_IMM:
5062 case AArch64::LDNT1H_2Z_IMM_PSEUDO:
5063 case AArch64::LDNT1H_2Z_IMM:
5064 case AArch64::LDNT1H_2Z_STRIDED_IMM:
5065 case AArch64::LDNT1W_2Z_IMM_PSEUDO:
5066 case AArch64::LDNT1W_2Z_IMM:
5067 case AArch64::LDNT1W_2Z_STRIDED_IMM:
5068 case AArch64::LDNT1D_2Z_IMM_PSEUDO:
5069 case AArch64::LDNT1D_2Z_IMM:
5070 case AArch64::LDNT1D_2Z_STRIDED_IMM:
5071 case AArch64::STNT1B_2Z_IMM:
5072 case AArch64::STNT1B_2Z_STRIDED_IMM:
5073 case AArch64::STNT1H_2Z_IMM:
5074 case AArch64::STNT1H_2Z_STRIDED_IMM:
5075 case AArch64::STNT1W_2Z_IMM:
5076 case AArch64::STNT1W_2Z_STRIDED_IMM:
5077 case AArch64::STNT1D_2Z_IMM:
5078 case AArch64::STNT1D_2Z_STRIDED_IMM:
5079 case AArch64::ST1B_2Z_IMM_PSEUDO:
5080 case AArch64::ST1H_2Z_IMM_PSEUDO:
5081 case AArch64::ST1W_2Z_IMM_PSEUDO:
5082 case AArch64::ST1D_2Z_IMM_PSEUDO:
5083 case AArch64::STNT1B_2Z_IMM_PSEUDO:
5084 case AArch64::STNT1H_2Z_IMM_PSEUDO:
5085 case AArch64::STNT1W_2Z_IMM_PSEUDO:
5086 case AArch64::STNT1D_2Z_IMM_PSEUDO:
5091 case AArch64::LD3B_IMM:
5092 case AArch64::LD3H_IMM:
5093 case AArch64::LD3W_IMM:
5094 case AArch64::LD3D_IMM:
5095 case AArch64::ST3B_IMM:
5096 case AArch64::ST3H_IMM:
5097 case AArch64::ST3W_IMM:
5098 case AArch64::ST3D_IMM:
5103 case AArch64::LD4B_IMM:
5104 case AArch64::LD4H_IMM:
5105 case AArch64::LD4W_IMM:
5106 case AArch64::LD4D_IMM:
5107 case AArch64::ST4B_IMM:
5108 case AArch64::ST4H_IMM:
5109 case AArch64::ST4W_IMM:
5110 case AArch64::ST4D_IMM:
5111 case AArch64::LD1B_4Z_IMM:
5112 case AArch64::LD1B_4Z_STRIDED_IMM:
5113 case AArch64::LD1H_4Z_IMM:
5114 case AArch64::LD1H_4Z_STRIDED_IMM:
5115 case AArch64::LD1W_4Z_IMM:
5116 case AArch64::LD1W_4Z_STRIDED_IMM:
5117 case AArch64::LD1D_4Z_IMM:
5118 case AArch64::LD1D_4Z_STRIDED_IMM:
5119 case AArch64::LD1B_4Z_IMM_PSEUDO:
5120 case AArch64::LD1H_4Z_IMM_PSEUDO:
5121 case AArch64::LD1W_4Z_IMM_PSEUDO:
5122 case AArch64::LD1D_4Z_IMM_PSEUDO:
5123 case AArch64::ST1B_4Z_IMM:
5124 case AArch64::ST1B_4Z_STRIDED_IMM:
5125 case AArch64::ST1H_4Z_IMM:
5126 case AArch64::ST1H_4Z_STRIDED_IMM:
5127 case AArch64::ST1W_4Z_IMM:
5128 case AArch64::ST1W_4Z_STRIDED_IMM:
5129 case AArch64::ST1D_4Z_IMM:
5130 case AArch64::ST1D_4Z_STRIDED_IMM:
5131 case AArch64::LDNT1B_4Z_IMM_PSEUDO:
5132 case AArch64::LDNT1B_4Z_IMM:
5133 case AArch64::LDNT1B_4Z_STRIDED_IMM:
5134 case AArch64::LDNT1H_4Z_IMM_PSEUDO:
5135 case AArch64::LDNT1H_4Z_IMM:
5136 case AArch64::LDNT1H_4Z_STRIDED_IMM:
5137 case AArch64::LDNT1W_4Z_IMM_PSEUDO:
5138 case AArch64::LDNT1W_4Z_IMM:
5139 case AArch64::LDNT1W_4Z_STRIDED_IMM:
5140 case AArch64::LDNT1D_4Z_IMM_PSEUDO:
5141 case AArch64::LDNT1D_4Z_IMM:
5142 case AArch64::LDNT1D_4Z_STRIDED_IMM:
5143 case AArch64::STNT1B_4Z_IMM:
5144 case AArch64::STNT1B_4Z_STRIDED_IMM:
5145 case AArch64::STNT1H_4Z_IMM:
5146 case AArch64::STNT1H_4Z_STRIDED_IMM:
5147 case AArch64::STNT1W_4Z_IMM:
5148 case AArch64::STNT1W_4Z_STRIDED_IMM:
5149 case AArch64::STNT1D_4Z_IMM:
5150 case AArch64::STNT1D_4Z_STRIDED_IMM:
5151 case AArch64::ST1B_4Z_IMM_PSEUDO:
5152 case AArch64::ST1H_4Z_IMM_PSEUDO:
5153 case AArch64::ST1W_4Z_IMM_PSEUDO:
5154 case AArch64::ST1D_4Z_IMM_PSEUDO:
5155 case AArch64::STNT1B_4Z_IMM_PSEUDO:
5156 case AArch64::STNT1H_4Z_IMM_PSEUDO:
5157 case AArch64::STNT1W_4Z_IMM_PSEUDO:
5158 case AArch64::STNT1D_4Z_IMM_PSEUDO:
5163 case AArch64::LD1B_H_IMM:
5164 case AArch64::LD1SB_H_IMM:
5165 case AArch64::LD1H_S_IMM:
5166 case AArch64::LD1SH_S_IMM:
5167 case AArch64::LD1W_D_IMM:
5168 case AArch64::LD1SW_D_IMM:
5169 case AArch64::ST1B_H_IMM:
5170 case AArch64::ST1H_S_IMM:
5171 case AArch64::ST1W_D_IMM:
5172 case AArch64::LDNF1B_H_IMM:
5173 case AArch64::LDNF1SB_H_IMM:
5174 case AArch64::LDNF1H_S_IMM:
5175 case AArch64::LDNF1SH_S_IMM:
5176 case AArch64::LDNF1W_D_IMM:
5177 case AArch64::LDNF1SW_D_IMM:
5184 case AArch64::LD1B_S_IMM:
5185 case AArch64::LD1SB_S_IMM:
5186 case AArch64::LD1H_D_IMM:
5187 case AArch64::LD1SH_D_IMM:
5188 case AArch64::ST1B_S_IMM:
5189 case AArch64::ST1H_D_IMM:
5190 case AArch64::LDNF1B_S_IMM:
5191 case AArch64::LDNF1SB_S_IMM:
5192 case AArch64::LDNF1H_D_IMM:
5193 case AArch64::LDNF1SH_D_IMM:
5200 case AArch64::LD1B_D_IMM:
5201 case AArch64::LD1SB_D_IMM:
5202 case AArch64::ST1B_D_IMM:
5203 case AArch64::LDNF1B_D_IMM:
5204 case AArch64::LDNF1SB_D_IMM:
5211 case AArch64::ST2Gi:
5212 case AArch64::ST2GPreIndex:
5213 case AArch64::ST2GPostIndex:
5214 case AArch64::STZ2Gi:
5215 case AArch64::STZ2GPreIndex:
5216 case AArch64::STZ2GPostIndex:
5222 case AArch64::STGPi:
5223 case AArch64::STGPpost:
5224 case AArch64::STGPpre:
5229 case AArch64::LD1RB_IMM:
5230 case AArch64::LD1RB_H_IMM:
5231 case AArch64::LD1RB_S_IMM:
5232 case AArch64::LD1RB_D_IMM:
5233 case AArch64::LD1RSB_H_IMM:
5234 case AArch64::LD1RSB_S_IMM:
5235 case AArch64::LD1RSB_D_IMM:
5240 case AArch64::LD1RH_IMM:
5241 case AArch64::LD1RH_S_IMM:
5242 case AArch64::LD1RH_D_IMM:
5243 case AArch64::LD1RSH_S_IMM:
5244 case AArch64::LD1RSH_D_IMM:
5249 case AArch64::LD1RW_IMM:
5250 case AArch64::LD1RW_D_IMM:
5251 case AArch64::LD1RSW_IMM:
5256 case AArch64::LD1RD_IMM:
5271 case AArch64::LDRBui:
5272 case AArch64::LDRBBui:
5273 case AArch64::LDURBBi:
5274 case AArch64::LDRSBWui:
5275 case AArch64::LDURSBWi:
5276 case AArch64::STRBui:
5277 case AArch64::STRBBui:
5278 case AArch64::STURBBi:
5280 case AArch64::LDRHui:
5281 case AArch64::LDRHHui:
5282 case AArch64::LDURHHi:
5283 case AArch64::LDRSHWui:
5284 case AArch64::LDURSHWi:
5285 case AArch64::STRHui:
5286 case AArch64::STRHHui:
5287 case AArch64::STURHHi:
5289 case AArch64::LDRSui:
5290 case AArch64::LDURSi:
5291 case AArch64::LDRSpre:
5292 case AArch64::LDRSWui:
5293 case AArch64::LDURSWi:
5294 case AArch64::LDRSWpre:
5295 case AArch64::LDRWpre:
5296 case AArch64::LDRWui:
5297 case AArch64::LDURWi:
5298 case AArch64::STRSui:
5299 case AArch64::STURSi:
5300 case AArch64::STRSpre:
5301 case AArch64::STRWui:
5302 case AArch64::STURWi:
5303 case AArch64::STRWpre:
5304 case AArch64::LDPSi:
5305 case AArch64::LDPSWi:
5306 case AArch64::LDPWi:
5307 case AArch64::STPSi:
5308 case AArch64::STPWi:
5310 case AArch64::LDRDui:
5311 case AArch64::LDURDi:
5312 case AArch64::LDRDpre:
5313 case AArch64::LDRXui:
5314 case AArch64::LDURXi:
5315 case AArch64::LDRXpre:
5316 case AArch64::STRDui:
5317 case AArch64::STURDi:
5318 case AArch64::STRDpre:
5319 case AArch64::STRXui:
5320 case AArch64::STURXi:
5321 case AArch64::STRXpre:
5322 case AArch64::LDPDi:
5323 case AArch64::LDPXi:
5324 case AArch64::STPDi:
5325 case AArch64::STPXi:
5327 case AArch64::LDRQui:
5328 case AArch64::LDURQi:
5329 case AArch64::STRQui:
5330 case AArch64::STURQi:
5331 case AArch64::STRQpre:
5332 case AArch64::LDPQi:
5333 case AArch64::LDRQpre:
5334 case AArch64::STPQi:
5336 case AArch64::STZGi:
5337 case AArch64::ST2Gi:
5338 case AArch64::STZ2Gi:
5339 case AArch64::STGPi:
5345 switch (
MI.getOpcode()) {
5348 case AArch64::LDRWpre:
5349 case AArch64::LDRXpre:
5350 case AArch64::LDRSWpre:
5351 case AArch64::LDRSpre:
5352 case AArch64::LDRDpre:
5353 case AArch64::LDRQpre:
5359 switch (
MI.getOpcode()) {
5362 case AArch64::STRWpre:
5363 case AArch64::STRXpre:
5364 case AArch64::STRSpre:
5365 case AArch64::STRDpre:
5366 case AArch64::STRQpre:
5376 switch (
MI.getOpcode()) {
5379 case AArch64::LDURBBi:
5380 case AArch64::LDURHHi:
5381 case AArch64::LDURWi:
5382 case AArch64::LDRBBui:
5383 case AArch64::LDRHHui:
5384 case AArch64::LDRWui:
5385 case AArch64::LDRBBroX:
5386 case AArch64::LDRHHroX:
5387 case AArch64::LDRWroX:
5388 case AArch64::LDRBBroW:
5389 case AArch64::LDRHHroW:
5390 case AArch64::LDRWroW:
5396 switch (
MI.getOpcode()) {
5399 case AArch64::LDURSBWi:
5400 case AArch64::LDURSHWi:
5401 case AArch64::LDURSBXi:
5402 case AArch64::LDURSHXi:
5403 case AArch64::LDURSWi:
5404 case AArch64::LDRSBWui:
5405 case AArch64::LDRSHWui:
5406 case AArch64::LDRSBXui:
5407 case AArch64::LDRSHXui:
5408 case AArch64::LDRSWui:
5409 case AArch64::LDRSBWroX:
5410 case AArch64::LDRSHWroX:
5411 case AArch64::LDRSBXroX:
5412 case AArch64::LDRSHXroX:
5413 case AArch64::LDRSWroX:
5414 case AArch64::LDRSBWroW:
5415 case AArch64::LDRSHWroW:
5416 case AArch64::LDRSBXroW:
5417 case AArch64::LDRSHXroW:
5418 case AArch64::LDRSWroW:
5424 switch (
MI.getOpcode()) {
5427 case AArch64::LDPSi:
5428 case AArch64::LDPSWi:
5429 case AArch64::LDPDi:
5430 case AArch64::LDPQi:
5431 case AArch64::LDPWi:
5432 case AArch64::LDPXi:
5433 case AArch64::STPSi:
5434 case AArch64::STPDi:
5435 case AArch64::STPQi:
5436 case AArch64::STPWi:
5437 case AArch64::STPXi:
5438 case AArch64::STGPi:
5444 assert(
MI.mayLoadOrStore() &&
"Load or store instruction expected");
5448 return MI.getOperand(Idx);
5453 assert(
MI.mayLoadOrStore() &&
"Load or store instruction expected");
5457 return MI.getOperand(Idx);
5462 switch (
MI.getOpcode()) {
5465 case AArch64::LDRBroX:
5466 case AArch64::LDRBBroX:
5467 case AArch64::LDRSBXroX:
5468 case AArch64::LDRSBWroX:
5469 case AArch64::LDRHroX:
5470 case AArch64::LDRHHroX:
5471 case AArch64::LDRSHXroX:
5472 case AArch64::LDRSHWroX:
5473 case AArch64::LDRWroX:
5474 case AArch64::LDRSroX:
5475 case AArch64::LDRSWroX:
5476 case AArch64::LDRDroX:
5477 case AArch64::LDRXroX:
5478 case AArch64::LDRQroX:
5479 return MI.getOperand(4);
5485 if (
MI.getParent() ==
nullptr)
5495 auto Reg =
Op.getReg();
5496 if (Reg.isPhysical())
5497 return AArch64::FPR16RegClass.contains(Reg);
5499 return TRC == &AArch64::FPR16RegClass ||
5500 TRC == &AArch64::FPR16_loRegClass;
5509 auto Reg =
Op.getReg();
5510 if (Reg.isPhysical())
5511 return AArch64::FPR128RegClass.contains(Reg);
5513 return TRC == &AArch64::FPR128RegClass ||
5514 TRC == &AArch64::FPR128_loRegClass;
5520 switch (
MI.getOpcode()) {
5523 case AArch64::PACIASP:
5524 case AArch64::PACIBSP:
5527 case AArch64::PAUTH_PROLOGUE:
5530 case AArch64::HINT: {
5531 unsigned Imm =
MI.getOperand(0).getImm();
5536 if (
Imm == 25 ||
Imm == 27)
5548 assert(Reg.isPhysical() &&
"Expected physical register in isFpOrNEON");
5549 return AArch64::FPR128RegClass.contains(Reg) ||
5550 AArch64::FPR64RegClass.contains(Reg) ||
5551 AArch64::FPR32RegClass.contains(Reg) ||
5552 AArch64::FPR16RegClass.contains(Reg) ||
5553 AArch64::FPR8RegClass.contains(Reg);
5560 auto Reg =
Op.getReg();
5561 if (Reg.isPhysical())
5565 return TRC == &AArch64::FPR128RegClass ||
5566 TRC == &AArch64::FPR128_loRegClass ||
5567 TRC == &AArch64::FPR64RegClass ||
5568 TRC == &AArch64::FPR64_loRegClass ||
5569 TRC == &AArch64::FPR32RegClass || TRC == &AArch64::FPR16RegClass ||
5570 TRC == &AArch64::FPR8RegClass;
5592 if (FirstOpc == SecondOpc)
5598 case AArch64::STRSui:
5599 case AArch64::STURSi:
5600 return SecondOpc == AArch64::STRSui || SecondOpc == AArch64::STURSi;
5601 case AArch64::STRDui:
5602 case AArch64::STURDi:
5603 return SecondOpc == AArch64::STRDui || SecondOpc == AArch64::STURDi;
5604 case AArch64::STRQui:
5605 case AArch64::STURQi:
5606 return SecondOpc == AArch64::STRQui || SecondOpc == AArch64::STURQi;
5607 case AArch64::STRWui:
5608 case AArch64::STURWi:
5609 return SecondOpc == AArch64::STRWui || SecondOpc == AArch64::STURWi;
5610 case AArch64::STRXui:
5611 case AArch64::STURXi:
5612 return SecondOpc == AArch64::STRXui || SecondOpc == AArch64::STURXi;
5613 case AArch64::LDRSui:
5614 case AArch64::LDURSi:
5615 return SecondOpc == AArch64::LDRSui || SecondOpc == AArch64::LDURSi;
5616 case AArch64::LDRDui:
5617 case AArch64::LDURDi:
5618 return SecondOpc == AArch64::LDRDui || SecondOpc == AArch64::LDURDi;
5619 case AArch64::LDRQui:
5620 case AArch64::LDURQi:
5621 return SecondOpc == AArch64::LDRQui || SecondOpc == AArch64::LDURQi;
5622 case AArch64::LDRWui:
5623 case AArch64::LDURWi:
5624 return SecondOpc == AArch64::LDRSWui || SecondOpc == AArch64::LDURSWi;
5625 case AArch64::LDRSWui:
5626 case AArch64::LDURSWi:
5627 return SecondOpc == AArch64::LDRWui || SecondOpc == AArch64::LDURWi;
5628 case AArch64::LDRXui:
5629 case AArch64::LDURXi:
5630 return SecondOpc == AArch64::LDRXui || SecondOpc == AArch64::LDURXi;
5637 int64_t Offset1,
unsigned Opcode1,
int FI2,
5638 int64_t Offset2,
unsigned Opcode2) {
5644 assert(ObjectOffset1 <= ObjectOffset2 &&
"Object offsets are not ordered.");
5647 if (ObjectOffset1 % Scale1 != 0)
5649 ObjectOffset1 /= Scale1;
5651 if (ObjectOffset2 % Scale2 != 0)
5653 ObjectOffset2 /= Scale2;
5654 ObjectOffset1 += Offset1;
5655 ObjectOffset2 += Offset2;
5656 return ObjectOffset1 + 1 == ObjectOffset2;
5668 int64_t OpOffset2,
bool OffsetIsScalable2,
unsigned ClusterSize,
5669 unsigned NumBytes)
const {
5679 "Only base registers and frame indices are supported.");
5686 if (ClusterSize > 2)
5693 unsigned FirstOpc = FirstLdSt.
getOpcode();
5694 unsigned SecondOpc = SecondLdSt.
getOpcode();
5714 if (Offset1 > 63 || Offset1 < -64)
5719 if (BaseOp1.
isFI()) {
5721 "Caller should have ordered offsets.");
5726 BaseOp2.
getIndex(), Offset2, SecondOpc);
5729 assert(Offset1 <= Offset2 &&
"Caller should have ordered offsets.");
5731 return Offset1 + 1 == Offset2;
5741 if (
Reg.isPhysical())
5750 return ((DestReg - SrcReg) & 0x1f) < NumRegs;
5759 assert(Subtarget.hasNEON() &&
"Unexpected register copy without NEON");
5761 uint16_t DestEncoding =
TRI->getEncodingValue(DestReg);
5762 uint16_t SrcEncoding =
TRI->getEncodingValue(SrcReg);
5763 unsigned NumRegs = Indices.
size();
5765 int SubReg = 0, End = NumRegs, Incr = 1;
5767 SubReg = NumRegs - 1;
5772 for (; SubReg != End; SubReg += Incr) {
5784 unsigned Opcode,
unsigned ZeroReg,
5787 unsigned NumRegs = Indices.
size();
5790 uint16_t DestEncoding =
TRI->getEncodingValue(DestReg);
5791 uint16_t SrcEncoding =
TRI->getEncodingValue(SrcReg);
5792 assert(DestEncoding % NumRegs == 0 && SrcEncoding % NumRegs == 0 &&
5793 "GPR reg sequences should not be able to overlap");
5796 for (
unsigned SubReg = 0; SubReg != NumRegs; ++SubReg) {
5817 unsigned Opc =
MI.getOpcode();
5818 if (
Opc == AArch64::MSRpstatesvcrImm1 ||
Opc == AArch64::MSRpstatePseudo) {
5820 int64_t PState =
MI.getOperand(0).getImm();
5821 if (PState == AArch64SVCR::SVCRSM || PState == AArch64SVCR::SVCRSMZA) {
5823 return MI.getOperand(1).getImm() == 1;
5842 bool RenamableSrc)
const {
5844 if (AArch64::GPR32spRegClass.
contains(DestReg) &&
5845 AArch64::GPR32spRegClass.
contains(SrcReg)) {
5846 if (DestReg == AArch64::WSP || SrcReg == AArch64::WSP) {
5848 if (Subtarget.hasZeroCycleRegMoveGPR64() &&
5849 !Subtarget.hasZeroCycleRegMoveGPR32()) {
5851 MCRegister DestRegX = RI.getMatchingSuperReg(DestReg, AArch64::sub_32,
5852 &AArch64::GPR64spRegClass);
5853 MCRegister SrcRegX = RI.getMatchingSuperReg(SrcReg, AArch64::sub_32,
5854 &AArch64::GPR64spRegClass);
5864 ++NumZCRegMoveInstrsGPR;
5870 if (Subtarget.hasZeroCycleRegMoveGPR32())
5871 ++NumZCRegMoveInstrsGPR;
5873 }
else if (Subtarget.hasZeroCycleRegMoveGPR64() &&
5874 !Subtarget.hasZeroCycleRegMoveGPR32()) {
5876 MCRegister DestRegX = RI.getMatchingSuperReg(DestReg, AArch64::sub_32,
5877 &AArch64::GPR64spRegClass);
5878 assert(DestRegX.
isValid() &&
"Destination super-reg not valid");
5879 MCRegister SrcRegX = RI.getMatchingSuperReg(SrcReg, AArch64::sub_32,
5880 &AArch64::GPR64spRegClass);
5890 ++NumZCRegMoveInstrsGPR;
5896 if (Subtarget.hasZeroCycleRegMoveGPR32())
5897 ++NumZCRegMoveInstrsGPR;
5903 if (AArch64::GPR32spRegClass.
contains(DestReg) && SrcReg == AArch64::WZR) {
5904 if (Subtarget.hasZeroCycleZeroingGPR64() &&
5905 !Subtarget.hasZeroCycleZeroingGPR32()) {
5906 MCRegister DestRegX = RI.getMatchingSuperReg(DestReg, AArch64::sub_32,
5907 &AArch64::GPR64spRegClass);
5908 assert(DestRegX.
isValid() &&
"Destination super-reg not valid");
5912 ++NumZCZeroingInstrsGPR;
5913 }
else if (Subtarget.hasZeroCycleZeroingGPR32()) {
5917 ++NumZCZeroingInstrsGPR;
5926 if (AArch64::GPR64spRegClass.
contains(DestReg) &&
5927 AArch64::GPR64spRegClass.
contains(SrcReg)) {
5928 if (DestReg == AArch64::SP || SrcReg == AArch64::SP) {
5934 if (Subtarget.hasZeroCycleRegMoveGPR64())
5935 ++NumZCRegMoveInstrsGPR;
5941 if (Subtarget.hasZeroCycleRegMoveGPR64())
5942 ++NumZCRegMoveInstrsGPR;
5948 if (AArch64::GPR64spRegClass.
contains(DestReg) && SrcReg == AArch64::XZR) {
5949 if (Subtarget.hasZeroCycleZeroingGPR64()) {
5953 ++NumZCZeroingInstrsGPR;
5963 if (AArch64::PPRRegClass.
contains(DestReg) &&
5964 AArch64::PPRRegClass.
contains(SrcReg)) {
5965 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
5966 "Unexpected SVE register.");
5976 bool DestIsPNR = AArch64::PNRRegClass.contains(DestReg);
5977 bool SrcIsPNR = AArch64::PNRRegClass.contains(SrcReg);
5978 if (DestIsPNR || SrcIsPNR) {
5980 return (R - AArch64::PN0) + AArch64::P0;
5985 if (PPRSrcReg != PPRDestReg) {
5997 if (AArch64::ZPRRegClass.
contains(DestReg) &&
5998 AArch64::ZPRRegClass.
contains(SrcReg)) {
5999 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6000 "Unexpected SVE register.");
6008 if ((AArch64::ZPR2RegClass.
contains(DestReg) ||
6009 AArch64::ZPR2StridedOrContiguousRegClass.
contains(DestReg)) &&
6010 (AArch64::ZPR2RegClass.
contains(SrcReg) ||
6011 AArch64::ZPR2StridedOrContiguousRegClass.
contains(SrcReg))) {
6012 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6013 "Unexpected SVE register.");
6014 static const unsigned Indices[] = {AArch64::zsub0, AArch64::zsub1};
6021 if (AArch64::ZPR3RegClass.
contains(DestReg) &&
6022 AArch64::ZPR3RegClass.
contains(SrcReg)) {
6023 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6024 "Unexpected SVE register.");
6025 static const unsigned Indices[] = {AArch64::zsub0, AArch64::zsub1,
6033 if ((AArch64::ZPR4RegClass.
contains(DestReg) ||
6034 AArch64::ZPR4StridedOrContiguousRegClass.
contains(DestReg)) &&
6035 (AArch64::ZPR4RegClass.
contains(SrcReg) ||
6036 AArch64::ZPR4StridedOrContiguousRegClass.
contains(SrcReg))) {
6037 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6038 "Unexpected SVE register.");
6039 static const unsigned Indices[] = {AArch64::zsub0, AArch64::zsub1,
6040 AArch64::zsub2, AArch64::zsub3};
6047 if (AArch64::DDDDRegClass.
contains(DestReg) &&
6048 AArch64::DDDDRegClass.
contains(SrcReg)) {
6049 static const unsigned Indices[] = {AArch64::dsub0, AArch64::dsub1,
6050 AArch64::dsub2, AArch64::dsub3};
6057 if (AArch64::DDDRegClass.
contains(DestReg) &&
6058 AArch64::DDDRegClass.
contains(SrcReg)) {
6059 static const unsigned Indices[] = {AArch64::dsub0, AArch64::dsub1,
6067 if (AArch64::DDRegClass.
contains(DestReg) &&
6068 AArch64::DDRegClass.
contains(SrcReg)) {
6069 static const unsigned Indices[] = {AArch64::dsub0, AArch64::dsub1};
6076 if (AArch64::QQQQRegClass.
contains(DestReg) &&
6077 AArch64::QQQQRegClass.
contains(SrcReg)) {
6078 static const unsigned Indices[] = {AArch64::qsub0, AArch64::qsub1,
6079 AArch64::qsub2, AArch64::qsub3};
6086 if (AArch64::QQQRegClass.
contains(DestReg) &&
6087 AArch64::QQQRegClass.
contains(SrcReg)) {
6088 static const unsigned Indices[] = {AArch64::qsub0, AArch64::qsub1,
6096 if (AArch64::QQRegClass.
contains(DestReg) &&
6097 AArch64::QQRegClass.
contains(SrcReg)) {
6098 static const unsigned Indices[] = {AArch64::qsub0, AArch64::qsub1};
6104 if (AArch64::XSeqPairsClassRegClass.
contains(DestReg) &&
6105 AArch64::XSeqPairsClassRegClass.
contains(SrcReg)) {
6106 static const unsigned Indices[] = {AArch64::sube64, AArch64::subo64};
6108 AArch64::XZR, Indices);
6112 if (AArch64::WSeqPairsClassRegClass.
contains(DestReg) &&
6113 AArch64::WSeqPairsClassRegClass.
contains(SrcReg)) {
6114 static const unsigned Indices[] = {AArch64::sube32, AArch64::subo32};
6116 AArch64::WZR, Indices);
6120 if (AArch64::FPR128RegClass.
contains(DestReg) &&
6121 AArch64::FPR128RegClass.
contains(SrcReg)) {
6125 if ((Subtarget.isSVEorStreamingSVEAvailable() &&
6126 !Subtarget.isNeonAvailable()) ||
6130 .
addReg(AArch64::Z0 + (SrcReg - AArch64::Q0))
6131 .
addReg(AArch64::Z0 + (SrcReg - AArch64::Q0));
6132 }
else if (Subtarget.isNeonAvailable()) {
6136 if (Subtarget.hasZeroCycleRegMoveFPR128())
6137 ++NumZCRegMoveInstrsFPR;
6153 if (AArch64::FPR64RegClass.
contains(DestReg) &&
6154 AArch64::FPR64RegClass.
contains(SrcReg)) {
6155 if (Subtarget.hasZeroCycleRegMoveFPR128() &&
6156 !Subtarget.hasZeroCycleRegMoveFPR64() &&
6157 !Subtarget.hasZeroCycleRegMoveFPR32() && Subtarget.isNeonAvailable() &&
6159 MCRegister DestRegQ = RI.getMatchingSuperReg(DestReg, AArch64::dsub,
6160 &AArch64::FPR128RegClass);
6161 MCRegister SrcRegQ = RI.getMatchingSuperReg(SrcReg, AArch64::dsub,
6162 &AArch64::FPR128RegClass);
6171 ++NumZCRegMoveInstrsFPR;
6175 if (Subtarget.hasZeroCycleRegMoveFPR64())
6176 ++NumZCRegMoveInstrsFPR;
6181 if (AArch64::FPR32RegClass.
contains(DestReg) &&
6182 AArch64::FPR32RegClass.
contains(SrcReg)) {
6183 if (Subtarget.hasZeroCycleRegMoveFPR128() &&
6184 !Subtarget.hasZeroCycleRegMoveFPR64() &&
6185 !Subtarget.hasZeroCycleRegMoveFPR32() && Subtarget.isNeonAvailable() &&
6187 MCRegister DestRegQ = RI.getMatchingSuperReg(DestReg, AArch64::ssub,
6188 &AArch64::FPR128RegClass);
6189 MCRegister SrcRegQ = RI.getMatchingSuperReg(SrcReg, AArch64::ssub,
6190 &AArch64::FPR128RegClass);
6199 ++NumZCRegMoveInstrsFPR;
6200 }
else if (Subtarget.hasZeroCycleRegMoveFPR64() &&
6201 !Subtarget.hasZeroCycleRegMoveFPR32()) {
6202 MCRegister DestRegD = RI.getMatchingSuperReg(DestReg, AArch64::ssub,
6203 &AArch64::FPR64RegClass);
6204 MCRegister SrcRegD = RI.getMatchingSuperReg(SrcReg, AArch64::ssub,
6205 &AArch64::FPR64RegClass);
6213 ++NumZCRegMoveInstrsFPR;
6217 if (Subtarget.hasZeroCycleRegMoveFPR32())
6218 ++NumZCRegMoveInstrsFPR;
6223 if (AArch64::FPR16RegClass.
contains(DestReg) &&
6224 AArch64::FPR16RegClass.
contains(SrcReg)) {
6225 if (Subtarget.hasZeroCycleRegMoveFPR128() &&
6226 !Subtarget.hasZeroCycleRegMoveFPR64() &&
6227 !Subtarget.hasZeroCycleRegMoveFPR32() && Subtarget.isNeonAvailable() &&
6229 MCRegister DestRegQ = RI.getMatchingSuperReg(DestReg, AArch64::hsub,
6230 &AArch64::FPR128RegClass);
6231 MCRegister SrcRegQ = RI.getMatchingSuperReg(SrcReg, AArch64::hsub,
6232 &AArch64::FPR128RegClass);
6241 }
else if (Subtarget.hasZeroCycleRegMoveFPR64() &&
6242 !Subtarget.hasZeroCycleRegMoveFPR32()) {
6243 MCRegister DestRegD = RI.getMatchingSuperReg(DestReg, AArch64::hsub,
6244 &AArch64::FPR64RegClass);
6245 MCRegister SrcRegD = RI.getMatchingSuperReg(SrcReg, AArch64::hsub,
6246 &AArch64::FPR64RegClass);
6255 DestReg = RI.getMatchingSuperReg(DestReg, AArch64::hsub,
6256 &AArch64::FPR32RegClass);
6257 SrcReg = RI.getMatchingSuperReg(SrcReg, AArch64::hsub,
6258 &AArch64::FPR32RegClass);
6265 if (AArch64::FPR8RegClass.
contains(DestReg) &&
6266 AArch64::FPR8RegClass.
contains(SrcReg)) {
6267 if (Subtarget.hasZeroCycleRegMoveFPR128() &&
6268 !Subtarget.hasZeroCycleRegMoveFPR64() &&
6269 !Subtarget.hasZeroCycleRegMoveFPR32() && Subtarget.isNeonAvailable() &&
6271 MCRegister DestRegQ = RI.getMatchingSuperReg(DestReg, AArch64::bsub,
6272 &AArch64::FPR128RegClass);
6273 MCRegister SrcRegQ = RI.getMatchingSuperReg(SrcReg, AArch64::bsub,
6274 &AArch64::FPR128RegClass);
6283 }
else if (Subtarget.hasZeroCycleRegMoveFPR64() &&
6284 !Subtarget.hasZeroCycleRegMoveFPR32()) {
6285 MCRegister DestRegD = RI.getMatchingSuperReg(DestReg, AArch64::bsub,
6286 &AArch64::FPR64RegClass);
6287 MCRegister SrcRegD = RI.getMatchingSuperReg(SrcReg, AArch64::bsub,
6288 &AArch64::FPR64RegClass);
6297 DestReg = RI.getMatchingSuperReg(DestReg, AArch64::bsub,
6298 &AArch64::FPR32RegClass);
6299 SrcReg = RI.getMatchingSuperReg(SrcReg, AArch64::bsub,
6300 &AArch64::FPR32RegClass);
6308 if (AArch64::FPR64RegClass.
contains(DestReg) &&
6309 AArch64::GPR64RegClass.
contains(SrcReg)) {
6310 if (AArch64::XZR == SrcReg) {
6318 if (AArch64::GPR64RegClass.
contains(DestReg) &&
6319 AArch64::FPR64RegClass.
contains(SrcReg)) {
6325 if (AArch64::FPR32RegClass.
contains(DestReg) &&
6326 AArch64::GPR32RegClass.
contains(SrcReg)) {
6327 if (AArch64::WZR == SrcReg) {
6335 if (AArch64::GPR32RegClass.
contains(DestReg) &&
6336 AArch64::FPR32RegClass.
contains(SrcReg)) {
6342 if (DestReg == AArch64::NZCV) {
6343 assert(AArch64::GPR64RegClass.
contains(SrcReg) &&
"Invalid NZCV copy");
6345 .
addImm(AArch64SysReg::NZCV)
6351 if (SrcReg == AArch64::NZCV) {
6352 assert(AArch64::GPR64RegClass.
contains(DestReg) &&
"Invalid NZCV copy");
6354 .
addImm(AArch64SysReg::NZCV)
6360 errs() << RI.getRegAsmName(DestReg) <<
" = COPY " << RI.getRegAsmName(SrcReg)
6371 unsigned SubIdx0,
unsigned SubIdx1,
int FI,
6376 SrcReg0 =
TRI.getSubReg(SrcReg, SubIdx0);
6378 SrcReg1 =
TRI.getSubReg(SrcReg, SubIdx1);
6391 Register SrcReg,
bool isKill,
int FI,
6406 switch (RI.getSpillSize(*RC)) {
6408 if (AArch64::FPR8RegClass.hasSubClassEq(RC))
6409 Opc = AArch64::STRBui;
6412 if (AArch64::FPR16RegClass.hasSubClassEq(RC))
6413 Opc = AArch64::STRHui;
6414 else if (AArch64::PNRRegClass.hasSubClassEq(RC) ||
6415 AArch64::PPRRegClass.hasSubClassEq(RC)) {
6416 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6417 "Unexpected register store without SVE store instructions");
6418 Opc = AArch64::STR_PXI;
6424 if (AArch64::GPR32allRegClass.hasSubClassEq(RC)) {
6425 Opc = AArch64::STRWui;
6429 assert(SrcReg != AArch64::WSP);
6430 }
else if (AArch64::FPR32RegClass.hasSubClassEq(RC))
6431 Opc = AArch64::STRSui;
6432 else if (AArch64::PPR2RegClass.hasSubClassEq(RC)) {
6433 Opc = AArch64::STR_PPXI;
6438 if (AArch64::GPR64allRegClass.hasSubClassEq(RC)) {
6439 Opc = AArch64::STRXui;
6443 assert(SrcReg != AArch64::SP);
6444 }
else if (AArch64::FPR64RegClass.hasSubClassEq(RC)) {
6445 Opc = AArch64::STRDui;
6446 }
else if (AArch64::WSeqPairsClassRegClass.hasSubClassEq(RC)) {
6448 get(AArch64::STPWi), SrcReg, isKill,
6449 AArch64::sube32, AArch64::subo32, FI, MMO);
6454 if (AArch64::FPR128RegClass.hasSubClassEq(RC))
6455 Opc = AArch64::STRQui;
6456 else if (AArch64::DDRegClass.hasSubClassEq(RC)) {
6457 assert(Subtarget.hasNEON() &&
"Unexpected register store without NEON");
6458 Opc = AArch64::ST1Twov1d;
6460 }
else if (AArch64::XSeqPairsClassRegClass.hasSubClassEq(RC)) {
6462 get(AArch64::STPXi), SrcReg, isKill,
6463 AArch64::sube64, AArch64::subo64, FI, MMO);
6465 }
else if (AArch64::ZPRRegClass.hasSubClassEq(RC)) {
6466 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6467 "Unexpected register store without SVE store instructions");
6468 Opc = AArch64::STR_ZXI;
6473 if (AArch64::DDDRegClass.hasSubClassEq(RC)) {
6474 assert(Subtarget.hasNEON() &&
"Unexpected register store without NEON");
6475 Opc = AArch64::ST1Threev1d;
6480 if (AArch64::DDDDRegClass.hasSubClassEq(RC)) {
6481 assert(Subtarget.hasNEON() &&
"Unexpected register store without NEON");
6482 Opc = AArch64::ST1Fourv1d;
6484 }
else if (AArch64::QQRegClass.hasSubClassEq(RC)) {
6485 assert(Subtarget.hasNEON() &&
"Unexpected register store without NEON");
6486 Opc = AArch64::ST1Twov2d;
6488 }
else if (AArch64::ZPR2StridedOrContiguousRegClass.hasSubClassEq(RC)) {
6489 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6490 "Unexpected register store without SVE store instructions");
6491 Opc = AArch64::STR_ZZXI_STRIDED_CONTIGUOUS;
6493 }
else if (AArch64::ZPR2RegClass.hasSubClassEq(RC)) {
6494 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6495 "Unexpected register store without SVE store instructions");
6496 Opc = AArch64::STR_ZZXI;
6501 if (AArch64::QQQRegClass.hasSubClassEq(RC)) {
6502 assert(Subtarget.hasNEON() &&
"Unexpected register store without NEON");
6503 Opc = AArch64::ST1Threev2d;
6505 }
else if (AArch64::ZPR3RegClass.hasSubClassEq(RC)) {
6506 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6507 "Unexpected register store without SVE store instructions");
6508 Opc = AArch64::STR_ZZZXI;
6513 if (AArch64::QQQQRegClass.hasSubClassEq(RC)) {
6514 assert(Subtarget.hasNEON() &&
"Unexpected register store without NEON");
6515 Opc = AArch64::ST1Fourv2d;
6517 }
else if (AArch64::ZPR4StridedOrContiguousRegClass.hasSubClassEq(RC)) {
6518 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6519 "Unexpected register store without SVE store instructions");
6520 Opc = AArch64::STR_ZZZZXI_STRIDED_CONTIGUOUS;
6522 }
else if (AArch64::ZPR4RegClass.hasSubClassEq(RC)) {
6523 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6524 "Unexpected register store without SVE store instructions");
6525 Opc = AArch64::STR_ZZZZXI;
6530 assert(
Opc &&
"Unknown register class");
6541 MI.addMemOperand(MMO);
6548 Register DestReg,
unsigned SubIdx0,
6549 unsigned SubIdx1,
int FI,
6553 bool IsUndef =
true;
6555 DestReg0 =
TRI.getSubReg(DestReg, SubIdx0);
6557 DestReg1 =
TRI.getSubReg(DestReg, SubIdx1);
6586 switch (
TRI.getSpillSize(*RC)) {
6588 if (AArch64::FPR8RegClass.hasSubClassEq(RC))
6589 Opc = AArch64::LDRBui;
6592 bool IsPNR = AArch64::PNRRegClass.hasSubClassEq(RC);
6593 if (AArch64::FPR16RegClass.hasSubClassEq(RC))
6594 Opc = AArch64::LDRHui;
6595 else if (IsPNR || AArch64::PPRRegClass.hasSubClassEq(RC)) {
6596 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6597 "Unexpected register load without SVE load instructions");
6600 Opc = AArch64::LDR_PXI;
6606 if (AArch64::GPR32allRegClass.hasSubClassEq(RC)) {
6607 Opc = AArch64::LDRWui;
6611 assert(DestReg != AArch64::WSP);
6612 }
else if (AArch64::FPR32RegClass.hasSubClassEq(RC))
6613 Opc = AArch64::LDRSui;
6614 else if (AArch64::PPR2RegClass.hasSubClassEq(RC)) {
6615 Opc = AArch64::LDR_PPXI;
6620 if (AArch64::GPR64allRegClass.hasSubClassEq(RC)) {
6621 Opc = AArch64::LDRXui;
6625 assert(DestReg != AArch64::SP);
6626 }
else if (AArch64::FPR64RegClass.hasSubClassEq(RC)) {
6627 Opc = AArch64::LDRDui;
6628 }
else if (AArch64::WSeqPairsClassRegClass.hasSubClassEq(RC)) {
6630 get(AArch64::LDPWi), DestReg, AArch64::sube32,
6631 AArch64::subo32, FI, MMO);
6636 if (AArch64::FPR128RegClass.hasSubClassEq(RC))
6637 Opc = AArch64::LDRQui;
6638 else if (AArch64::DDRegClass.hasSubClassEq(RC)) {
6639 assert(Subtarget.hasNEON() &&
"Unexpected register load without NEON");
6640 Opc = AArch64::LD1Twov1d;
6642 }
else if (AArch64::XSeqPairsClassRegClass.hasSubClassEq(RC)) {
6644 get(AArch64::LDPXi), DestReg, AArch64::sube64,
6645 AArch64::subo64, FI, MMO);
6647 }
else if (AArch64::ZPRRegClass.hasSubClassEq(RC)) {
6648 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6649 "Unexpected register load without SVE load instructions");
6650 Opc = AArch64::LDR_ZXI;
6655 if (AArch64::DDDRegClass.hasSubClassEq(RC)) {
6656 assert(Subtarget.hasNEON() &&
"Unexpected register load without NEON");
6657 Opc = AArch64::LD1Threev1d;
6662 if (AArch64::DDDDRegClass.hasSubClassEq(RC)) {
6663 assert(Subtarget.hasNEON() &&
"Unexpected register load without NEON");
6664 Opc = AArch64::LD1Fourv1d;
6666 }
else if (AArch64::QQRegClass.hasSubClassEq(RC)) {
6667 assert(Subtarget.hasNEON() &&
"Unexpected register load without NEON");
6668 Opc = AArch64::LD1Twov2d;
6670 }
else if (AArch64::ZPR2StridedOrContiguousRegClass.hasSubClassEq(RC)) {
6671 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6672 "Unexpected register load without SVE load instructions");
6673 Opc = AArch64::LDR_ZZXI_STRIDED_CONTIGUOUS;
6675 }
else if (AArch64::ZPR2RegClass.hasSubClassEq(RC)) {
6676 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6677 "Unexpected register load without SVE load instructions");
6678 Opc = AArch64::LDR_ZZXI;
6683 if (AArch64::QQQRegClass.hasSubClassEq(RC)) {
6684 assert(Subtarget.hasNEON() &&
"Unexpected register load without NEON");
6685 Opc = AArch64::LD1Threev2d;
6687 }
else if (AArch64::ZPR3RegClass.hasSubClassEq(RC)) {
6688 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6689 "Unexpected register load without SVE load instructions");
6690 Opc = AArch64::LDR_ZZZXI;
6695 if (AArch64::QQQQRegClass.hasSubClassEq(RC)) {
6696 assert(Subtarget.hasNEON() &&
"Unexpected register load without NEON");
6697 Opc = AArch64::LD1Fourv2d;
6699 }
else if (AArch64::ZPR4StridedOrContiguousRegClass.hasSubClassEq(RC)) {
6700 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6701 "Unexpected register load without SVE load instructions");
6702 Opc = AArch64::LDR_ZZZZXI_STRIDED_CONTIGUOUS;
6704 }
else if (AArch64::ZPR4RegClass.hasSubClassEq(RC)) {
6705 assert(Subtarget.isSVEorStreamingSVEAvailable() &&
6706 "Unexpected register load without SVE load instructions");
6707 Opc = AArch64::LDR_ZZZZXI;
6713 assert(
Opc &&
"Unknown register class");
6723 MI.addMemOperand(MMO);
6730 UseMI.getIterator()),
6732 return I.modifiesRegister(AArch64::NZCV, TRI) ||
6733 I.readsRegister(AArch64::NZCV, TRI);
6737void AArch64InstrInfo::decomposeStackOffsetForDwarfOffsets(
6742 assert(
Offset.getScalable() % 2 == 0 &&
"Invalid frame offset");
6749 ByteSized =
Offset.getFixed();
6750 VGSized =
Offset.getScalable() / 2;
6756void AArch64InstrInfo::decomposeStackOffsetForFrameOffsets(
6758 int64_t &NumDataVectors) {
6762 assert(
Offset.getScalable() % 2 == 0 &&
"Invalid frame offset");
6764 NumBytes =
Offset.getFixed();
6766 NumPredicateVectors =
Offset.getScalable() / 2;
6771 if (NumPredicateVectors % 8 == 0 || NumPredicateVectors < -64 ||
6772 NumPredicateVectors > 62) {
6773 NumDataVectors = NumPredicateVectors / 8;
6774 NumPredicateVectors -= NumDataVectors * 8;
6800 Expr.
push_back((
char)dwarf::DW_OP_bregx);
6808 int64_t OffsetFromDefCFA) {
6822 Comment << (NumBytes < 0 ?
" - " :
" + ") << std::abs(NumBytes);
6823 if (!RegScale.empty())
6833 int64_t NumBytes, NumVGScaledBytes;
6834 AArch64InstrInfo::decomposeStackOffsetForDwarfOffsets(
Offset, NumBytes,
6836 std::string CommentBuffer;
6839 if (
Reg == AArch64::SP)
6841 else if (
Reg == AArch64::FP)
6848 unsigned DwarfReg =
TRI.getDwarfRegNum(
Reg,
true);
6849 assert(DwarfReg <= 31 &&
"DwarfReg out of bounds (0..31)");
6851 Expr.
push_back(dwarf::DW_OP_breg0 + DwarfReg);
6854 if (NumVGScaledBytes) {
6864 DefCfaExpr.
push_back(dwarf::DW_CFA_def_cfa_expression);
6872 unsigned FrameReg,
unsigned Reg,
6874 bool LastAdjustmentWasScalable) {
6875 if (
Offset.getScalable())
6878 if (FrameReg == Reg && !LastAdjustmentWasScalable)
6881 unsigned DwarfReg =
TRI.getDwarfRegNum(Reg,
true);
6888 std::optional<int64_t> IncomingVGOffsetFromDefCFA) {
6889 int64_t NumBytes, NumVGScaledBytes;
6890 AArch64InstrInfo::decomposeStackOffsetForDwarfOffsets(
6891 OffsetFromDefCFA, NumBytes, NumVGScaledBytes);
6893 unsigned DwarfReg =
TRI.getDwarfRegNum(Reg,
true);
6896 if (!NumVGScaledBytes)
6899 std::string CommentBuffer;
6904 assert(NumVGScaledBytes &&
"Expected scalable offset");
6908 if (IncomingVGOffsetFromDefCFA) {
6910 VGRegScale =
"* IncomingVG";
6913 VGRegScale =
"* VG";
6917 OffsetExpr.
push_back(dwarf::DW_OP_plus);
6926 CfaExpr.
push_back(dwarf::DW_CFA_expression);
6941 unsigned SrcReg, int64_t
Offset,
unsigned Opc,
6944 bool *HasWinCFI,
bool EmitCFAOffset,
6947 unsigned MaxEncoding, ShiftSize;
6949 case AArch64::ADDXri:
6950 case AArch64::ADDSXri:
6951 case AArch64::SUBXri:
6952 case AArch64::SUBSXri:
6953 MaxEncoding = 0xfff;
6956 case AArch64::ADDVL_XXI:
6957 case AArch64::ADDPL_XXI:
6958 case AArch64::ADDSVL_XXI:
6959 case AArch64::ADDSPL_XXI:
6974 if (
Opc == AArch64::ADDVL_XXI ||
Opc == AArch64::ADDSVL_XXI)
6976 else if (
Opc == AArch64::ADDPL_XXI ||
Opc == AArch64::ADDSPL_XXI)
6990 const unsigned MaxEncodableValue = MaxEncoding << ShiftSize;
6992 if (TmpReg == AArch64::XZR)
6993 TmpReg =
MBB.getParent()->getRegInfo().createVirtualRegister(
6994 &AArch64::GPR64RegClass);
6996 uint64_t ThisVal = std::min<uint64_t>(
Offset, MaxEncodableValue);
6997 unsigned LocalShiftSize = 0;
6998 if (ThisVal > MaxEncoding) {
6999 ThisVal = ThisVal >> ShiftSize;
7000 LocalShiftSize = ShiftSize;
7002 assert((ThisVal >> ShiftSize) <= MaxEncoding &&
7003 "Encoding cannot handle value that big");
7005 Offset -= ThisVal << LocalShiftSize;
7010 .
addImm(Sign * (
int)ThisVal);
7020 if (Sign == -1 ||
Opc == AArch64::SUBXri ||
Opc == AArch64::SUBSXri)
7021 CFAOffset += Change;
7023 CFAOffset -= Change;
7024 if (EmitCFAOffset && DestReg == TmpReg) {
7037 int Imm = (int)(ThisVal << LocalShiftSize);
7038 if (VScale != 1 && DestReg == AArch64::SP) {
7044 }
else if ((DestReg == AArch64::FP && SrcReg == AArch64::SP) ||
7045 (SrcReg == AArch64::FP && DestReg == AArch64::SP)) {
7046 assert(VScale == 1 &&
"Expected non-scalable operation");
7055 assert(
Offset == 0 &&
"Expected remaining offset to be zero to "
7056 "emit a single SEH directive");
7057 }
else if (DestReg == AArch64::SP) {
7058 assert(VScale == 1 &&
"Expected non-scalable operation");
7061 assert(SrcReg == AArch64::SP &&
"Unexpected SrcReg for SEH_StackAlloc");
7074 unsigned DestReg,
unsigned SrcReg,
7077 bool NeedsWinCFI,
bool *HasWinCFI,
7079 unsigned FrameReg) {
7086 bool UseSVL =
F.hasFnAttribute(
"aarch64_pstate_sm_body");
7088 int64_t Bytes, NumPredicateVectors, NumDataVectors;
7089 AArch64InstrInfo::decomposeStackOffsetForFrameOffsets(
7090 Offset, Bytes, NumPredicateVectors, NumDataVectors);
7093 bool NeedsFinalDefNZCV = SetNZCV && (NumPredicateVectors || NumDataVectors);
7094 if (NeedsFinalDefNZCV)
7098 if (Bytes || (!
Offset && SrcReg != DestReg)) {
7099 assert((DestReg != AArch64::SP || Bytes % 8 == 0) &&
7100 "SP increment/decrement not 8-byte aligned");
7101 unsigned Opc = SetNZCV ? AArch64::ADDSXri : AArch64::ADDXri;
7104 Opc = SetNZCV ? AArch64::SUBSXri : AArch64::SUBXri;
7107 NeedsWinCFI, HasWinCFI, EmitCFAOffset, CFAOffset,
7109 CFAOffset += (
Opc == AArch64::ADDXri ||
Opc == AArch64::ADDSXri)
7116 assert(!(NeedsWinCFI && NumPredicateVectors) &&
7117 "WinCFI can't allocate fractions of an SVE data vector");
7119 if (NumDataVectors) {
7121 UseSVL ? AArch64::ADDSVL_XXI : AArch64::ADDVL_XXI,
TII,
7122 Flag, NeedsWinCFI, HasWinCFI, EmitCFAOffset, CFAOffset,
7128 if (NumPredicateVectors) {
7129 assert(DestReg != AArch64::SP &&
"Unaligned access to SP");
7131 UseSVL ? AArch64::ADDSPL_XXI : AArch64::ADDPL_XXI,
TII,
7132 Flag, NeedsWinCFI, HasWinCFI, EmitCFAOffset, CFAOffset,
7136 if (NeedsFinalDefNZCV)
7158 if (
MI.isFullCopy()) {
7161 if (SrcReg == AArch64::SP && DstReg.
isVirtual()) {
7165 if (DstReg == AArch64::SP && SrcReg.
isVirtual()) {
7170 if (SrcReg == AArch64::NZCV || DstReg == AArch64::NZCV)
7198 if (
MI.isCopy() &&
Ops.size() == 1 &&
7200 (
Ops[0] == 0 ||
Ops[0] == 1)) {
7201 bool IsSpill =
Ops[0] == 0;
7202 bool IsFill = !IsSpill;
7214 :
TRI.getMinimalPhysRegClass(Reg);
7220 "Mismatched register size in non subreg COPY");
7227 return &*--InsertPt;
7239 if (IsSpill && DstMO.
isUndef() && SrcReg == AArch64::WZR &&
7242 "Unexpected subreg on physical register");
7244 FrameIndex, &AArch64::GPR64RegClass,
Register());
7245 return &*--InsertPt;
7262 case AArch64::sub_32:
7263 if (AArch64::GPR64RegClass.hasSubClassEq(
getRegClass(DstReg)))
7264 FillRC = &AArch64::GPR32RegClass;
7267 FillRC = &AArch64::FPR32RegClass;
7270 FillRC = &AArch64::FPR64RegClass;
7276 TRI.getRegSizeInBits(*FillRC) &&
7277 "Mismatched regclass size on folded subreg COPY");
7296 bool *OutUseUnscaledOp,
7297 unsigned *OutUnscaledOp,
7298 int64_t *EmittableOffset) {
7300 if (EmittableOffset)
7301 *EmittableOffset = 0;
7302 if (OutUseUnscaledOp)
7303 *OutUseUnscaledOp =
false;
7309 switch (
MI.getOpcode()) {
7312 case AArch64::LD1Rv1d:
7313 case AArch64::LD1Rv2s:
7314 case AArch64::LD1Rv2d:
7315 case AArch64::LD1Rv4h:
7316 case AArch64::LD1Rv4s:
7317 case AArch64::LD1Rv8b:
7318 case AArch64::LD1Rv8h:
7319 case AArch64::LD1Rv16b:
7320 case AArch64::LD1Twov2d:
7321 case AArch64::LD1Threev2d:
7322 case AArch64::LD1Fourv2d:
7323 case AArch64::LD1Twov1d:
7324 case AArch64::LD1Threev1d:
7325 case AArch64::LD1Fourv1d:
7326 case AArch64::ST1Twov2d:
7327 case AArch64::ST1Threev2d:
7328 case AArch64::ST1Fourv2d:
7329 case AArch64::ST1Twov1d:
7330 case AArch64::ST1Threev1d:
7331 case AArch64::ST1Fourv1d:
7332 case AArch64::ST1i8:
7333 case AArch64::ST1i16:
7334 case AArch64::ST1i32:
7335 case AArch64::ST1i64:
7337 case AArch64::IRGstack:
7338 case AArch64::STGloop:
7339 case AArch64::STZGloop:
7344 TypeSize ScaleValue(0U,
false), Width(0U,
false);
7345 int64_t MinOff, MaxOff;
7351 bool IsMulVL = ScaleValue.isScalable();
7352 unsigned Scale = ScaleValue.getKnownMinValue();
7362 std::optional<unsigned> UnscaledOp =
7364 bool useUnscaledOp = UnscaledOp && (
Offset % Scale ||
Offset < 0);
7365 if (useUnscaledOp &&
7370 Scale = ScaleValue.getKnownMinValue();
7371 assert(IsMulVL == ScaleValue.isScalable() &&
7372 "Unscaled opcode has different value for scalable");
7374 int64_t Remainder =
Offset % Scale;
7375 assert(!(Remainder && useUnscaledOp) &&
7376 "Cannot have remainder when using unscaled op");
7378 assert(MinOff < MaxOff &&
"Unexpected Min/Max offsets");
7379 int64_t NewOffset =
Offset / Scale;
7380 if (MinOff <= NewOffset && NewOffset <= MaxOff)
7388 int64_t HighPart =
Offset & ~0xFFF;
7389 int64_t LowPart =
Offset & 0xFFF;
7390 int64_t LowScaled = LowPart / Scale;
7391 if (!IsMulVL && NewOffset >= 0 && LowPart % Scale == 0 &&
7392 MinOff <= LowScaled && LowScaled <= MaxOff &&
7394 NewOffset = LowScaled;
7399 NewOffset = NewOffset < 0 ? MinOff : MaxOff;
7404 if (EmittableOffset)
7405 *EmittableOffset = NewOffset;
7406 if (OutUseUnscaledOp)
7407 *OutUseUnscaledOp = useUnscaledOp;
7408 if (OutUnscaledOp && UnscaledOp)
7409 *OutUnscaledOp = *UnscaledOp;
7422 unsigned Opcode =
MI.getOpcode();
7423 unsigned ImmIdx = FrameRegIdx + 1;
7425 if (Opcode == AArch64::ADDSXri || Opcode == AArch64::ADDXri) {
7430 MI.eraseFromParent();
7436 unsigned UnscaledOp;
7439 &UnscaledOp, &NewOffset);
7443 MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg,
false);
7445 MI.setDesc(
TII->get(UnscaledOp));
7447 MI.getOperand(ImmIdx).ChangeToImmediate(NewOffset);
7463bool AArch64InstrInfo::useMachineCombiner()
const {
return true; }
7468 case AArch64::ADDSWrr:
7469 case AArch64::ADDSWri:
7470 case AArch64::ADDSXrr:
7471 case AArch64::ADDSXri:
7472 case AArch64::SUBSWrr:
7473 case AArch64::SUBSXrr:
7475 case AArch64::SUBSWri:
7476 case AArch64::SUBSXri:
7487 case AArch64::ADDWrr:
7488 case AArch64::ADDWri:
7489 case AArch64::SUBWrr:
7490 case AArch64::ADDSWrr:
7491 case AArch64::ADDSWri:
7492 case AArch64::SUBSWrr:
7494 case AArch64::SUBWri:
7495 case AArch64::SUBSWri:
7506 case AArch64::ADDXrr:
7507 case AArch64::ADDXri:
7508 case AArch64::SUBXrr:
7509 case AArch64::ADDSXrr:
7510 case AArch64::ADDSXri:
7511 case AArch64::SUBSXrr:
7513 case AArch64::SUBXri:
7514 case AArch64::SUBSXri:
7515 case AArch64::ADDv8i8:
7516 case AArch64::ADDv16i8:
7517 case AArch64::ADDv4i16:
7518 case AArch64::ADDv8i16:
7519 case AArch64::ADDv2i32:
7520 case AArch64::ADDv4i32:
7521 case AArch64::SUBv8i8:
7522 case AArch64::SUBv16i8:
7523 case AArch64::SUBv4i16:
7524 case AArch64::SUBv8i16:
7525 case AArch64::SUBv2i32:
7526 case AArch64::SUBv4i32:
7539 case AArch64::FADDHrr:
7540 case AArch64::FADDSrr:
7541 case AArch64::FADDDrr:
7542 case AArch64::FADDv4f16:
7543 case AArch64::FADDv8f16:
7544 case AArch64::FADDv2f32:
7545 case AArch64::FADDv2f64:
7546 case AArch64::FADDv4f32:
7547 case AArch64::FSUBHrr:
7548 case AArch64::FSUBSrr:
7549 case AArch64::FSUBDrr:
7550 case AArch64::FSUBv4f16:
7551 case AArch64::FSUBv8f16:
7552 case AArch64::FSUBv2f32:
7553 case AArch64::FSUBv2f64:
7554 case AArch64::FSUBv4f32:
7573 unsigned CombineOpc,
unsigned ZeroReg = 0,
7574 bool CheckZeroReg =
false) {
7581 if (!
MI ||
MI->getParent() != &
MBB ||
MI->getOpcode() != CombineOpc)
7588 assert(
MI->getNumOperands() >= 4 &&
MI->getOperand(0).isReg() &&
7589 MI->getOperand(1).isReg() &&
MI->getOperand(2).isReg() &&
7590 MI->getOperand(3).isReg() &&
"MAdd/MSub must have a least 4 regs");
7592 if (
MI->getOperand(3).getReg() != ZeroReg)
7597 MI->findRegisterDefOperandIdx(AArch64::NZCV,
nullptr,
true) == -1)
7606 unsigned MulOpc,
unsigned ZeroReg) {
7621bool AArch64InstrInfo::isAssociativeAndCommutative(
const MachineInstr &Inst,
7622 bool Invert)
const {
7628 case AArch64::FADDHrr:
7629 case AArch64::FADDSrr:
7630 case AArch64::FADDDrr:
7631 case AArch64::FMULHrr:
7632 case AArch64::FMULSrr:
7633 case AArch64::FMULDrr:
7634 case AArch64::FMULX16:
7635 case AArch64::FMULX32:
7636 case AArch64::FMULX64:
7638 case AArch64::FADDv4f16:
7639 case AArch64::FADDv8f16:
7640 case AArch64::FADDv2f32:
7641 case AArch64::FADDv4f32:
7642 case AArch64::FADDv2f64:
7643 case AArch64::FMULv4f16:
7644 case AArch64::FMULv8f16:
7645 case AArch64::FMULv2f32:
7646 case AArch64::FMULv4f32:
7647 case AArch64::FMULv2f64:
7648 case AArch64::FMULXv4f16:
7649 case AArch64::FMULXv8f16:
7650 case AArch64::FMULXv2f32:
7651 case AArch64::FMULXv4f32:
7652 case AArch64::FMULXv2f64:
7656 case AArch64::FADD_ZZZ_H:
7657 case AArch64::FADD_ZZZ_S:
7658 case AArch64::FADD_ZZZ_D:
7659 case AArch64::FMUL_ZZZ_H:
7660 case AArch64::FMUL_ZZZ_S:
7661 case AArch64::FMUL_ZZZ_D:
7672 case AArch64::ADDWrr:
7673 case AArch64::ADDXrr:
7674 case AArch64::ANDWrr:
7675 case AArch64::ANDXrr:
7676 case AArch64::ORRWrr:
7677 case AArch64::ORRXrr:
7678 case AArch64::EORWrr:
7679 case AArch64::EORXrr:
7680 case AArch64::EONWrr:
7681 case AArch64::EONXrr:
7685 case AArch64::ADDv8i8:
7686 case AArch64::ADDv16i8:
7687 case AArch64::ADDv4i16:
7688 case AArch64::ADDv8i16:
7689 case AArch64::ADDv2i32:
7690 case AArch64::ADDv4i32:
7691 case AArch64::ADDv1i64:
7692 case AArch64::ADDv2i64:
7693 case AArch64::MULv8i8:
7694 case AArch64::MULv16i8:
7695 case AArch64::MULv4i16:
7696 case AArch64::MULv8i16:
7697 case AArch64::MULv2i32:
7698 case AArch64::MULv4i32:
7699 case AArch64::ANDv8i8:
7700 case AArch64::ANDv16i8:
7701 case AArch64::ORRv8i8:
7702 case AArch64::ORRv16i8:
7703 case AArch64::EORv8i8:
7704 case AArch64::EORv16i8:
7706 case AArch64::ADD_ZZZ_B:
7707 case AArch64::ADD_ZZZ_H:
7708 case AArch64::ADD_ZZZ_S:
7709 case AArch64::ADD_ZZZ_D:
7710 case AArch64::MUL_ZZZ_B:
7711 case AArch64::MUL_ZZZ_H:
7712 case AArch64::MUL_ZZZ_S:
7713 case AArch64::MUL_ZZZ_D:
7714 case AArch64::AND_ZZZ:
7715 case AArch64::ORR_ZZZ:
7716 case AArch64::EOR_ZZZ:
7747 auto setFound = [&](
int Opcode,
int Operand,
unsigned ZeroReg,
7755 auto setVFound = [&](
int Opcode,
int Operand,
unsigned Pattern) {
7767 case AArch64::ADDWrr:
7769 "ADDWrr does not have register operands");
7770 setFound(AArch64::MADDWrrr, 1, AArch64::WZR, MCP::MULADDW_OP1);
7771 setFound(AArch64::MADDWrrr, 2, AArch64::WZR, MCP::MULADDW_OP2);
7773 case AArch64::ADDXrr:
7774 setFound(AArch64::MADDXrrr, 1, AArch64::XZR, MCP::MULADDX_OP1);
7775 setFound(AArch64::MADDXrrr, 2, AArch64::XZR, MCP::MULADDX_OP2);
7777 case AArch64::SUBWrr:
7778 setFound(AArch64::MADDWrrr, 2, AArch64::WZR, MCP::MULSUBW_OP2);
7779 setFound(AArch64::MADDWrrr, 1, AArch64::WZR, MCP::MULSUBW_OP1);
7781 case AArch64::SUBXrr:
7782 setFound(AArch64::MADDXrrr, 2, AArch64::XZR, MCP::MULSUBX_OP2);
7783 setFound(AArch64::MADDXrrr, 1, AArch64::XZR, MCP::MULSUBX_OP1);
7785 case AArch64::ADDWri:
7786 setFound(AArch64::MADDWrrr, 1, AArch64::WZR, MCP::MULADDWI_OP1);
7788 case AArch64::ADDXri:
7789 setFound(AArch64::MADDXrrr, 1, AArch64::XZR, MCP::MULADDXI_OP1);
7791 case AArch64::SUBWri:
7792 setFound(AArch64::MADDWrrr, 1, AArch64::WZR, MCP::MULSUBWI_OP1);
7794 case AArch64::SUBXri:
7795 setFound(AArch64::MADDXrrr, 1, AArch64::XZR, MCP::MULSUBXI_OP1);
7797 case AArch64::ADDv8i8:
7798 setVFound(AArch64::MULv8i8, 1, MCP::MULADDv8i8_OP1);
7799 setVFound(AArch64::MULv8i8, 2, MCP::MULADDv8i8_OP2);
7801 case AArch64::ADDv16i8:
7802 setVFound(AArch64::MULv16i8, 1, MCP::MULADDv16i8_OP1);
7803 setVFound(AArch64::MULv16i8, 2, MCP::MULADDv16i8_OP2);
7805 case AArch64::ADDv4i16:
7806 setVFound(AArch64::MULv4i16, 1, MCP::MULADDv4i16_OP1);
7807 setVFound(AArch64::MULv4i16, 2, MCP::MULADDv4i16_OP2);
7808 setVFound(AArch64::MULv4i16_indexed, 1, MCP::MULADDv4i16_indexed_OP1);
7809 setVFound(AArch64::MULv4i16_indexed, 2, MCP::MULADDv4i16_indexed_OP2);
7811 case AArch64::ADDv8i16:
7812 setVFound(AArch64::MULv8i16, 1, MCP::MULADDv8i16_OP1);
7813 setVFound(AArch64::MULv8i16, 2, MCP::MULADDv8i16_OP2);
7814 setVFound(AArch64::MULv8i16_indexed, 1, MCP::MULADDv8i16_indexed_OP1);
7815 setVFound(AArch64::MULv8i16_indexed, 2, MCP::MULADDv8i16_indexed_OP2);
7817 case AArch64::ADDv2i32:
7818 setVFound(AArch64::MULv2i32, 1, MCP::MULADDv2i32_OP1);
7819 setVFound(AArch64::MULv2i32, 2, MCP::MULADDv2i32_OP2);
7820 setVFound(AArch64::MULv2i32_indexed, 1, MCP::MULADDv2i32_indexed_OP1);
7821 setVFound(AArch64::MULv2i32_indexed, 2, MCP::MULADDv2i32_indexed_OP2);
7823 case AArch64::ADDv4i32:
7824 setVFound(AArch64::MULv4i32, 1, MCP::MULADDv4i32_OP1);
7825 setVFound(AArch64::MULv4i32, 2, MCP::MULADDv4i32_OP2);
7826 setVFound(AArch64::MULv4i32_indexed, 1, MCP::MULADDv4i32_indexed_OP1);
7827 setVFound(AArch64::MULv4i32_indexed, 2, MCP::MULADDv4i32_indexed_OP2);
7829 case AArch64::SUBv8i8:
7830 setVFound(AArch64::MULv8i8, 1, MCP::MULSUBv8i8_OP1);
7831 setVFound(AArch64::MULv8i8, 2, MCP::MULSUBv8i8_OP2);
7833 case AArch64::SUBv16i8:
7834 setVFound(AArch64::MULv16i8, 1, MCP::MULSUBv16i8_OP1);
7835 setVFound(AArch64::MULv16i8, 2, MCP::MULSUBv16i8_OP2);
7837 case AArch64::SUBv4i16:
7838 setVFound(AArch64::MULv4i16, 1, MCP::MULSUBv4i16_OP1);
7839 setVFound(AArch64::MULv4i16, 2, MCP::MULSUBv4i16_OP2);
7840 setVFound(AArch64::MULv4i16_indexed, 1, MCP::MULSUBv4i16_indexed_OP1);
7841 setVFound(AArch64::MULv4i16_indexed, 2, MCP::MULSUBv4i16_indexed_OP2);
7843 case AArch64::SUBv8i16:
7844 setVFound(AArch64::MULv8i16, 1, MCP::MULSUBv8i16_OP1);
7845 setVFound(AArch64::MULv8i16, 2, MCP::MULSUBv8i16_OP2);
7846 setVFound(AArch64::MULv8i16_indexed, 1, MCP::MULSUBv8i16_indexed_OP1);
7847 setVFound(AArch64::MULv8i16_indexed, 2, MCP::MULSUBv8i16_indexed_OP2);
7849 case AArch64::SUBv2i32:
7850 setVFound(AArch64::MULv2i32, 1, MCP::MULSUBv2i32_OP1);
7851 setVFound(AArch64::MULv2i32, 2, MCP::MULSUBv2i32_OP2);
7852 setVFound(AArch64::MULv2i32_indexed, 1, MCP::MULSUBv2i32_indexed_OP1);
7853 setVFound(AArch64::MULv2i32_indexed, 2, MCP::MULSUBv2i32_indexed_OP2);
7855 case AArch64::SUBv4i32:
7856 setVFound(AArch64::MULv4i32, 1, MCP::MULSUBv4i32_OP1);
7857 setVFound(AArch64::MULv4i32, 2, MCP::MULSUBv4i32_OP2);
7858 setVFound(AArch64::MULv4i32_indexed, 1, MCP::MULSUBv4i32_indexed_OP1);
7859 setVFound(AArch64::MULv4i32_indexed, 2, MCP::MULSUBv4i32_indexed_OP2);
7865bool AArch64InstrInfo::isAccumulationOpcode(
unsigned Opcode)
const {
7869 case AArch64::UABALB_ZZZ_D:
7870 case AArch64::UABALB_ZZZ_H:
7871 case AArch64::UABALB_ZZZ_S:
7872 case AArch64::UABALT_ZZZ_D:
7873 case AArch64::UABALT_ZZZ_H:
7874 case AArch64::UABALT_ZZZ_S:
7875 case AArch64::SABALB_ZZZ_D:
7876 case AArch64::SABALB_ZZZ_S:
7877 case AArch64::SABALB_ZZZ_H:
7878 case AArch64::SABALT_ZZZ_D:
7879 case AArch64::SABALT_ZZZ_S:
7880 case AArch64::SABALT_ZZZ_H:
7881 case AArch64::UABALv16i8_v8i16:
7882 case AArch64::UABALv2i32_v2i64:
7883 case AArch64::UABALv4i16_v4i32:
7884 case AArch64::UABALv4i32_v2i64:
7885 case AArch64::UABALv8i16_v4i32:
7886 case AArch64::UABALv8i8_v8i16:
7887 case AArch64::UABAv16i8:
7888 case AArch64::UABAv2i32:
7889 case AArch64::UABAv4i16:
7890 case AArch64::UABAv4i32:
7891 case AArch64::UABAv8i16:
7892 case AArch64::UABAv8i8:
7893 case AArch64::SABALv16i8_v8i16:
7894 case AArch64::SABALv2i32_v2i64:
7895 case AArch64::SABALv4i16_v4i32:
7896 case AArch64::SABALv4i32_v2i64:
7897 case AArch64::SABALv8i16_v4i32:
7898 case AArch64::SABALv8i8_v8i16:
7899 case AArch64::SABAv16i8:
7900 case AArch64::SABAv2i32:
7901 case AArch64::SABAv4i16:
7902 case AArch64::SABAv4i32:
7903 case AArch64::SABAv8i16:
7904 case AArch64::SABAv8i8:
7911unsigned AArch64InstrInfo::getAccumulationStartOpcode(
7912 unsigned AccumulationOpcode)
const {
7913 switch (AccumulationOpcode) {
7916 case AArch64::UABALB_ZZZ_D:
7917 return AArch64::UABDLB_ZZZ_D;
7918 case AArch64::UABALB_ZZZ_H:
7919 return AArch64::UABDLB_ZZZ_H;
7920 case AArch64::UABALB_ZZZ_S:
7921 return AArch64::UABDLB_ZZZ_S;
7922 case AArch64::UABALT_ZZZ_D:
7923 return AArch64::UABDLT_ZZZ_D;
7924 case AArch64::UABALT_ZZZ_H:
7925 return AArch64::UABDLT_ZZZ_H;
7926 case AArch64::UABALT_ZZZ_S:
7927 return AArch64::UABDLT_ZZZ_S;
7928 case AArch64::UABALv16i8_v8i16:
7929 return AArch64::UABDLv16i8_v8i16;
7930 case AArch64::UABALv2i32_v2i64:
7931 return AArch64::UABDLv2i32_v2i64;
7932 case AArch64::UABALv4i16_v4i32:
7933 return AArch64::UABDLv4i16_v4i32;
7934 case AArch64::UABALv4i32_v2i64:
7935 return AArch64::UABDLv4i32_v2i64;
7936 case AArch64::UABALv8i16_v4i32:
7937 return AArch64::UABDLv8i16_v4i32;
7938 case AArch64::UABALv8i8_v8i16:
7939 return AArch64::UABDLv8i8_v8i16;
7940 case AArch64::UABAv16i8:
7941 return AArch64::UABDv16i8;
7942 case AArch64::UABAv2i32:
7943 return AArch64::UABDv2i32;
7944 case AArch64::UABAv4i16:
7945 return AArch64::UABDv4i16;
7946 case AArch64::UABAv4i32:
7947 return AArch64::UABDv4i32;
7948 case AArch64::UABAv8i16:
7949 return AArch64::UABDv8i16;
7950 case AArch64::UABAv8i8:
7951 return AArch64::UABDv8i8;
7952 case AArch64::SABALB_ZZZ_D:
7953 return AArch64::SABDLB_ZZZ_D;
7954 case AArch64::SABALB_ZZZ_S:
7955 return AArch64::SABDLB_ZZZ_S;
7956 case AArch64::SABALB_ZZZ_H:
7957 return AArch64::SABDLB_ZZZ_H;
7958 case AArch64::SABALT_ZZZ_D:
7959 return AArch64::SABDLT_ZZZ_D;
7960 case AArch64::SABALT_ZZZ_S:
7961 return AArch64::SABDLT_ZZZ_S;
7962 case AArch64::SABALT_ZZZ_H:
7963 return AArch64::SABDLT_ZZZ_H;
7964 case AArch64::SABALv16i8_v8i16:
7965 return AArch64::SABDLv16i8_v8i16;
7966 case AArch64::SABALv2i32_v2i64:
7967 return AArch64::SABDLv2i32_v2i64;
7968 case AArch64::SABALv4i16_v4i32:
7969 return AArch64::SABDLv4i16_v4i32;
7970 case AArch64::SABALv4i32_v2i64:
7971 return AArch64::SABDLv4i32_v2i64;
7972 case AArch64::SABALv8i16_v4i32:
7973 return AArch64::SABDLv8i16_v4i32;
7974 case AArch64::SABALv8i8_v8i16:
7975 return AArch64::SABDLv8i8_v8i16;
7976 case AArch64::SABAv16i8:
7977 return AArch64::SABDv16i8;
7978 case AArch64::SABAv2i32:
7979 return AArch64::SABAv2i32;
7980 case AArch64::SABAv4i16:
7981 return AArch64::SABDv4i16;
7982 case AArch64::SABAv4i32:
7983 return AArch64::SABDv4i32;
7984 case AArch64::SABAv8i16:
7985 return AArch64::SABDv8i16;
7986 case AArch64::SABAv8i8:
7987 return AArch64::SABDv8i8;
8003 auto Match = [&](
int Opcode,
int Operand,
unsigned Pattern) ->
bool {
8015 assert(
false &&
"Unsupported FP instruction in combiner\n");
8017 case AArch64::FADDHrr:
8019 "FADDHrr does not have register operands");
8021 Found = Match(AArch64::FMULHrr, 1, MCP::FMULADDH_OP1);
8022 Found |= Match(AArch64::FMULHrr, 2, MCP::FMULADDH_OP2);
8024 case AArch64::FADDSrr:
8026 "FADDSrr does not have register operands");
8028 Found |= Match(AArch64::FMULSrr, 1, MCP::FMULADDS_OP1) ||
8029 Match(AArch64::FMULv1i32_indexed, 1, MCP::FMLAv1i32_indexed_OP1);
8031 Found |= Match(AArch64::FMULSrr, 2, MCP::FMULADDS_OP2) ||
8032 Match(AArch64::FMULv1i32_indexed, 2, MCP::FMLAv1i32_indexed_OP2);
8034 case AArch64::FADDDrr:
8035 Found |= Match(AArch64::FMULDrr, 1, MCP::FMULADDD_OP1) ||
8036 Match(AArch64::FMULv1i64_indexed, 1, MCP::FMLAv1i64_indexed_OP1);
8038 Found |= Match(AArch64::FMULDrr, 2, MCP::FMULADDD_OP2) ||
8039 Match(AArch64::FMULv1i64_indexed, 2, MCP::FMLAv1i64_indexed_OP2);
8041 case AArch64::FADDv4f16:
8042 Found |= Match(AArch64::FMULv4i16_indexed, 1, MCP::FMLAv4i16_indexed_OP1) ||
8043 Match(AArch64::FMULv4f16, 1, MCP::FMLAv4f16_OP1);
8045 Found |= Match(AArch64::FMULv4i16_indexed, 2, MCP::FMLAv4i16_indexed_OP2) ||
8046 Match(AArch64::FMULv4f16, 2, MCP::FMLAv4f16_OP2);
8048 case AArch64::FADDv8f16:
8049 Found |= Match(AArch64::FMULv8i16_indexed, 1, MCP::FMLAv8i16_indexed_OP1) ||
8050 Match(AArch64::FMULv8f16, 1, MCP::FMLAv8f16_OP1);
8052 Found |= Match(AArch64::FMULv8i16_indexed, 2, MCP::FMLAv8i16_indexed_OP2) ||
8053 Match(AArch64::FMULv8f16, 2, MCP::FMLAv8f16_OP2);
8055 case AArch64::FADDv2f32:
8056 Found |= Match(AArch64::FMULv2i32_indexed, 1, MCP::FMLAv2i32_indexed_OP1) ||
8057 Match(AArch64::FMULv2f32, 1, MCP::FMLAv2f32_OP1);
8059 Found |= Match(AArch64::FMULv2i32_indexed, 2, MCP::FMLAv2i32_indexed_OP2) ||
8060 Match(AArch64::FMULv2f32, 2, MCP::FMLAv2f32_OP2);
8062 case AArch64::FADDv2f64:
8063 Found |= Match(AArch64::FMULv2i64_indexed, 1, MCP::FMLAv2i64_indexed_OP1) ||
8064 Match(AArch64::FMULv2f64, 1, MCP::FMLAv2f64_OP1);
8066 Found |= Match(AArch64::FMULv2i64_indexed, 2, MCP::FMLAv2i64_indexed_OP2) ||
8067 Match(AArch64::FMULv2f64, 2, MCP::FMLAv2f64_OP2);
8069 case AArch64::FADDv4f32:
8070 Found |= Match(AArch64::FMULv4i32_indexed, 1, MCP::FMLAv4i32_indexed_OP1) ||
8071 Match(AArch64::FMULv4f32, 1, MCP::FMLAv4f32_OP1);
8073 Found |= Match(AArch64::FMULv4i32_indexed, 2, MCP::FMLAv4i32_indexed_OP2) ||
8074 Match(AArch64::FMULv4f32, 2, MCP::FMLAv4f32_OP2);
8076 case AArch64::FSUBHrr:
8077 Found = Match(AArch64::FMULHrr, 1, MCP::FMULSUBH_OP1);
8078 Found |= Match(AArch64::FMULHrr, 2, MCP::FMULSUBH_OP2);
8079 Found |= Match(AArch64::FNMULHrr, 1, MCP::FNMULSUBH_OP1);
8081 case AArch64::FSUBSrr:
8082 Found = Match(AArch64::FMULSrr, 1, MCP::FMULSUBS_OP1);
8084 Found |= Match(AArch64::FMULSrr, 2, MCP::FMULSUBS_OP2) ||
8085 Match(AArch64::FMULv1i32_indexed, 2, MCP::FMLSv1i32_indexed_OP2);
8087 Found |= Match(AArch64::FNMULSrr, 1, MCP::FNMULSUBS_OP1);
8089 case AArch64::FSUBDrr:
8090 Found = Match(AArch64::FMULDrr, 1, MCP::FMULSUBD_OP1);
8092 Found |= Match(AArch64::FMULDrr, 2, MCP::FMULSUBD_OP2) ||
8093 Match(AArch64::FMULv1i64_indexed, 2, MCP::FMLSv1i64_indexed_OP2);
8095 Found |= Match(AArch64::FNMULDrr, 1, MCP::FNMULSUBD_OP1);
8097 case AArch64::FSUBv4f16:
8098 Found |= Match(AArch64::FMULv4i16_indexed, 2, MCP::FMLSv4i16_indexed_OP2) ||
8099 Match(AArch64::FMULv4f16, 2, MCP::FMLSv4f16_OP2);
8101 Found |= Match(AArch64::FMULv4i16_indexed, 1, MCP::FMLSv4i16_indexed_OP1) ||
8102 Match(AArch64::FMULv4f16, 1, MCP::FMLSv4f16_OP1);
8104 case AArch64::FSUBv8f16:
8105 Found |= Match(AArch64::FMULv8i16_indexed, 2, MCP::FMLSv8i16_indexed_OP2) ||
8106 Match(AArch64::FMULv8f16, 2, MCP::FMLSv8f16_OP2);
8108 Found |= Match(AArch64::FMULv8i16_indexed, 1, MCP::FMLSv8i16_indexed_OP1) ||
8109 Match(AArch64::FMULv8f16, 1, MCP::FMLSv8f16_OP1);
8111 case AArch64::FSUBv2f32:
8112 Found |= Match(AArch64::FMULv2i32_indexed, 2, MCP::FMLSv2i32_indexed_OP2) ||
8113 Match(AArch64::FMULv2f32, 2, MCP::FMLSv2f32_OP2);
8115 Found |= Match(AArch64::FMULv2i32_indexed, 1, MCP::FMLSv2i32_indexed_OP1) ||
8116 Match(AArch64::FMULv2f32, 1, MCP::FMLSv2f32_OP1);
8118 case AArch64::FSUBv2f64:
8119 Found |= Match(AArch64::FMULv2i64_indexed, 2, MCP::FMLSv2i64_indexed_OP2) ||
8120 Match(AArch64::FMULv2f64, 2, MCP::FMLSv2f64_OP2);
8122 Found |= Match(AArch64::FMULv2i64_indexed, 1, MCP::FMLSv2i64_indexed_OP1) ||
8123 Match(AArch64::FMULv2f64, 1, MCP::FMLSv2f64_OP1);
8125 case AArch64::FSUBv4f32:
8126 Found |= Match(AArch64::FMULv4i32_indexed, 2, MCP::FMLSv4i32_indexed_OP2) ||
8127 Match(AArch64::FMULv4f32, 2, MCP::FMLSv4f32_OP2);
8129 Found |= Match(AArch64::FMULv4i32_indexed, 1, MCP::FMLSv4i32_indexed_OP1) ||
8130 Match(AArch64::FMULv4f32, 1, MCP::FMLSv4f32_OP1);
8141 auto Match = [&](
unsigned Opcode,
int Operand,
unsigned Pattern) ->
bool {
8148 if (
MI &&
MI->getOpcode() == TargetOpcode::COPY &&
8149 MI->getOperand(1).getReg().isVirtual())
8151 if (
MI &&
MI->getOpcode() == Opcode) {
8163 case AArch64::FMULv2f32:
8164 Found = Match(AArch64::DUPv2i32lane, 1, MCP::FMULv2i32_indexed_OP1);
8165 Found |= Match(AArch64::DUPv2i32lane, 2, MCP::FMULv2i32_indexed_OP2);
8167 case AArch64::FMULv2f64:
8168 Found = Match(AArch64::DUPv2i64lane, 1, MCP::FMULv2i64_indexed_OP1);
8169 Found |= Match(AArch64::DUPv2i64lane, 2, MCP::FMULv2i64_indexed_OP2);
8171 case AArch64::FMULv4f16:
8172 Found = Match(AArch64::DUPv4i16lane, 1, MCP::FMULv4i16_indexed_OP1);
8173 Found |= Match(AArch64::DUPv4i16lane, 2, MCP::FMULv4i16_indexed_OP2);
8175 case AArch64::FMULv4f32:
8176 Found = Match(AArch64::DUPv4i32lane, 1, MCP::FMULv4i32_indexed_OP1);
8177 Found |= Match(AArch64::DUPv4i32lane, 2, MCP::FMULv4i32_indexed_OP2);
8179 case AArch64::FMULv8f16:
8180 Found = Match(AArch64::DUPv8i16lane, 1, MCP::FMULv8i16_indexed_OP1);
8181 Found |= Match(AArch64::DUPv8i16lane, 2, MCP::FMULv8i16_indexed_OP2);
8194 auto Match = [&](
unsigned Opcode,
unsigned Pattern) ->
bool {
8197 if (
MI !=
nullptr && (
MI->getOpcode() == Opcode) &&
8212 case AArch64::FNEGDr:
8214 case AArch64::FNEGSr:
8346 case AArch64::SUBWrr:
8347 case AArch64::SUBSWrr:
8348 case AArch64::SUBXrr:
8349 case AArch64::SUBSXrr:
8394 unsigned LoadLaneOpCode,
unsigned NumLanes) {
8417 while (!RemainingLanes.
empty() && CurrInstr &&
8418 CurrInstr->getOpcode() == LoadLaneOpCode &&
8420 CurrInstr->getNumOperands() == 4) {
8421 RemainingLanes.
erase(CurrInstr->getOperand(2).getImm());
8427 if (!RemainingLanes.
empty())
8431 if (CurrInstr->getOpcode() != TargetOpcode::SUBREG_TO_REG)
8435 auto Lane0LoadReg = CurrInstr->getOperand(1).getReg();
8436 unsigned SingleLaneSizeInBits = 128 / NumLanes;
8437 if (
TRI->getRegSizeInBits(Lane0LoadReg, MRI) != SingleLaneSizeInBits)
8453 RemainingLoadInstrs.
insert(LoadInstrs.
begin(), LoadInstrs.
end());
8456 for (; MBBItr !=
MBB->begin() && RemainingSteps > 0 &&
8457 !RemainingLoadInstrs.
empty();
8458 --MBBItr, --RemainingSteps) {
8462 RemainingLoadInstrs.
erase(&CurrInstr);
8472 if (RemainingSteps == 0 && !RemainingLoadInstrs.
empty())
8498 case AArch64::LD1i32:
8500 case AArch64::LD1i16:
8502 case AArch64::LD1i8:
8518 unsigned Pattern,
unsigned NumLanes) {
8526 for (
unsigned i = 0; i < NumLanes - 1; ++i) {
8534 return A->getOperand(2).getImm() >
B->getOperand(2).getImm();
8540 auto LoadToLaneInstrsAscending =
llvm::reverse(LoadToLaneInstrs);
8546 auto CreateLD1Instruction = [&](
MachineInstr *OriginalInstr,
8547 Register SrcRegister,
unsigned Lane,
8549 bool OffsetRegisterKillState) {
8558 InstrIdxForVirtReg.
insert(std::make_pair(NewRegister, InsInstrs.
size()));
8559 InsInstrs.
push_back(LoadIndexIntoRegister);
8565 auto CreateLDRInstruction =
8571 Opcode = AArch64::LDRSui;
8574 Opcode = AArch64::LDRHui;
8577 Opcode = AArch64::LDRBui;
8581 "Got unsupported number of lanes in machine-combiner gather pattern");
8591 auto LanesToLoadToReg0 =
8593 LoadToLaneInstrsAscending.begin() + NumLanes / 2);
8594 Register PrevReg = SubregToReg->getOperand(0).getReg();
8596 const MachineOperand &OffsetRegOperand = LoadInstr->getOperand(3);
8597 PrevReg = CreateLD1Instruction(LoadInstr, PrevReg, Index + 1,
8598 OffsetRegOperand.
getReg(),
8599 OffsetRegOperand.
isKill());
8606 MachineInstr *Lane0Load = *LoadToLaneInstrsAscending.begin();
8608 *std::next(LoadToLaneInstrsAscending.begin(), NumLanes / 2);
8615 CreateLDRInstruction(NumLanes, DestRegForMiddleIndex,
8616 OriginalSplitToLoadOffsetOperand.
getReg(),
8619 InstrIdxForVirtReg.
insert(
8620 std::make_pair(DestRegForMiddleIndex, InsInstrs.
size()));
8621 InsInstrs.
push_back(MiddleIndexLoadInstr);
8626 unsigned SubregType;
8629 SubregType = AArch64::ssub;
8632 SubregType = AArch64::hsub;
8635 SubregType = AArch64::bsub;
8639 "Got invalid NumLanes for machine-combiner gather pattern");
8642 auto SubRegToRegInstr =
8644 DestRegForSubregToReg)
8647 InstrIdxForVirtReg.
insert(
8648 std::make_pair(DestRegForSubregToReg, InsInstrs.
size()));
8652 auto LanesToLoadToReg1 =
8654 LoadToLaneInstrsAscending.end());
8655 PrevReg = SubRegToRegInstr->getOperand(0).getReg();
8657 const MachineOperand &OffsetRegOperand = LoadInstr->getOperand(3);
8658 PrevReg = CreateLD1Instruction(LoadInstr, PrevReg, Index + 1,
8659 OffsetRegOperand.
getReg(),
8660 OffsetRegOperand.
isKill());
8663 if (Index == NumLanes / 2 - 2) {
8698bool AArch64InstrInfo::getMachineCombinerPatterns(
8700 bool DoRegPressureReduce)
const {
8721 DoRegPressureReduce);
8750 const Register *ReplacedAddend =
nullptr) {
8751 assert(IdxMulOpd == 1 || IdxMulOpd == 2);
8753 unsigned IdxOtherOpd = IdxMulOpd == 1 ? 2 : 1;
8756 Register SrcReg0 = MUL->getOperand(1).getReg();
8757 bool Src0IsKill = MUL->getOperand(1).isKill();
8758 Register SrcReg1 = MUL->getOperand(2).getReg();
8759 bool Src1IsKill = MUL->getOperand(2).isKill();
8763 if (ReplacedAddend) {
8765 SrcReg2 = *ReplacedAddend;
8792 .
addImm(MUL->getOperand(3).getImm());
8799 assert(
false &&
"Invalid FMA instruction kind \n");
8813 if (AArch64::FPR32RegClass.hasSubClassEq(RC))
8814 Opc = AArch64::FNMADDSrrr;
8815 else if (AArch64::FPR64RegClass.hasSubClassEq(RC))
8816 Opc = AArch64::FNMADDDrrr;
8850 unsigned IdxDupOp,
unsigned MulOpc,
8852 assert(((IdxDupOp == 1) || (IdxDupOp == 2)) &&
8853 "Invalid index of FMUL operand");
8861 if (Dup->
getOpcode() == TargetOpcode::COPY)
8870 unsigned IdxMulOp = IdxDupOp == 1 ? 2 : 1;
8911 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
8926 genNeg(MF, MRI,
TII, Root, InsInstrs, InstrIdxForVirtReg, MnegOpc, RC);
8953 genNeg(MF, MRI,
TII, Root, InsInstrs, InstrIdxForVirtReg, MnegOpc, RC);
8981 unsigned IdxMulOpd,
unsigned MaddOpc,
unsigned VR,
8983 assert(IdxMulOpd == 1 || IdxMulOpd == 2);
8987 Register SrcReg0 = MUL->getOperand(1).getReg();
8988 bool Src0IsKill = MUL->getOperand(1).isKill();
8989 Register SrcReg1 = MUL->getOperand(2).getReg();
8990 bool Src1IsKill = MUL->getOperand(2).isKill();
9020 assert(IdxOpd1 == 1 || IdxOpd1 == 2);
9021 unsigned IdxOtherOpd = IdxOpd1 == 1 ? 2 : 1;
9035 if (Opcode == AArch64::SUBSWrr)
9036 Opcode = AArch64::SUBWrr;
9037 else if (Opcode == AArch64::SUBSXrr)
9038 Opcode = AArch64::SUBXrr;
9040 assert((Opcode == AArch64::SUBWrr || Opcode == AArch64::SUBXrr) &&
9041 "Unexpected instruction opcode.");
9058 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
9065unsigned AArch64InstrInfo::getReduceOpcodeForAccumulator(
9066 unsigned int AccumulatorOpCode)
const {
9067 switch (AccumulatorOpCode) {
9068 case AArch64::UABALB_ZZZ_D:
9069 case AArch64::SABALB_ZZZ_D:
9070 case AArch64::UABALT_ZZZ_D:
9071 case AArch64::SABALT_ZZZ_D:
9072 return AArch64::ADD_ZZZ_D;
9073 case AArch64::UABALB_ZZZ_H:
9074 case AArch64::SABALB_ZZZ_H:
9075 case AArch64::UABALT_ZZZ_H:
9076 case AArch64::SABALT_ZZZ_H:
9077 return AArch64::ADD_ZZZ_H;
9078 case AArch64::UABALB_ZZZ_S:
9079 case AArch64::SABALB_ZZZ_S:
9080 case AArch64::UABALT_ZZZ_S:
9081 case AArch64::SABALT_ZZZ_S:
9082 return AArch64::ADD_ZZZ_S;
9083 case AArch64::UABALv16i8_v8i16:
9084 case AArch64::SABALv8i8_v8i16:
9085 case AArch64::SABAv8i16:
9086 case AArch64::UABAv8i16:
9087 return AArch64::ADDv8i16;
9088 case AArch64::SABALv2i32_v2i64:
9089 case AArch64::UABALv2i32_v2i64:
9090 case AArch64::SABALv4i32_v2i64:
9091 return AArch64::ADDv2i64;
9092 case AArch64::UABALv4i16_v4i32:
9093 case AArch64::SABALv4i16_v4i32:
9094 case AArch64::SABALv8i16_v4i32:
9095 case AArch64::SABAv4i32:
9096 case AArch64::UABAv4i32:
9097 return AArch64::ADDv4i32;
9098 case AArch64::UABALv4i32_v2i64:
9099 return AArch64::ADDv2i64;
9100 case AArch64::UABALv8i16_v4i32:
9101 return AArch64::ADDv4i32;
9102 case AArch64::UABALv8i8_v8i16:
9103 case AArch64::SABALv16i8_v8i16:
9104 return AArch64::ADDv8i16;
9105 case AArch64::UABAv16i8:
9106 case AArch64::SABAv16i8:
9107 return AArch64::ADDv16i8;
9108 case AArch64::UABAv4i16:
9109 case AArch64::SABAv4i16:
9110 return AArch64::ADDv4i16;
9111 case AArch64::UABAv2i32:
9112 case AArch64::SABAv2i32:
9113 return AArch64::ADDv2i32;
9114 case AArch64::UABAv8i8:
9115 case AArch64::SABAv8i8:
9116 return AArch64::ADDv8i8;
9125void AArch64InstrInfo::genAlternativeCodeSequence(
9135 MachineInstr *
MUL =
nullptr;
9142 DelInstrs, InstrIdxForVirtReg);
9148 InstrIdxForVirtReg);
9154 InstrIdxForVirtReg);
9163 Opc = AArch64::MADDWrrr;
9164 RC = &AArch64::GPR32RegClass;
9166 Opc = AArch64::MADDXrrr;
9167 RC = &AArch64::GPR64RegClass;
9178 Opc = AArch64::MADDWrrr;
9179 RC = &AArch64::GPR32RegClass;
9181 Opc = AArch64::MADDXrrr;
9182 RC = &AArch64::GPR64RegClass;
9196 unsigned BitSize, MovImm;
9199 MovImm = AArch64::MOVi32imm;
9200 RC = &AArch64::GPR32spRegClass;
9202 Opc = AArch64::MADDWrrr;
9203 RC = &AArch64::GPR32RegClass;
9205 MovImm = AArch64::MOVi64imm;
9206 RC = &AArch64::GPR64spRegClass;
9208 Opc = AArch64::MADDXrrr;
9209 RC = &AArch64::GPR64RegClass;
9224 if (Insn.
size() != 1)
9226 MachineInstrBuilder MIB1 =
9227 BuildMI(MF, MIMetadata(Root),
TII->get(MovImm), NewVR)
9230 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
9242 unsigned SubOpc, ZeroReg;
9244 SubOpc = AArch64::SUBWrr;
9245 SubRC = &AArch64::GPR32spRegClass;
9246 ZeroReg = AArch64::WZR;
9247 Opc = AArch64::MADDWrrr;
9248 RC = &AArch64::GPR32RegClass;
9250 SubOpc = AArch64::SUBXrr;
9251 SubRC = &AArch64::GPR64spRegClass;
9252 ZeroReg = AArch64::XZR;
9253 Opc = AArch64::MADDXrrr;
9254 RC = &AArch64::GPR64RegClass;
9258 MachineInstrBuilder MIB1 =
9259 BuildMI(MF, MIMetadata(Root),
TII->get(SubOpc), NewVR)
9263 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
9274 Opc = AArch64::MSUBWrrr;
9275 RC = &AArch64::GPR32RegClass;
9277 Opc = AArch64::MSUBXrrr;
9278 RC = &AArch64::GPR64RegClass;
9283 Opc = AArch64::MLAv8i8;
9284 RC = &AArch64::FPR64RegClass;
9288 Opc = AArch64::MLAv8i8;
9289 RC = &AArch64::FPR64RegClass;
9293 Opc = AArch64::MLAv16i8;
9294 RC = &AArch64::FPR128RegClass;
9298 Opc = AArch64::MLAv16i8;
9299 RC = &AArch64::FPR128RegClass;
9303 Opc = AArch64::MLAv4i16;
9304 RC = &AArch64::FPR64RegClass;
9308 Opc = AArch64::MLAv4i16;
9309 RC = &AArch64::FPR64RegClass;
9313 Opc = AArch64::MLAv8i16;
9314 RC = &AArch64::FPR128RegClass;
9318 Opc = AArch64::MLAv8i16;
9319 RC = &AArch64::FPR128RegClass;
9323 Opc = AArch64::MLAv2i32;
9324 RC = &AArch64::FPR64RegClass;
9328 Opc = AArch64::MLAv2i32;
9329 RC = &AArch64::FPR64RegClass;
9333 Opc = AArch64::MLAv4i32;
9334 RC = &AArch64::FPR128RegClass;
9338 Opc = AArch64::MLAv4i32;
9339 RC = &AArch64::FPR128RegClass;
9344 Opc = AArch64::MLAv8i8;
9345 RC = &AArch64::FPR64RegClass;
9347 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv8i8,
9351 Opc = AArch64::MLSv8i8;
9352 RC = &AArch64::FPR64RegClass;
9356 Opc = AArch64::MLAv16i8;
9357 RC = &AArch64::FPR128RegClass;
9359 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv16i8,
9363 Opc = AArch64::MLSv16i8;
9364 RC = &AArch64::FPR128RegClass;
9368 Opc = AArch64::MLAv4i16;
9369 RC = &AArch64::FPR64RegClass;
9371 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv4i16,
9375 Opc = AArch64::MLSv4i16;
9376 RC = &AArch64::FPR64RegClass;
9380 Opc = AArch64::MLAv8i16;
9381 RC = &AArch64::FPR128RegClass;
9383 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv8i16,
9387 Opc = AArch64::MLSv8i16;
9388 RC = &AArch64::FPR128RegClass;
9392 Opc = AArch64::MLAv2i32;
9393 RC = &AArch64::FPR64RegClass;
9395 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv2i32,
9399 Opc = AArch64::MLSv2i32;
9400 RC = &AArch64::FPR64RegClass;
9404 Opc = AArch64::MLAv4i32;
9405 RC = &AArch64::FPR128RegClass;
9407 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv4i32,
9411 Opc = AArch64::MLSv4i32;
9412 RC = &AArch64::FPR128RegClass;
9417 Opc = AArch64::MLAv4i16_indexed;
9418 RC = &AArch64::FPR64RegClass;
9422 Opc = AArch64::MLAv4i16_indexed;
9423 RC = &AArch64::FPR64RegClass;
9427 Opc = AArch64::MLAv8i16_indexed;
9428 RC = &AArch64::FPR128RegClass;
9432 Opc = AArch64::MLAv8i16_indexed;
9433 RC = &AArch64::FPR128RegClass;
9437 Opc = AArch64::MLAv2i32_indexed;
9438 RC = &AArch64::FPR64RegClass;
9442 Opc = AArch64::MLAv2i32_indexed;
9443 RC = &AArch64::FPR64RegClass;
9447 Opc = AArch64::MLAv4i32_indexed;
9448 RC = &AArch64::FPR128RegClass;
9452 Opc = AArch64::MLAv4i32_indexed;
9453 RC = &AArch64::FPR128RegClass;
9458 Opc = AArch64::MLAv4i16_indexed;
9459 RC = &AArch64::FPR64RegClass;
9461 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv4i16,
9465 Opc = AArch64::MLSv4i16_indexed;
9466 RC = &AArch64::FPR64RegClass;
9470 Opc = AArch64::MLAv8i16_indexed;
9471 RC = &AArch64::FPR128RegClass;
9473 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv8i16,
9477 Opc = AArch64::MLSv8i16_indexed;
9478 RC = &AArch64::FPR128RegClass;
9482 Opc = AArch64::MLAv2i32_indexed;
9483 RC = &AArch64::FPR64RegClass;
9485 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv2i32,
9489 Opc = AArch64::MLSv2i32_indexed;
9490 RC = &AArch64::FPR64RegClass;
9494 Opc = AArch64::MLAv4i32_indexed;
9495 RC = &AArch64::FPR128RegClass;
9497 InstrIdxForVirtReg, 1,
Opc, AArch64::NEGv4i32,
9501 Opc = AArch64::MLSv4i32_indexed;
9502 RC = &AArch64::FPR128RegClass;
9508 Opc = AArch64::FMADDHrrr;
9509 RC = &AArch64::FPR16RegClass;
9513 Opc = AArch64::FMADDSrrr;
9514 RC = &AArch64::FPR32RegClass;
9518 Opc = AArch64::FMADDDrrr;
9519 RC = &AArch64::FPR64RegClass;
9524 Opc = AArch64::FMADDHrrr;
9525 RC = &AArch64::FPR16RegClass;
9529 Opc = AArch64::FMADDSrrr;
9530 RC = &AArch64::FPR32RegClass;
9534 Opc = AArch64::FMADDDrrr;
9535 RC = &AArch64::FPR64RegClass;
9540 Opc = AArch64::FMLAv1i32_indexed;
9541 RC = &AArch64::FPR32RegClass;
9546 Opc = AArch64::FMLAv1i32_indexed;
9547 RC = &AArch64::FPR32RegClass;
9553 Opc = AArch64::FMLAv1i64_indexed;
9554 RC = &AArch64::FPR64RegClass;
9559 Opc = AArch64::FMLAv1i64_indexed;
9560 RC = &AArch64::FPR64RegClass;
9566 RC = &AArch64::FPR64RegClass;
9567 Opc = AArch64::FMLAv4i16_indexed;
9572 RC = &AArch64::FPR64RegClass;
9573 Opc = AArch64::FMLAv4f16;
9578 RC = &AArch64::FPR64RegClass;
9579 Opc = AArch64::FMLAv4i16_indexed;
9584 RC = &AArch64::FPR64RegClass;
9585 Opc = AArch64::FMLAv4f16;
9592 RC = &AArch64::FPR64RegClass;
9594 Opc = AArch64::FMLAv2i32_indexed;
9598 Opc = AArch64::FMLAv2f32;
9605 RC = &AArch64::FPR64RegClass;
9607 Opc = AArch64::FMLAv2i32_indexed;
9611 Opc = AArch64::FMLAv2f32;
9618 RC = &AArch64::FPR128RegClass;
9619 Opc = AArch64::FMLAv8i16_indexed;
9624 RC = &AArch64::FPR128RegClass;
9625 Opc = AArch64::FMLAv8f16;
9630 RC = &AArch64::FPR128RegClass;
9631 Opc = AArch64::FMLAv8i16_indexed;
9636 RC = &AArch64::FPR128RegClass;
9637 Opc = AArch64::FMLAv8f16;
9644 RC = &AArch64::FPR128RegClass;
9646 Opc = AArch64::FMLAv2i64_indexed;
9650 Opc = AArch64::FMLAv2f64;
9657 RC = &AArch64::FPR128RegClass;
9659 Opc = AArch64::FMLAv2i64_indexed;
9663 Opc = AArch64::FMLAv2f64;
9671 RC = &AArch64::FPR128RegClass;
9673 Opc = AArch64::FMLAv4i32_indexed;
9677 Opc = AArch64::FMLAv4f32;
9685 RC = &AArch64::FPR128RegClass;
9687 Opc = AArch64::FMLAv4i32_indexed;
9691 Opc = AArch64::FMLAv4f32;
9698 Opc = AArch64::FNMSUBHrrr;
9699 RC = &AArch64::FPR16RegClass;
9703 Opc = AArch64::FNMSUBSrrr;
9704 RC = &AArch64::FPR32RegClass;
9708 Opc = AArch64::FNMSUBDrrr;
9709 RC = &AArch64::FPR64RegClass;
9714 Opc = AArch64::FNMADDHrrr;
9715 RC = &AArch64::FPR16RegClass;
9719 Opc = AArch64::FNMADDSrrr;
9720 RC = &AArch64::FPR32RegClass;
9724 Opc = AArch64::FNMADDDrrr;
9725 RC = &AArch64::FPR64RegClass;
9730 Opc = AArch64::FMSUBHrrr;
9731 RC = &AArch64::FPR16RegClass;
9735 Opc = AArch64::FMSUBSrrr;
9736 RC = &AArch64::FPR32RegClass;
9740 Opc = AArch64::FMSUBDrrr;
9741 RC = &AArch64::FPR64RegClass;
9746 Opc = AArch64::FMLSv1i32_indexed;
9747 RC = &AArch64::FPR32RegClass;
9753 Opc = AArch64::FMLSv1i64_indexed;
9754 RC = &AArch64::FPR64RegClass;
9761 RC = &AArch64::FPR64RegClass;
9763 MachineInstrBuilder MIB1 =
9764 BuildMI(MF, MIMetadata(Root),
TII->get(AArch64::FNEGv4f16), NewVR)
9767 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
9769 Opc = AArch64::FMLAv4f16;
9773 Opc = AArch64::FMLAv4i16_indexed;
9780 RC = &AArch64::FPR64RegClass;
9781 Opc = AArch64::FMLSv4f16;
9786 RC = &AArch64::FPR64RegClass;
9787 Opc = AArch64::FMLSv4i16_indexed;
9794 RC = &AArch64::FPR64RegClass;
9796 Opc = AArch64::FMLSv2i32_indexed;
9800 Opc = AArch64::FMLSv2f32;
9808 RC = &AArch64::FPR128RegClass;
9810 MachineInstrBuilder MIB1 =
9811 BuildMI(MF, MIMetadata(Root),
TII->get(AArch64::FNEGv8f16), NewVR)
9814 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
9816 Opc = AArch64::FMLAv8f16;
9820 Opc = AArch64::FMLAv8i16_indexed;
9827 RC = &AArch64::FPR128RegClass;
9828 Opc = AArch64::FMLSv8f16;
9833 RC = &AArch64::FPR128RegClass;
9834 Opc = AArch64::FMLSv8i16_indexed;
9841 RC = &AArch64::FPR128RegClass;
9843 Opc = AArch64::FMLSv2i64_indexed;
9847 Opc = AArch64::FMLSv2f64;
9855 RC = &AArch64::FPR128RegClass;
9857 Opc = AArch64::FMLSv4i32_indexed;
9861 Opc = AArch64::FMLSv4f32;
9868 RC = &AArch64::FPR64RegClass;
9870 MachineInstrBuilder MIB1 =
9871 BuildMI(MF, MIMetadata(Root),
TII->get(AArch64::FNEGv2f32), NewVR)
9874 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
9876 Opc = AArch64::FMLAv2i32_indexed;
9880 Opc = AArch64::FMLAv2f32;
9888 RC = &AArch64::FPR128RegClass;
9890 MachineInstrBuilder MIB1 =
9891 BuildMI(MF, MIMetadata(Root),
TII->get(AArch64::FNEGv4f32), NewVR)
9894 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
9896 Opc = AArch64::FMLAv4i32_indexed;
9900 Opc = AArch64::FMLAv4f32;
9908 RC = &AArch64::FPR128RegClass;
9910 MachineInstrBuilder MIB1 =
9911 BuildMI(MF, MIMetadata(Root),
TII->get(AArch64::FNEGv2f64), NewVR)
9914 InstrIdxForVirtReg.
insert(std::make_pair(NewVR, 0));
9916 Opc = AArch64::FMLAv2i64_indexed;
9920 Opc = AArch64::FMLAv2f64;
9932 &AArch64::FPR128RegClass, MRI);
9941 &AArch64::FPR128RegClass, MRI);
9950 &AArch64::FPR128_loRegClass, MRI);
9959 &AArch64::FPR128RegClass, MRI);
9968 &AArch64::FPR128_loRegClass, MRI);
10002 for (
auto *
MI : InsInstrs)
10003 MI->setFlags(Flags);
10044 bool IsNegativeBranch =
false;
10045 bool IsTestAndBranch =
false;
10046 unsigned TargetBBInMI = 0;
10047 switch (
MI.getOpcode()) {
10051 case AArch64::CBWPri:
10052 case AArch64::CBXPri:
10053 case AArch64::CBBAssertExt:
10054 case AArch64::CBHAssertExt:
10055 case AArch64::CBWPrr:
10056 case AArch64::CBXPrr:
10058 case AArch64::CBZW:
10059 case AArch64::CBZX:
10062 case AArch64::CBNZW:
10063 case AArch64::CBNZX:
10065 IsNegativeBranch =
true;
10067 case AArch64::TBZW:
10068 case AArch64::TBZX:
10070 IsTestAndBranch =
true;
10072 case AArch64::TBNZW:
10073 case AArch64::TBNZX:
10075 IsNegativeBranch =
true;
10076 IsTestAndBranch =
true;
10082 if (IsTestAndBranch &&
MI.getOperand(1).getImm())
10086 assert(
MI.getParent() &&
"Incomplete machine instruction\n");
10099 while (
DefMI->isCopy()) {
10110 switch (
DefMI->getOpcode()) {
10114 case AArch64::ANDWri:
10115 case AArch64::ANDXri: {
10116 if (IsTestAndBranch)
10123 bool Is32Bit = (
DefMI->getOpcode() == AArch64::ANDWri);
10125 DefMI->getOperand(2).getImm(), Is32Bit ? 32 : 64);
10140 unsigned Opc = (
Imm < 32)
10141 ? (IsNegativeBranch ? AArch64::TBNZW : AArch64::TBZW)
10142 : (IsNegativeBranch ? AArch64::TBNZX : AArch64::TBZX);
10155 if (!Is32Bit &&
Imm < 32)
10157 MI.eraseFromParent();
10161 case AArch64::CSINCWr:
10162 case AArch64::CSINCXr: {
10163 if (!(
DefMI->getOperand(1).getReg() == AArch64::WZR &&
10164 DefMI->getOperand(2).getReg() == AArch64::WZR) &&
10165 !(
DefMI->getOperand(1).getReg() == AArch64::XZR &&
10166 DefMI->getOperand(2).getReg() == AArch64::XZR))
10169 if (
DefMI->findRegisterDefOperandIdx(AArch64::NZCV,
nullptr,
10182 if (IsNegativeBranch)
10185 MI.eraseFromParent();
10191std::pair<unsigned, unsigned>
10192AArch64InstrInfo::decomposeMachineOperandsTargetFlags(
unsigned TF)
const {
10194 return std::make_pair(TF & Mask, TF & ~Mask);
10198AArch64InstrInfo::getSerializableDirectMachineOperandTargetFlags()
const {
10201 static const std::pair<unsigned, const char *> TargetFlags[] = {
10202 {MO_PAGE,
"aarch64-page"}, {
MO_PAGEOFF,
"aarch64-pageoff"},
10203 {
MO_G3,
"aarch64-g3"}, {
MO_G2,
"aarch64-g2"},
10204 {
MO_G1,
"aarch64-g1"}, {
MO_G0,
"aarch64-g0"},
10210AArch64InstrInfo::getSerializableBitmaskMachineOperandTargetFlags()
const {
10211 using namespace AArch64II;
10213 static const std::pair<unsigned, const char *> TargetFlags[] = {
10215 {
MO_GOT,
"aarch64-got"},
10216 {
MO_NC,
"aarch64-nc"},
10217 {
MO_S,
"aarch64-s"},
10218 {
MO_TLS,
"aarch64-tls"},
10228AArch64InstrInfo::getSerializableMachineMemOperandTargetFlags()
const {
10229 static const std::pair<MachineMemOperand::Flags, const char *> TargetFlags[] =
10363 std::vector<outliner::Candidate> &RepeatedSequenceLocs,
10378 return C.isAvailableInsideSeq(AArch64::FP,
TRI);
10386 const AArch64RegisterInfo *ARI =
10387 static_cast<const AArch64RegisterInfo *
>(&
TRI);
10390 for (
unsigned Reg : AArch64::GPR64RegClass) {
10392 Reg != AArch64::LR &&
10393 Reg != AArch64::X16 &&
10394 Reg != AArch64::X17 &&
10395 C.isAvailableAcrossAndOutOfSeq(
Reg,
TRI) &&
10396 C.isAvailableInsideSeq(
Reg,
TRI))
10427 return SubtargetA.hasV8_3aOps() == SubtargetB.hasV8_3aOps();
10430std::optional<std::unique_ptr<outliner::OutlinedFunction>>
10431AArch64InstrInfo::getOutliningCandidateInfo(
10433 std::vector<outliner::Candidate> &RepeatedSequenceLocs,
10434 unsigned MinRepeats)
const {
10435 unsigned SequenceSize = 0;
10436 for (
auto &
MI : RepeatedSequenceLocs[0])
10439 unsigned NumBytesToCreateFrame = 0;
10445 MachineInstr &LastMI = RepeatedSequenceLocs[0].back();
10446 MachineInstr &FirstMI = RepeatedSequenceLocs[0].front();
10447 if (LastMI.
getOpcode() == AArch64::ADRP &&
10450 return std::nullopt;
10455 if ((FirstMI.
getOpcode() == AArch64::ADDXri ||
10456 FirstMI.
getOpcode() == AArch64::LDRXui) &&
10459 return std::nullopt;
10470 if (std::adjacent_find(
10471 RepeatedSequenceLocs.begin(), RepeatedSequenceLocs.end(),
10472 [](
const outliner::Candidate &a,
const outliner::Candidate &b) {
10475 if (outliningCandidatesSigningScopeConsensus(a, b) &&
10476 outliningCandidatesSigningKeyConsensus(a, b) &&
10477 outliningCandidatesV8_3OpsConsensus(a, b)) {
10481 }) != RepeatedSequenceLocs.end()) {
10482 return std::nullopt;
10499 unsigned NumBytesToCheckLRInTCEpilogue = 0;
10500 const auto RASignCondition = RepeatedSequenceLocs[0]
10503 ->getSignReturnAddressCondition();
10506 NumBytesToCreateFrame += 8;
10509 auto LRCheckMethod = Subtarget.getAuthenticatedLRCheckMethod(
10510 *RepeatedSequenceLocs[0].getMF());
10511 NumBytesToCheckLRInTCEpilogue =
10515 if (isTailCallReturnInst(RepeatedSequenceLocs[0].
back()))
10516 SequenceSize += NumBytesToCheckLRInTCEpilogue;
10524 for (
auto &
MI :
C) {
10525 if (
MI.modifiesRegister(AArch64::SP, &
TRI)) {
10526 switch (
MI.getOpcode()) {
10527 case AArch64::ADDXri:
10528 case AArch64::ADDWri:
10529 assert(
MI.getNumOperands() == 4 &&
"Wrong number of operands");
10530 assert(
MI.getOperand(2).isImm() &&
10531 "Expected operand to be immediate");
10532 assert(
MI.getOperand(1).isReg() &&
10533 "Expected operand to be a register");
10537 if (
MI.getOperand(1).getReg() == AArch64::SP)
10538 SPValue +=
MI.getOperand(2).getImm();
10542 case AArch64::SUBXri:
10543 case AArch64::SUBWri:
10544 assert(
MI.getNumOperands() == 4 &&
"Wrong number of operands");
10545 assert(
MI.getOperand(2).isImm() &&
10546 "Expected operand to be immediate");
10547 assert(
MI.getOperand(1).isReg() &&
10548 "Expected operand to be a register");
10552 if (
MI.getOperand(1).getReg() == AArch64::SP)
10553 SPValue -=
MI.getOperand(2).getImm();
10570 if (RepeatedSequenceLocs.size() < MinRepeats)
10571 return std::nullopt;
10575 unsigned FlagsSetInAll = 0xF;
10579 FlagsSetInAll &=
C.Flags;
10581 unsigned LastInstrOpcode = RepeatedSequenceLocs[0].back().getOpcode();
10584 auto SetCandidateCallInfo =
10585 [&RepeatedSequenceLocs](
unsigned CallID,
unsigned NumBytesForCall) {
10587 C.setCallInfo(CallID, NumBytesForCall);
10591 NumBytesToCreateFrame += 4;
10599 unsigned CFICount = 0;
10600 for (
auto &
I : RepeatedSequenceLocs[0]) {
10601 if (
I.isCFIInstruction())
10611 std::vector<MCCFIInstruction> CFIInstructions =
10612 C.getMF()->getFrameInstructions();
10614 if (CFICount > 0 && CFICount != CFIInstructions.size())
10615 return std::nullopt;
10623 if (!
MI.modifiesRegister(AArch64::SP, &
TRI) &&
10624 !
MI.readsRegister(AArch64::SP, &
TRI))
10630 if (
MI.modifiesRegister(AArch64::SP, &
TRI))
10635 if (
MI.mayLoadOrStore()) {
10638 bool OffsetIsScalable;
10642 if (!getMemOperandWithOffset(
MI,
Base,
Offset, OffsetIsScalable, &
TRI) ||
10643 !
Base->isReg() ||
Base->getReg() != AArch64::SP)
10647 if (OffsetIsScalable)
10655 TypeSize Scale(0U,
false), DummyWidth(0U,
false);
10656 getMemOpInfo(
MI.getOpcode(), Scale, DummyWidth, MinOffset, MaxOffset);
10659 if (
Offset < MinOffset * (int64_t)Scale.getFixedValue() ||
10660 Offset > MaxOffset * (int64_t)Scale.getFixedValue())
10675 bool AllStackInstrsSafe =
10680 if (RepeatedSequenceLocs[0].
back().isTerminator()) {
10682 NumBytesToCreateFrame = 0;
10683 unsigned NumBytesForCall = 4 + NumBytesToCheckLRInTCEpilogue;
10687 else if (LastInstrOpcode == AArch64::BL ||
10688 ((LastInstrOpcode == AArch64::BLR ||
10689 LastInstrOpcode == AArch64::BLRNoIP) &&
10693 NumBytesToCreateFrame = NumBytesToCheckLRInTCEpilogue;
10701 unsigned NumBytesNoStackCalls = 0;
10702 std::vector<outliner::Candidate> CandidatesWithoutStackFixups;
10708 ?
C.isAvailableAcrossAndOutOfSeq(AArch64::LR,
TRI)
10717 C.getMF()->getFunction().hasFnAttribute(Attribute::NoReturn);
10720 if (LRAvailable && !IsNoReturn) {
10721 NumBytesNoStackCalls += 4;
10723 CandidatesWithoutStackFixups.push_back(
C);
10728 else if (findRegisterToSaveLRTo(
C)) {
10729 NumBytesNoStackCalls += 12;
10731 CandidatesWithoutStackFixups.push_back(
C);
10736 else if (
C.isAvailableInsideSeq(AArch64::SP,
TRI)) {
10737 NumBytesNoStackCalls += 12;
10739 CandidatesWithoutStackFixups.push_back(
C);
10745 NumBytesNoStackCalls += SequenceSize;
10752 if (!AllStackInstrsSafe ||
10753 NumBytesNoStackCalls <= RepeatedSequenceLocs.size() * 12) {
10754 RepeatedSequenceLocs = CandidatesWithoutStackFixups;
10756 if (RepeatedSequenceLocs.size() < MinRepeats)
10757 return std::nullopt;
10810 (!
C.isAvailableAcrossAndOutOfSeq(AArch64::LR,
TRI) ||
10811 !findRegisterToSaveLRTo(
C));
10817 if (RepeatedSequenceLocs.size() < MinRepeats)
10818 return std::nullopt;
10827 bool ModStackToSaveLR =
false;
10830 ModStackToSaveLR =
true;
10839 ModStackToSaveLR =
true;
10841 if (ModStackToSaveLR) {
10843 if (!AllStackInstrsSafe)
10844 return std::nullopt;
10847 NumBytesToCreateFrame += 8;
10851 RepeatedSequenceLocs,
TRI))
10852 NumBytesToCreateFrame += 4;
10859 return std::nullopt;
10861 return std::make_unique<outliner::OutlinedFunction>(
10862 RepeatedSequenceLocs, SequenceSize, NumBytesToCreateFrame, FrameID);
10865void AArch64InstrInfo::mergeOutliningCandidateAttributes(
10866 Function &
F, std::vector<outliner::Candidate> &Candidates)
const {
10870 const auto &CFn = Candidates.front().getMF()->getFunction();
10872 if (CFn.hasFnAttribute(
"ptrauth-returns"))
10873 F.addFnAttr(CFn.getFnAttribute(
"ptrauth-returns"));
10874 if (CFn.hasFnAttribute(
"ptrauth-auth-traps"))
10875 F.addFnAttr(CFn.getFnAttribute(
"ptrauth-auth-traps"));
10878 if (CFn.hasFnAttribute(
"sign-return-address"))
10879 F.addFnAttr(CFn.getFnAttribute(
"sign-return-address"));
10880 if (CFn.hasFnAttribute(
"sign-return-address-key"))
10881 F.addFnAttr(CFn.getFnAttribute(
"sign-return-address-key"));
10883 AArch64GenInstrInfo::mergeOutliningCandidateAttributes(
F, Candidates);
10886bool AArch64InstrInfo::isFunctionSafeToOutlineFrom(
10891 if (!OutlineFromLinkOnceODRs &&
F.hasLinkOnceODRLinkage())
10898 if (
F.hasSection())
10904 AArch64FunctionInfo *AFI = MF.
getInfo<AArch64FunctionInfo>();
10905 if (!AFI || AFI->
hasRedZone().value_or(
true))
10925 unsigned &Flags)
const {
10927 "Must track liveness!");
10929 std::pair<MachineBasicBlock::iterator, MachineBasicBlock::iterator>>
10944 auto AreAllUnsafeRegsDead = [&LRU]() {
10945 return LRU.available(AArch64::W16) && LRU.available(AArch64::W17) &&
10946 LRU.available(AArch64::NZCV);
10961 bool LRAvailableEverywhere =
true;
10963 LRU.addLiveOuts(
MBB);
10965 auto UpdateWholeMBBFlags = [&
Flags](
const MachineInstr &
MI) {
10966 if (
MI.isCall() && !
MI.isTerminator())
10972 auto CreateNewRangeStartingAt =
10973 [&RangeBegin, &RangeEnd,
10975 RangeBegin = NewBegin;
10976 RangeEnd = std::next(RangeBegin);
10979 auto SaveRangeIfNonEmpty = [&RangeLen, &
Ranges, &RangeBegin, &RangeEnd]() {
10985 if (!RangeBegin.isEnd() && RangeBegin->isBundledWithPred())
10987 if (!RangeEnd.isEnd() && RangeEnd->isBundledWithPred())
10989 Ranges.emplace_back(RangeBegin, RangeEnd);
10997 for (; FirstPossibleEndPt !=
MBB.
instr_rend(); ++FirstPossibleEndPt) {
10998 if (!FirstPossibleEndPt->isDebugInstr())
10999 LRU.stepBackward(*FirstPossibleEndPt);
11002 UpdateWholeMBBFlags(*FirstPossibleEndPt);
11003 if (AreAllUnsafeRegsDead())
11010 CreateNewRangeStartingAt(FirstPossibleEndPt->getIterator());
11015 if (!
MI.isDebugInstr())
11016 LRU.stepBackward(
MI);
11017 UpdateWholeMBBFlags(
MI);
11018 if (!AreAllUnsafeRegsDead()) {
11019 SaveRangeIfNonEmpty();
11020 CreateNewRangeStartingAt(
MI.getIterator());
11023 LRAvailableEverywhere &= LRU.available(AArch64::LR);
11024 RangeBegin =
MI.getIterator();
11029 if (AreAllUnsafeRegsDead())
11030 SaveRangeIfNonEmpty();
11038 if (!LRAvailableEverywhere)
11046 unsigned Flags)
const {
11047 MachineInstr &
MI = *MIT;
11051 switch (
MI.getOpcode()) {
11052 case AArch64::PACM:
11053 case AArch64::PACIASP:
11054 case AArch64::PACIBSP:
11055 case AArch64::PACIASPPC:
11056 case AArch64::PACIBSPPC:
11057 case AArch64::AUTIASP:
11058 case AArch64::AUTIBSP:
11059 case AArch64::AUTIASPPCi:
11060 case AArch64::AUTIASPPCr:
11061 case AArch64::AUTIBSPPCi:
11062 case AArch64::AUTIBSPPCr:
11063 case AArch64::RETAA:
11064 case AArch64::RETAB:
11065 case AArch64::RETAASPPCi:
11066 case AArch64::RETAASPPCr:
11067 case AArch64::RETABSPPCi:
11068 case AArch64::RETABSPPCr:
11069 case AArch64::EMITBKEY:
11070 case AArch64::PAUTH_PROLOGUE:
11071 case AArch64::PAUTH_EPILOGUE:
11081 if (
MI.isCFIInstruction())
11085 if (
MI.isTerminator())
11091 for (
const MachineOperand &MOP :
MI.operands()) {
11094 assert(!MOP.isCFIIndex());
11097 if (MOP.isReg() && !MOP.isImplicit() &&
11098 (MOP.getReg() == AArch64::LR || MOP.getReg() == AArch64::W30))
11105 if (
MI.getOpcode() == AArch64::ADRP)
11125 for (
const MachineOperand &MOP :
MI.operands()) {
11126 if (MOP.isGlobal()) {
11134 if (Callee &&
Callee->getName() ==
"\01_mcount")
11142 if (
MI.getOpcode() == AArch64::BLR ||
11143 MI.getOpcode() == AArch64::BLRNoIP ||
MI.getOpcode() == AArch64::BL)
11147 return UnknownCallOutlineType;
11155 return UnknownCallOutlineType;
11163 return UnknownCallOutlineType;
11184 for (MachineInstr &
MI :
MBB) {
11185 const MachineOperand *
Base;
11186 TypeSize Width(0,
false);
11188 bool OffsetIsScalable;
11191 if (!
MI.mayLoadOrStore() ||
11194 (
Base->isReg() &&
Base->getReg() != AArch64::SP))
11198 TypeSize Scale(0U,
false);
11199 int64_t Dummy1, Dummy2;
11202 assert(StackOffsetOperand.
isImm() &&
"Stack offset wasn't immediate!");
11204 assert(Scale != 0 &&
"Unexpected opcode!");
11205 assert(!OffsetIsScalable &&
"Expected offset to be a byte offset");
11210 int64_t NewImm = (
Offset + 16) / (int64_t)Scale.getFixedValue();
11211 StackOffsetOperand.
setImm(NewImm);
11217 bool ShouldSignReturnAddr) {
11218 if (!ShouldSignReturnAddr)
11226void AArch64InstrInfo::buildOutlinedFrame(
11230 AArch64FunctionInfo *FI = MF.
getInfo<AArch64FunctionInfo>();
11238 unsigned TailOpcode;
11240 TailOpcode = AArch64::TCRETURNdi;
11244 TailOpcode = AArch64::TCRETURNriALL;
11255 bool IsLeafFunction =
true;
11258 auto IsNonTailCall = [](
const MachineInstr &
MI) {
11259 return MI.isCall() && !
MI.isReturn();
11269 "Can only fix up stack references once");
11270 fixupPostOutline(
MBB);
11272 IsLeafFunction =
false;
11283 Et = std::prev(
MBB.
end());
11314 CFIBuilder.buildDefCFA(AArch64::FP, 16);
11315 CFIBuilder.buildOffset(AArch64::LR, -8);
11316 CFIBuilder.buildOffset(AArch64::FP, -16);
11335 if (MF.
getInfo<AArch64FunctionInfo>()->needsDwarfUnwindInfo(MF)) {
11339 CFIBuilder.buildDefCFAOffset(16);
11343 CFIBuilder.buildOffset(AArch64::LR, -16);
11358 RASignCondition, !IsLeafFunction);
11387 fixupPostOutline(
MBB);
11398 .addGlobalAddress(
M.getNamedValue(MF.
getName()))
11408 .addGlobalAddress(
M.getNamedValue(MF.
getName())));
11417 MachineInstr *Save;
11418 MachineInstr *Restore;
11424 assert(
Reg &&
"No callee-saved register available?");
11458 .addGlobalAddress(
M.getNamedValue(MF.
getName())));
11466bool AArch64InstrInfo::shouldOutlineFromFunctionByDefault(
11474 bool AllowSideEffects)
const {
11476 const AArch64Subtarget &STI = MF.
getSubtarget<AArch64Subtarget>();
11479 if (
TRI.isGeneralPurposeRegister(MF,
Reg)) {
11492 assert(STI.hasFPARMv8() &&
"Expected FP to be available.");
11498std::optional<DestSourcePair>
11503 if ((
MI.getOpcode() == AArch64::ORRWrs &&
11504 MI.getOperand(1).getReg() == AArch64::WZR &&
11505 MI.getOperand(3).getImm() == 0x0) ||
11506 (
MI.getOpcode() == AArch64::ORRWrr &&
11507 MI.getOperand(1).getReg() == AArch64::WZR)) {
11509 if ((
MI.getOperand(0).getReg().isPhysical() &&
11510 MI.findRegisterDefOperandIdx(
11513 (
MI.getOperand(0).getReg().isVirtual() &&
11514 !
MI.getOperand(0).getSubReg()))
11518 if (
MI.getOpcode() == AArch64::ORRXrs &&
11519 MI.getOperand(1).getReg() == AArch64::XZR &&
11520 MI.getOperand(3).getImm() == 0x0)
11523 return std::nullopt;
11526std::optional<DestSourcePair>
11528 if ((
MI.getOpcode() == AArch64::ORRWrs &&
11529 MI.getOperand(1).getReg() == AArch64::WZR &&
11530 MI.getOperand(3).getImm() == 0x0) ||
11531 (
MI.getOpcode() == AArch64::ORRWrr &&
11532 MI.getOperand(1).getReg() == AArch64::WZR))
11534 return std::nullopt;
11537std::optional<RegImmPair>
11546 return std::nullopt;
11548 switch (
MI.getOpcode()) {
11550 return std::nullopt;
11551 case AArch64::SUBWri:
11552 case AArch64::SUBXri:
11553 case AArch64::SUBSWri:
11554 case AArch64::SUBSXri:
11557 case AArch64::ADDSWri:
11558 case AArch64::ADDSXri:
11559 case AArch64::ADDWri:
11560 case AArch64::ADDXri: {
11562 if (!
MI.getOperand(0).isReg() || !
MI.getOperand(1).isReg() ||
11563 !
MI.getOperand(2).isImm())
11564 return std::nullopt;
11565 int Shift =
MI.getOperand(3).getImm();
11566 assert((Shift == 0 || Shift == 12) &&
"Shift can be either 0 or 12");
11570 return RegImmPair{
MI.getOperand(1).getReg(),
Offset};
11576static std::optional<ParamLoadedValue>
11580 auto DestSrc =
TII->isCopyLikeInstr(
MI);
11582 return std::nullopt;
11584 Register DestReg = DestSrc->Destination->getReg();
11585 Register SrcReg = DestSrc->Source->getReg();
11588 return std::nullopt;
11593 if (DestReg == DescribedReg)
11597 if (
MI.getOpcode() == AArch64::ORRWrs &&
11598 TRI->isSuperRegister(DestReg, DescribedReg))
11602 if (
MI.getOpcode() == AArch64::ORRXrs &&
11603 TRI->isSubRegister(DestReg, DescribedReg)) {
11604 Register SrcSubReg =
TRI->getSubReg(SrcReg, AArch64::sub_32);
11608 assert(!
TRI->isSuperOrSubRegisterEq(DestReg, DescribedReg) &&
11609 "Unhandled ORR[XW]rs copy case");
11611 return std::nullopt;
11614bool AArch64InstrInfo::isFunctionSafeToSplit(
const MachineFunction &MF)
const {
11619 if (MF.
getInfo<AArch64FunctionInfo>()->hasRedZone().value_or(
true))
11625bool AArch64InstrInfo::isMBBSafeToSplitToCold(
11629 auto isAsmGoto = [](
const MachineInstr &
MI) {
11630 return MI.getOpcode() == AArch64::INLINEASM_BR;
11640 auto containsMBB = [&
MBB](
const MachineJumpTableEntry &JTE) {
11647 for (
const MachineInstr &
MI :
MBB) {
11648 switch (
MI.getOpcode()) {
11649 case TargetOpcode::G_BRJT:
11650 case AArch64::JumpTableDest32:
11651 case AArch64::JumpTableDest16:
11652 case AArch64::JumpTableDest8:
11663std::optional<ParamLoadedValue>
11668 switch (
MI.getOpcode()) {
11669 case AArch64::MOVZWi:
11670 case AArch64::MOVZXi: {
11673 if (!
TRI->isSuperRegisterEq(
MI.getOperand(0).getReg(),
Reg))
11674 return std::nullopt;
11676 if (!
MI.getOperand(1).isImm())
11677 return std::nullopt;
11678 int64_t Immediate =
MI.getOperand(1).getImm();
11679 int Shift =
MI.getOperand(2).getImm();
11683 case AArch64::ORRWrs:
11684 case AArch64::ORRXrs:
11691bool AArch64InstrInfo::isExtendLikelyToBeFolded(
11694 ExtMI.
getOpcode() == TargetOpcode::G_ZEXT ||
11695 ExtMI.
getOpcode() == TargetOpcode::G_ANYEXT);
11698 if (ExtMI.
getOpcode() == TargetOpcode::G_ANYEXT)
11708 return UserMI->
getOpcode() == TargetOpcode::G_PTR_ADD;
11711uint64_t AArch64InstrInfo::getElementSizeForOpcode(
unsigned Opc)
const {
11715bool AArch64InstrInfo::isPTestLikeOpcode(
unsigned Opc)
const {
11719bool AArch64InstrInfo::isWhileOpcode(
unsigned Opc)
const {
11724AArch64InstrInfo::getTailDuplicateSize(
CodeGenOptLevel OptLevel)
const {
11728bool AArch64InstrInfo::isLegalAddressingMode(
unsigned NumBytes, int64_t
Offset,
11729 unsigned Scale)
const {
11740 unsigned Shift =
Log2_64(NumBytes);
11741 if (NumBytes &&
Offset > 0 && (
Offset / NumBytes) <= (1LL << 12) - 1 &&
11749 return Scale == 1 || (Scale > 0 && Scale == NumBytes);
11754 return AArch64::BLRNoIP;
11756 return AArch64::BLR;
11762 auto Builder =
BuildMI(
MBB, InsertPt,
DL,
get(AArch64::PAUTH_EPILOGUE))
11772 if (Subtarget.hasPAuthLR())
11783 Register TargetReg,
bool FrameSetup)
const {
11784 assert(TargetReg != AArch64::SP &&
"New top of stack cannot already be in SP");
11796 MF.
insert(MBBInsertPoint, LoopTestMBB);
11799 MF.
insert(MBBInsertPoint, LoopBodyMBB);
11801 MF.
insert(MBBInsertPoint, ExitMBB);
11811 BuildMI(*LoopTestMBB, LoopTestMBB->
end(),
DL,
TII->get(AArch64::SUBSXrx64),
11819 BuildMI(*LoopTestMBB, LoopTestMBB->
end(),
DL,
TII->get(AArch64::Bcc))
11825 BuildMI(*LoopBodyMBB, LoopBodyMBB->
end(),
DL,
TII->get(AArch64::LDRXui))
11842 BuildMI(*ExitMBB, ExitMBB->
end(),
DL,
TII->get(AArch64::ADDXri), AArch64::SP)
11861 MBB.addSuccessor(LoopTestMBB);
11867 return ExitMBB->
begin();
11873 const TargetInstrInfo *
TII;
11874 const TargetRegisterInfo *
TRI;
11875 MachineRegisterInfo &MRI;
11878 MachineBasicBlock *LoopBB;
11880 MachineInstr *CondBranch;
11882 MachineInstr *Comp;
11884 unsigned CompCounterOprNum;
11886 MachineInstr *Update;
11888 unsigned UpdateCounterOprNum;
11892 bool IsUpdatePriorComp;
11898 AArch64PipelinerLoopInfo(MachineBasicBlock *LoopBB, MachineInstr *CondBranch,
11899 MachineInstr *Comp,
unsigned CompCounterOprNum,
11900 MachineInstr *Update,
unsigned UpdateCounterOprNum,
11901 Register Init,
bool IsUpdatePriorComp,
11902 const SmallVectorImpl<MachineOperand> &
Cond)
11904 TII(MF->getSubtarget().getInstrInfo()),
11905 TRI(MF->getSubtarget().getRegisterInfo()), MRI(MF->getRegInfo()),
11906 LoopBB(LoopBB), CondBranch(CondBranch), Comp(Comp),
11907 CompCounterOprNum(CompCounterOprNum), Update(Update),
11908 UpdateCounterOprNum(UpdateCounterOprNum), Init(Init),
11911 bool shouldIgnoreForPipelining(
const MachineInstr *
MI)
const override {
11917 std::optional<bool> createTripCountGreaterCondition(
11918 int TC, MachineBasicBlock &
MBB,
11919 SmallVectorImpl<MachineOperand> &CondParam)
override {
11927 void createRemainingIterationsGreaterCondition(
11928 int TC, MachineBasicBlock &
MBB, SmallVectorImpl<MachineOperand> &
Cond,
11929 DenseMap<MachineInstr *, MachineInstr *> &LastStage0Insts)
override;
11931 void setPreheader(MachineBasicBlock *NewPreheader)
override {}
11933 void adjustTripCount(
int TripCountAdjust)
override {}
11935 bool isMVEExpanderSupported()
override {
return true; }
11954 }
else if (
I == ReplaceOprNum) {
11959 MBB.insert(InsertTo, NewMI);
11963void AArch64PipelinerLoopInfo::createRemainingIterationsGreaterCondition(
11979 assert(CondBranch->getOpcode() == AArch64::Bcc);
11983 if (CondBranch->getOperand(1).getMBB() == LoopBB)
11990 auto AccumulateCond = [&](
Register CurCond,
12001 if (!LastStage0Insts.
empty() && LastStage0Insts[Comp]->getParent() == &
MBB) {
12005 for (
int I = 0;
I <= TC; ++
I) {
12011 AccCond = AccumulateCond(AccCond, CC);
12015 if (Update != Comp && IsUpdatePriorComp) {
12017 LastStage0Insts[Comp]->getOperand(CompCounterOprNum).getReg();
12018 NextCounter =
cloneInstr(Update, UpdateCounterOprNum, Counter,
MBB,
12022 NextCounter = LastStage0Insts[Update]->getOperand(0).getReg();
12024 }
else if (Update != Comp) {
12029 Counter = NextCounter;
12033 if (LastStage0Insts.
empty()) {
12037 if (IsUpdatePriorComp)
12042 Counter = LastStage0Insts[Comp]->getOperand(CompCounterOprNum).getReg();
12045 for (
int I = 0;
I <= TC; ++
I) {
12049 AccCond = AccumulateCond(AccCond, CC);
12050 if (
I != TC && Update != Comp)
12053 Counter = NextCounter;
12069 assert(Phi.getNumOperands() == 5);
12070 if (Phi.getOperand(2).getMBB() ==
MBB) {
12071 RegMBB = Phi.getOperand(1).getReg();
12072 RegOther = Phi.getOperand(3).getReg();
12074 assert(Phi.getOperand(4).getMBB() ==
MBB);
12075 RegMBB = Phi.getOperand(3).getReg();
12076 RegOther = Phi.getOperand(1).getReg();
12081 if (!
Reg.isVirtual())
12090 unsigned &UpdateCounterOprNum,
Register &InitReg,
12091 bool &IsUpdatePriorComp) {
12105 if (!
Reg.isVirtual())
12108 UpdateInst =
nullptr;
12109 UpdateCounterOprNum = 0;
12111 IsUpdatePriorComp =
true;
12115 if (Def->getParent() != LoopBB)
12117 if (Def->isCopy()) {
12119 if (Def->getOperand(0).getSubReg() || Def->getOperand(1).getSubReg())
12121 CurReg = Def->getOperand(1).getReg();
12122 }
else if (Def->isPHI()) {
12126 IsUpdatePriorComp =
false;
12131 switch (Def->getOpcode()) {
12132 case AArch64::ADDSXri:
12133 case AArch64::ADDSWri:
12134 case AArch64::SUBSXri:
12135 case AArch64::SUBSWri:
12136 case AArch64::ADDXri:
12137 case AArch64::ADDWri:
12138 case AArch64::SUBXri:
12139 case AArch64::SUBWri:
12141 UpdateCounterOprNum = 1;
12143 case AArch64::ADDSXrr:
12144 case AArch64::ADDSWrr:
12145 case AArch64::SUBSXrr:
12146 case AArch64::SUBSWrr:
12147 case AArch64::ADDXrr:
12148 case AArch64::ADDWrr:
12149 case AArch64::SUBXrr:
12150 case AArch64::SUBWrr:
12153 UpdateCounterOprNum = 1;
12155 UpdateCounterOprNum = 2;
12162 CurReg = Def->getOperand(UpdateCounterOprNum).getReg();
12177std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
12188 if (
MI.isCall() ||
MI.hasUnmodeledSideEffects())
12199 if (
TBB == LoopBB && FBB == LoopBB)
12203 if (
TBB != LoopBB && FBB ==
nullptr)
12206 assert((
TBB == LoopBB || FBB == LoopBB) &&
12207 "The Loop must be a single-basic-block loop");
12212 if (CondBranch->
getOpcode() != AArch64::Bcc)
12220 unsigned CompCounterOprNum = 0;
12222 if (
MI.modifiesRegister(AArch64::NZCV, &
TRI)) {
12226 switch (
MI.getOpcode()) {
12227 case AArch64::SUBSXri:
12228 case AArch64::SUBSWri:
12229 case AArch64::ADDSXri:
12230 case AArch64::ADDSWri:
12232 CompCounterOprNum = 1;
12234 case AArch64::ADDSWrr:
12235 case AArch64::ADDSXrr:
12236 case AArch64::SUBSWrr:
12237 case AArch64::SUBSXrr:
12241 if (isWhileOpcode(
MI.getOpcode())) {
12248 if (CompCounterOprNum == 0) {
12250 CompCounterOprNum = 2;
12252 CompCounterOprNum = 1;
12264 bool IsUpdatePriorComp;
12265 unsigned UpdateCounterOprNum;
12267 Update, UpdateCounterOprNum,
Init, IsUpdatePriorComp))
12270 return std::make_unique<AArch64PipelinerLoopInfo>(
12271 LoopBB, CondBranch, Comp, CompCounterOprNum, Update, UpdateCounterOprNum,
12281 TypeSize Scale(0U,
false), Width(0U,
false);
12282 int64_t MinOffset, MaxOffset;
12283 if (
getMemOpInfo(
MI.getOpcode(), Scale, Width, MinOffset, MaxOffset)) {
12285 if (
MI.getOperand(ImmIdx).isImm() && !
MI.getOperand(ImmIdx - 1).isFI()) {
12286 int64_t
Imm =
MI.getOperand(ImmIdx).getImm();
12288 ErrInfo =
"Unexpected immediate on load/store instruction";
12294 const MCInstrDesc &MCID =
MI.getDesc();
12296 const MachineOperand &MO =
MI.getOperand(
Op);
12300 ErrInfo =
"OPERAND_IMPLICIT_IMM_0 should be 0";
12309 ErrInfo =
"OPERAND_SHIFT_MSL should be msl shift of 8 or 16";
12315 ErrInfo =
"OPERAND_IMM_UINT1 should be 0 or 1";
12321 ErrInfo =
"OPERAND_IMM_UINT4plus1 should be in the range 1 to 16";
12327 ErrInfo =
"OPERAND_IMM_UINT5 should be in the range 0 to 31";
12333 ErrInfo =
"OPERAND_IMM_UINT8 should be in the range 0 to 255";
12344#define GET_INSTRINFO_HELPERS
12345#define GET_INSTRMAP_INFO
12346#include "AArch64GenInstrInfo.inc"
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
static bool forwardCopyWillClobberTuple(unsigned DestReg, unsigned SrcReg, unsigned NumRegs)
static cl::opt< unsigned > BCCDisplacementBits("aarch64-bcc-offset-bits", cl::Hidden, cl::init(19), cl::desc("Restrict range of Bcc instructions (DEBUG)"))
static Register genNeg(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, DenseMap< Register, unsigned > &InstrIdxForVirtReg, unsigned MnegOpc, const TargetRegisterClass *RC)
genNeg - Helper to generate an intermediate negation of the second operand of Root
static bool isFrameStoreOpcode(int Opcode)
static cl::opt< unsigned > GatherOptSearchLimit("aarch64-search-limit", cl::Hidden, cl::init(2048), cl::desc("Restrict range of instructions to search for the " "machine-combiner gather pattern optimization"))
static bool getMaddPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns)
Find instructions that can be turned into madd.
static AArch64CC::CondCode findCondCodeUsedByInstr(const MachineInstr &Instr)
Find a condition code used by the instruction.
static MachineInstr * genFusedMultiplyAcc(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, unsigned IdxMulOpd, unsigned MaddOpc, const TargetRegisterClass *RC)
genFusedMultiplyAcc - Helper to generate fused multiply accumulate instructions.
static MachineInstr * genFusedMultiplyAccNeg(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, DenseMap< Register, unsigned > &InstrIdxForVirtReg, unsigned IdxMulOpd, unsigned MaddOpc, unsigned MnegOpc, const TargetRegisterClass *RC)
genFusedMultiplyAccNeg - Helper to generate fused multiply accumulate instructions with an additional...
static bool isCombineInstrCandidate64(unsigned Opc)
static bool isFrameLoadOpcode(int Opcode)
static unsigned removeCopies(const MachineRegisterInfo &MRI, unsigned VReg)
static bool areCFlagsAccessedBetweenInstrs(MachineBasicBlock::iterator From, MachineBasicBlock::iterator To, const TargetRegisterInfo *TRI, const AccessKind AccessToCheck=AK_All)
True when condition flags are accessed (either by writing or reading) on the instruction trace starti...
static bool getFMAPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns)
Floating-Point Support.
static bool isADDSRegImm(unsigned Opcode)
static bool isCheapCopy(const MachineInstr &MI, const AArch64RegisterInfo &RI)
static bool isANDOpcode(MachineInstr &MI)
static bool predictCompactUnwindFrameRecordForOutlinedFunction(std::vector< outliner::Candidate > &RepeatedSequenceLocs, const TargetRegisterInfo &TRI)
Predict what the above will answer, for use while costing candidates.
static void appendOffsetComment(int NumBytes, llvm::raw_string_ostream &Comment, StringRef RegScale={})
static unsigned sForm(MachineInstr &Instr)
Get opcode of S version of Instr.
static bool isCombineInstrSettingFlag(unsigned Opc)
static bool getFNEGPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns)
static bool getIndVarInfo(Register Reg, const MachineBasicBlock *LoopBB, MachineInstr *&UpdateInst, unsigned &UpdateCounterOprNum, Register &InitReg, bool &IsUpdatePriorComp)
If Reg is an induction variable, return true and set some parameters.
static bool canPairLdStOpc(unsigned FirstOpc, unsigned SecondOpc)
static bool mustAvoidNeonAtMBBI(const AArch64Subtarget &Subtarget, MachineBasicBlock &MBB, MachineBasicBlock::iterator I)
Returns true if in a streaming call site region without SME-FA64.
static bool isPostIndexLdStOpcode(unsigned Opcode)
Return true if the opcode is a post-index ld/st instruction, which really loads from base+0.
static std::optional< unsigned > getLFIInstSizeInBytes(const MachineInstr &MI)
Return the maximum number of bytes of code the specified instruction may be after LFI rewriting.
static unsigned getBranchDisplacementBits(unsigned Opc)
static cl::opt< unsigned > CBDisplacementBits("aarch64-cb-offset-bits", cl::Hidden, cl::init(9), cl::desc("Restrict range of CB instructions (DEBUG)"))
static std::optional< ParamLoadedValue > describeORRLoadedValue(const MachineInstr &MI, Register DescribedReg, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
If the given ORR instruction is a copy, and DescribedReg overlaps with the destination register then,...
static bool getFMULPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns)
static void appendReadRegExpr(SmallVectorImpl< char > &Expr, unsigned RegNum)
static MachineInstr * genMaddR(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, unsigned IdxMulOpd, unsigned MaddOpc, unsigned VR, const TargetRegisterClass *RC)
genMaddR - Generate madd instruction and combine mul and add using an extra virtual register Example ...
static Register cloneInstr(const MachineInstr *MI, unsigned ReplaceOprNum, Register ReplaceReg, MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertTo)
Clone an instruction from MI.
static bool scaleOffset(unsigned Opc, int64_t &Offset)
static bool canCombineWithFMUL(MachineBasicBlock &MBB, MachineOperand &MO, unsigned MulOpc)
unsigned scaledOffsetOpcode(unsigned Opcode, unsigned &Scale)
static MachineInstr * genFusedMultiplyIdx(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, unsigned IdxMulOpd, unsigned MaddOpc, const TargetRegisterClass *RC)
genFusedMultiplyIdx - Helper to generate fused multiply accumulate instructions.
static MachineInstr * genIndexedMultiply(MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, unsigned IdxDupOp, unsigned MulOpc, const TargetRegisterClass *RC, MachineRegisterInfo &MRI)
Fold (FMUL x (DUP y lane)) into (FMUL_indexed x y lane)
static cl::opt< bool > UseCompactUnwindFrameRecordForOutlinedFunctions("aarch64-outliner-compact-unwind-frame", cl::Hidden, cl::init(true), cl::desc("Use a frame record for Mach-O non-leaf outlined functions"))
static bool shouldUseCompactUnwindFrameRecordForOutlinedFunction(const MachineBasicBlock &MBB)
Return true if the outlined function in MBB should save FP and LR as a frame record instead of saving...
static bool isSUBSRegImm(unsigned Opcode)
static bool UpdateOperandRegClass(MachineInstr &Instr)
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
static bool isInStreamingCallSiteRegion(MachineBasicBlock &MBB, MachineBasicBlock::iterator I)
Returns true if the instruction at I is in a streaming call site region, within a single basic block.
static bool canCmpInstrBeRemoved(MachineInstr &MI, MachineInstr &CmpInstr, int CmpValue, const TargetRegisterInfo &TRI, SmallVectorImpl< MachineInstr * > &CCUseInstrs, bool &IsInvertCC)
unsigned unscaledOffsetOpcode(unsigned Opcode)
static bool getLoadPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns)
Search for patterns of LD instructions we can optimize.
static bool canInstrSubstituteCmpInstr(MachineInstr &MI, MachineInstr &CmpInstr, const TargetRegisterInfo &TRI)
Check if CmpInstr can be substituted by MI.
static UsedNZCV getUsedNZCV(AArch64CC::CondCode CC)
static bool isCombineInstrCandidateFP(const MachineInstr &Inst)
static bool isCompactUnwindFrameRecordEnabled(const MachineFunction &MF)
Return true if the frame-record form of the outlined prologue is enabled for the target of MF.
static void appendLoadRegExpr(SmallVectorImpl< char > &Expr, int64_t OffsetFromDefCFA)
static void appendConstantExpr(SmallVectorImpl< char > &Expr, int64_t Constant, dwarf::LocationAtom Operation)
static unsigned convertToNonFlagSettingOpc(const MachineInstr &MI)
Return the opcode that does not set flags when possible - otherwise return the original opcode.
static bool outliningCandidatesV8_3OpsConsensus(const outliner::Candidate &a, const outliner::Candidate &b)
static bool isCombineInstrCandidate32(unsigned Opc)
static void parseCondBranch(MachineInstr *LastInst, MachineBasicBlock *&Target, SmallVectorImpl< MachineOperand > &Cond)
static unsigned offsetExtendOpcode(unsigned Opcode)
static void loadRegPairFromStackSlot(const TargetRegisterInfo &TRI, MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, const MCInstrDesc &MCID, Register DestReg, unsigned SubIdx0, unsigned SubIdx1, int FI, MachineMemOperand *MMO)
static void generateGatherLanePattern(MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, DenseMap< Register, unsigned > &InstrIdxForVirtReg, unsigned Pattern, unsigned NumLanes)
Generate optimized instruction sequence for gather load patterns to improve Memory-Level Parallelism ...
static bool getMiscPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns)
Find other MI combine patterns.
static bool outliningCandidatesSigningKeyConsensus(const outliner::Candidate &a, const outliner::Candidate &b)
static const MachineInstrBuilder & AddSubReg(const MachineInstrBuilder &MIB, MCRegister Reg, unsigned SubIdx, RegState State, const TargetRegisterInfo *TRI)
static bool outliningCandidatesSigningScopeConsensus(const outliner::Candidate &a, const outliner::Candidate &b)
static bool shouldClusterFI(const MachineFrameInfo &MFI, int FI1, int64_t Offset1, unsigned Opcode1, int FI2, int64_t Offset2, unsigned Opcode2)
static cl::opt< unsigned > TBZDisplacementBits("aarch64-tbz-offset-bits", cl::Hidden, cl::init(14), cl::desc("Restrict range of TB[N]Z instructions (DEBUG)"))
static void extractPhiReg(const MachineInstr &Phi, const MachineBasicBlock *MBB, Register &RegMBB, Register &RegOther)
static MCCFIInstruction createDefCFAExpression(const TargetRegisterInfo &TRI, unsigned Reg, const StackOffset &Offset)
static bool isDefinedOutside(Register Reg, const MachineBasicBlock *BB)
static MachineInstr * genFusedMultiply(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, unsigned IdxMulOpd, unsigned MaddOpc, const TargetRegisterClass *RC, FMAInstKind kind=FMAInstKind::Default, const Register *ReplacedAddend=nullptr)
genFusedMultiply - Generate fused multiply instructions.
static bool getGatherLanePattern(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns, unsigned LoadLaneOpCode, unsigned NumLanes)
Check if the given instruction forms a gather load pattern that can be optimized for better Memory-Le...
static MachineInstr * genFusedMultiplyIdxNeg(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, DenseMap< Register, unsigned > &InstrIdxForVirtReg, unsigned IdxMulOpd, unsigned MaddOpc, unsigned MnegOpc, const TargetRegisterClass *RC)
genFusedMultiplyAccNeg - Helper to generate fused multiply accumulate instructions with an additional...
static bool isCombineInstrCandidate(unsigned Opc)
static unsigned regOffsetOpcode(unsigned Opcode)
MachineOutlinerClass
Constants defining how certain sequences should be outlined.
@ MachineOutlinerTailCall
Emit a save, restore, call, and return.
@ MachineOutlinerRegSave
Emit a call and tail-call.
@ MachineOutlinerNoLRSave
Only emit a branch.
@ MachineOutlinerThunk
Emit a call and return.
static cl::opt< unsigned > BDisplacementBits("aarch64-b-offset-bits", cl::Hidden, cl::init(26), cl::desc("Restrict range of B instructions (DEBUG)"))
static bool areCFlagsAliveInSuccessors(const MachineBasicBlock *MBB)
Check if AArch64::NZCV should be alive in successors of MBB.
static void emitFrameOffsetAdj(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, int64_t Offset, unsigned Opc, const TargetInstrInfo *TII, MachineInstr::MIFlag Flag, bool NeedsWinCFI, bool *HasWinCFI, bool EmitCFAOffset, StackOffset CFAOffset, unsigned FrameReg)
static bool isCheapImmediate(const MachineInstr &MI, unsigned BitSize)
static cl::opt< unsigned > CBZDisplacementBits("aarch64-cbz-offset-bits", cl::Hidden, cl::init(19), cl::desc("Restrict range of CB[N]Z instructions (DEBUG)"))
static void genSubAdd2SubSub(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, unsigned IdxOpd1, DenseMap< Register, unsigned > &InstrIdxForVirtReg)
Do the following transformation A - (B + C) ==> (A - B) - C A - (B + C) ==> (A - C) - B.
static unsigned canFoldIntoCSel(const MachineRegisterInfo &MRI, unsigned VReg, unsigned *NewReg=nullptr)
static void signOutlinedFunction(MachineFunction &MF, MachineBasicBlock &MBB, const AArch64InstrInfo *TII, bool ShouldSignReturnAddr)
static MachineInstr * genFNegatedMAD(MachineFunction &MF, MachineRegisterInfo &MRI, const TargetInstrInfo *TII, MachineInstr &Root, SmallVectorImpl< MachineInstr * > &InsInstrs)
static bool canCombineWithMUL(MachineBasicBlock &MBB, MachineOperand &MO, unsigned MulOpc, unsigned ZeroReg)
static void storeRegPairToStackSlot(const TargetRegisterInfo &TRI, MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, const MCInstrDesc &MCID, Register SrcReg, bool IsKill, unsigned SubIdx0, unsigned SubIdx1, int FI, MachineMemOperand *MMO)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static const Function * getParent(const Value *V)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
DXIL Forward Handle Accesses
const HexagonInstrInfo * TII
Module.h This file contains the declarations for the Module class.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
Register const TargetRegisterInfo * TRI
Promote Memory to Register
static MCRegister getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
PowerPC Reduce CR logical Operation
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
This file declares the machine register scavenger class.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
#define DEBUG_WITH_TYPE(TYPE,...)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
static bool canCombine(MachineBasicBlock &MBB, MachineOperand &MO, unsigned CombineOpc=0)
AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...
bool branchTargetEnforcement() const
unsigned getArgumentStackToRestore() const
SignReturnAddress getSignReturnAddressCondition() const
bool hasStreamingModeChanges() const
void setOutliningStyle(const std::string &Style)
bool branchProtectionPAuthLR() const
bool needsDwarfUnwindInfo(const MachineFunction &MF) const
std::optional< bool > hasRedZone() const
static bool shouldSignReturnAddress(SignReturnAddress Condition, bool IsLRSpilled)
bool shouldSignWithBKey() const
static bool isHForm(const MachineInstr &MI)
Returns whether the instruction is in H form (16 bit operands)
void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DstReg, ArrayRef< MachineOperand > Cond, Register TrueReg, Register FalseReg) const override
static bool hasBTISemantics(const MachineInstr &MI)
Returns whether the instruction can be compatible with non-zero BTYPE.
static bool isQForm(const MachineInstr &MI)
Returns whether the instruction is in Q form (128 bit operands)
static bool getMemOpInfo(unsigned Opcode, TypeSize &Scale, TypeSize &Width, int64_t &MinOffset, int64_t &MaxOffset)
Returns true if opcode Opc is a memory operation.
static bool isTailCallReturnInst(const MachineInstr &MI)
Returns true if MI is one of the TCRETURN* instructions.
static bool isFPRCopy(const MachineInstr &MI)
Does this instruction rename an FPR without modifying bits?
MachineInstr * emitLdStWithAddr(MachineInstr &MemI, const ExtAddrMode &AM) const override
std::optional< DestSourcePair > isCopyInstrImpl(const MachineInstr &MI) const override
If the specific machine instruction is an instruction that moves/copies value from one register to an...
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
static bool isZExtLoad(const MachineInstr &MI)
Returns whether the instruction is a zero-extending load.
bool areMemAccessesTriviallyDisjoint(const MachineInstr &MIa, const MachineInstr &MIb) const override
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
static bool isGPRCopy(const MachineInstr &MI)
Does this instruction rename a GPR without modifying bits?
static unsigned convertToFlagSettingOpc(unsigned Opc)
Return the opcode that set flags when possible.
void createPauthEpilogueInstr(MachineBasicBlock &MBB, DebugLoc DL) const
Return true when there is potentially a faster code sequence for an instruction chain ending in Root.
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t BrOffset) const override
bool canInsertSelect(const MachineBasicBlock &, ArrayRef< MachineOperand > Cond, Register, Register, Register, int &, int &, int &) const override
Register isLoadFromStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
Check for post-frame ptr elimination stack locations as well.
static const MachineOperand & getLdStOffsetOp(const MachineInstr &MI)
Returns the immediate offset operator of a load/store.
bool isCoalescableExtInstr(const MachineInstr &MI, Register &SrcReg, Register &DstReg, unsigned &SubIdx) const override
static std::optional< unsigned > getUnscaledLdSt(unsigned Opc)
Returns the unscaled load/store for the scaled load/store opcode, if there is a corresponding unscale...
static bool hasUnscaledLdStOffset(unsigned Opc)
Return true if it has an unscaled load/store offset.
static const MachineOperand & getLdStAmountOp(const MachineInstr &MI)
Returns the shift amount operator of a load/store.
static bool isPreLdSt(const MachineInstr &MI)
Returns whether the instruction is a pre-indexed load/store.
std::optional< ExtAddrMode > getAddrModeFromMemoryOp(const MachineInstr &MemI, const TargetRegisterInfo *TRI) const override
bool getMemOperandsWithOffsetWidth(const MachineInstr &MI, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width, const TargetRegisterInfo *TRI) const override
bool analyzeBranchPredicate(MachineBasicBlock &MBB, MachineBranchPredicate &MBP, bool AllowModify) const override
void insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &NewDestBB, MachineBasicBlock &RestoreBB, const DebugLoc &DL, int64_t BrOffset, RegScavenger *RS) const override
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, Register VReg, unsigned SubReg=0, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
static bool isPairableLdStInst(const MachineInstr &MI)
Return true if pairing the given load or store may be paired with another.
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
static bool isSExtLoad(const MachineInstr &MI)
Returns whether the instruction is a sign-extending load.
const AArch64RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
static bool isPreSt(const MachineInstr &MI)
Returns whether the instruction is a pre-indexed store.
void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
AArch64InstrInfo(const AArch64Subtarget &STI)
static bool isPairedLdSt(const MachineInstr &MI)
Returns whether the instruction is a paired load/store.
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, int FrameIndex, MachineInstr *&CopyMI, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const override
bool getMemOperandWithOffsetWidth(const MachineInstr &MI, const MachineOperand *&BaseOp, int64_t &Offset, bool &OffsetIsScalable, TypeSize &Width, const TargetRegisterInfo *TRI) const
If OffsetIsScalable is set to 'true', the offset is scaled by vscale.
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
static bool isStridedAccess(const MachineInstr &MI)
Return true if the given load or store is a strided memory access.
bool shouldClusterMemOps(ArrayRef< const MachineOperand * > BaseOps1, int64_t Offset1, bool OffsetIsScalable1, ArrayRef< const MachineOperand * > BaseOps2, int64_t Offset2, bool OffsetIsScalable2, unsigned ClusterSize, unsigned NumBytes) const override
Detect opportunities for ldp/stp formation.
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
bool isThroughputPattern(unsigned Pattern) const override
Return true when a code sequence can improve throughput.
MachineOperand & getMemOpBaseRegImmOfsOffsetOperand(MachineInstr &LdSt) const
Return the immediate offset of the base register in a load/store LdSt.
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const override
bool canFoldIntoAddrMode(const MachineInstr &MemI, Register Reg, const MachineInstr &AddrI, ExtAddrMode &AM) const override
static bool isLdStPairSuppressed(const MachineInstr &MI)
Return true if pairing the given load or store is hinted to be unprofitable.
Register isStoreToStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
Check for post-frame ptr elimination stack locations as well.
std::unique_ptr< TargetInstrInfo::PipelinerLoopInfo > analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg, Register SrcReg2, int64_t CmpMask, int64_t CmpValue, const MachineRegisterInfo *MRI) const override
optimizeCompareInstr - Convert the instruction supplying the argument to the comparison into one that...
static unsigned getLoadStoreImmIdx(unsigned Opc)
Returns the index for the immediate for a given instruction.
static bool isGPRZero(const MachineInstr &MI)
Does this instruction set its full destination register to zero?
void copyGPRRegTuple(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, unsigned Opcode, unsigned ZeroReg, llvm::ArrayRef< unsigned > Indices) const
bool analyzeCompare(const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &CmpMask, int64_t &CmpValue) const override
analyzeCompare - For a comparison instruction, return the source registers in SrcReg and SrcReg2,...
CombinerObjective getCombinerObjective(unsigned Pattern) const override
static bool isFpOrNEON(Register Reg)
Returns whether the physical register is FP or NEON.
bool isAsCheapAsAMove(const MachineInstr &MI) const override
std::optional< DestSourcePair > isCopyLikeInstrImpl(const MachineInstr &MI) const override
static void suppressLdStPair(MachineInstr &MI)
Hint that pairing the given load or store is unprofitable.
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
static bool isPreLd(const MachineInstr &MI)
Returns whether the instruction is a pre-indexed load.
void copyPhysRegTuple(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, unsigned Opcode, llvm::ArrayRef< unsigned > Indices) const
bool optimizeCondBranch(MachineInstr &MI) const override
Replace csincr-branch sequence by simple conditional branch.
static int getMemScale(unsigned Opc)
Scaling factor for (scaled or unscaled) load or store.
bool isCandidateToMergeOrPair(const MachineInstr &MI) const
Return true if this is a load/store that can be potentially paired/merged.
MCInst getNop() const override
static const MachineOperand & getLdStBaseOp(const MachineInstr &MI)
Returns the base register operator of a load/store.
bool isReservedReg(const MachineFunction &MF, MCRegister Reg) const
const AArch64RegisterInfo * getRegisterInfo() const override
bool isNeonAvailable() const
Returns true if the target has NEON and the function at runtime is known to have NEON enabled (e....
bool isSVEorStreamingSVEAvailable() const
Returns true if the target has access to either the full range of SVE instructions,...
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & front() const
Get the first element.
size_t size() const
Get the array size.
This is an important base class in LLVM.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
Module * getParent()
Get the module that this global value is contained inside of...
LLVM_ABI InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
A set of register units used to track register liveness.
bool available(MCRegister Reg) const
Returns true if no part of physical register Reg is live.
LLVM_ABI void accumulate(const MachineInstr &MI)
Adds all register units used, defined or clobbered in MI.
static LocationSize precise(uint64_t Value)
This class is intended to be used as a base class for asm properties and features specific to the tar...
bool usesWindowsCFI() const
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa_offset modifies a rule for computing CFA.
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals, SMLoc Loc={}, StringRef Comment="")
.cfi_escape Allows the user to add arbitrary bytes to the unwind info.
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
ArrayRef< MCOperandInfo > operands() const
bool hasSuperClassEq(const MCRegisterClass *RC) const
Returns true if RC is a super-class of or equal to this class.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
bool hasSubClassEq(const MCRegisterClass *RC) const
Returns true if RC is a sub-class of or equal to this class.
Wrapper class representing physical registers. Should be passed by value.
constexpr bool isValid() const
static constexpr unsigned NoRegister
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
bool isInlineAsmBrIndirectTarget() const
Returns true if this is the indirect dest of an INLINEASM_BR.
unsigned pred_size() const
LLVM_ABI void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
LLVM_ABI instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
reverse_instr_iterator instr_rbegin()
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
LLVM_ABI void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
reverse_instr_iterator instr_rend()
Instructions::iterator instr_iterator
instr_iterator instr_end()
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
LLVM_ABI instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
iterator insertAfter(iterator I, MachineInstr *MI)
Insert MI into the instruction list after I.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
MachineInstrBundleIterator< MachineInstr > iterator
void setMachineBlockAddressTaken()
Set this block to indicate that its address is used as something other than the target of a terminato...
LLVM_ABI bool isLiveIn(MCRegister Reg, LaneBitmask LaneMask=LaneBitmask::getAll()) const
Return true if the specified register is in the live in set.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
void setStackID(int ObjectIdx, uint8_t ID)
bool isCalleeSavedInfoValid() const
Has the callee saved info been calculated yet?
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
unsigned getNumObjects() const
Return the number of objects.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
unsigned addFrameInst(const MCCFIInstruction &Inst)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
BasicBlockListType::iterator iterator
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LLT MemTy, Align BaseAlignment, const MMOMetadata &Metadata=MMOMetadata(), SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *BB=nullptr, std::optional< UniqueBBID > BBID=std::nullopt)
CreateMachineInstr - Allocate a new MachineInstr.
void insert(iterator MBBI, MachineBasicBlock *MBB)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & setMemRefs(ArrayRef< MachineMemOperand * > MMOs) const
const MachineInstrBuilder & addCFIIndex(unsigned CFIIndex) const
const MachineInstrBuilder & addUse(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addSym(MCSymbol *Sym, unsigned char TargetFlags=0) const
const MachineInstrBuilder & addFrameIndex(int Idx) const
const MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned TargetFlags=0) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addDef(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register definition operand.
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool mayLoadOrStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read or modify memory.
const MachineBasicBlock * getParent() const
bool isCall(QueryType Type=AnyInBundle) const
bool getFlag(MIFlag Flag) const
Return whether an MI flag is set.
LLVM_ABI uint32_t mergeFlagsWith(const MachineInstr &Other) const
Return the MIFlags which represent both MachineInstrs.
unsigned getNumOperands() const
Retuns the total number of operands.
LLVM_ABI unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
LLVM_ABI bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by mayLoad / mayStore,...
bool registerDefIsDead(Register Reg, const TargetRegisterInfo *TRI) const
Returns true if the register is dead in this machine instruction.
bool definesRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr fully defines the specified register.
LLVM_ABI void setDesc(const MCInstrDesc &TID)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one.
LLVM_ABI bool hasOrderedMemoryRef() const
Return true if this instruction may have an ordered or volatile memory reference, or if the informati...
LLVM_ABI const MachineFunction * getMF() const
Return the function that contains the basic block that this instruction belongs to.
ArrayRef< MachineMemOperand * > memoperands() const
Access to memory operands of the instruction.
LLVM_ABI bool isLoadFoldBarrier() const
Returns true if it is illegal to fold a load across this instruction.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
LLVM_ABI void removeOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with.
LLVM_ABI void addRegisterDefined(Register Reg, const TargetRegisterInfo *RegInfo=nullptr)
We have determined MI defines a register.
const MachineOperand & getOperand(unsigned i) const
uint32_t getFlags() const
Return the MI flags bitvector.
LLVM_ABI int findRegisterDefOperandIdx(Register Reg, const TargetRegisterInfo *TRI, bool isDead=false, bool Overlap=false) const
Returns the operand index that is a def of the specified register or -1 if it is not found.
LLVM_ABI MachineInstrBundleIterator< MachineInstr > eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
const std::vector< MachineJumpTableEntry > & getJumpTables() const
A description of a memory reference used in the backend.
@ MOVolatile
The memory access is volatile.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
This class contains meta information specific to a module.
LLVM_ABI MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
MachineOperand class - Representation of each machine instruction operand.
void setSubReg(unsigned subReg)
unsigned getSubReg() const
void setImm(int64_t immVal)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
void setIsDead(bool Val=true)
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
void setIsKill(bool Val=true)
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
unsigned getTargetFlags() const
static MachineOperand CreateImm(int64_t Val)
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
void setIsUndef(bool Val=true)
Register getReg() const
getReg - Returns the register number.
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
LLVM_ABI bool isIdenticalTo(const MachineOperand &Other) const
Returns true if this operand is identical to the specified operand except for liveness related flags ...
static MachineOperand CreateReg(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLVM_ABI bool hasOneNonDBGUse(Register RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register.
bool tracksLiveness() const
tracksLiveness - Returns true when tracking register liveness accurately.
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
LLVM_ABI void clearKillFlags(Register Reg) const
clearKillFlags - Iterate over all the uses of the given register and clear the kill flag from the Mac...
LLVM_ABI LLVM_READONLY MachineInstr * getVRegDef(Register Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
bool use_nodbg_empty(Register RegNo) const
use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register.
MachineBasicBlock * getDefBlock(Register Reg) const
Return the machine basic block in which the specified virtual register is defined,...
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
bool reservedRegsFrozen() const
reservedRegsFrozen - Returns true after freezeReservedRegs() was called to ensure the set of reserved...
bool def_empty(Register RegNo) const
def_empty - Return true if there are no instructions defining the specified register (it may be live-...
use_instr_nodbg_iterator use_instr_nodbg_begin(Register RegNo) const
bool hasOneDef(Register RegNo) const
Return true if there is exactly one operand defining the specified register.
const TargetRegisterClass * getRegClassOrNull(Register Reg) const
Return the register class of Reg, or null if Reg has not been assigned a register class yet.
LLVM_ABI const TargetRegisterClass * constrainRegClass(Register Reg, const TargetRegisterClass *RC, unsigned MinNumRegs=0)
constrainRegClass - Constrain the register class of the specified virtual register to be a common sub...
LLVM_ABI LLVM_READONLY MachineInstr * getUniqueVRegDef(Register Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
A Module instance is used to store all the information related to an LLVM module.
MI-level patchpoint operands.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given patchpoint should emit.
Wrapper class representing virtual and physical registers.
MCRegister asMCReg() const
Utility to check-convert this value to a MCRegister.
constexpr bool isValid() const
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
static constexpr bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
Represents a location in source code.
bool erase(PtrType Ptr)
Remove pointer from the set.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void append(StringRef RHS)
Append from a StringRef.
StringRef str() const
Explicit conversion to StringRef.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
MI-level stackmap operands.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given stackmap should emit.
StackOffset holds a fixed and a scalable offset in bytes.
int64_t getFixed() const
Returns the fixed component of the stack.
int64_t getScalable() const
Returns the scalable component of the stack.
static StackOffset get(int64_t Fixed, int64_t Scalable)
static StackOffset getScalable(int64_t Scalable)
static StackOffset getFixed(int64_t Fixed)
MI-level Statepoint operands.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given statepoint should emit.
Represent a constant reference to a string, i.e.
Object returned by analyzeLoopForPipelining.
TargetInstrInfo - Interface to description of machine instruction set.
virtual void genAlternativeCodeSequence(MachineInstr &Root, unsigned Pattern, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, DenseMap< Register, unsigned > &InstIdxForVirtReg) const
When getMachineCombinerPatterns() finds patterns, this function generates the instructions that could...
virtual std::optional< ParamLoadedValue > describeLoadedValue(const MachineInstr &MI, Register Reg) const
Produce the expression describing the MI loading a value into the physical register Reg.
virtual bool getMachineCombinerPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns, bool DoRegPressureReduce) const
Return true when there is potentially a faster code sequence for an instruction chain ending in Root.
virtual bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const
Test if the given instruction should be considered a scheduling boundary.
virtual CombinerObjective getCombinerObjective(unsigned Pattern) const
Return the objective of a combiner pattern.
virtual bool isFunctionSafeToSplit(const MachineFunction &MF) const
Return true if the function is a viable candidate for machine function splitting.
const Triple & getTargetTriple() const
const MCAsmInfo & getMCAsmInfo() const
Return target specific asm information.
CodeModel::Model getCodeModel() const
Returns the code model.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetInstrInfo * getInstrInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
Target - Wrapper for Target specific information.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
static constexpr TypeSize getScalable(ScalarTy MinimumSize)
Value * getOperand(unsigned i) const
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
self_iterator getIterator()
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static CondCode getInvertedCondCode(CondCode Code)
@ MO_DLLIMPORT
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
@ MO_NC
MO_NC - Indicates whether the linker is expected to check the symbol reference for overflow.
@ MO_G1
MO_G1 - A symbol operand with this flag (granule 1) represents the bits 16-31 of a 64-bit address,...
@ MO_S
MO_S - Indicates that the bits of the symbol operand represented by MO_G0 etc are signed.
@ MO_PAGEOFF
MO_PAGEOFF - A symbol operand with this flag represents the offset of that symbol within a 4K page.
@ MO_GOT
MO_GOT - This flag indicates that a symbol operand represents the address of the GOT entry for the sy...
@ MO_PREL
MO_PREL - Indicates that the bits of the symbol operand represented by MO_G0 etc are PC relative.
@ MO_G0
MO_G0 - A symbol operand with this flag (granule 0) represents the bits 0-15 of a 64-bit address,...
@ MO_ARM64EC_CALLMANGLE
MO_ARM64EC_CALLMANGLE - Operand refers to the Arm64EC-mangled version of a symbol,...
@ MO_PAGE
MO_PAGE - A symbol operand with this flag represents the pc-relative offset of the 4K page containing...
@ MO_HI12
MO_HI12 - This flag indicates that a symbol operand represents the bits 13-24 of a 64-bit address,...
@ MO_TLS
MO_TLS - Indicates that the operand being accessed is some kind of thread-local symbol.
@ MO_G2
MO_G2 - A symbol operand with this flag (granule 2) represents the bits 32-47 of a 64-bit address,...
@ MO_TAGGED
MO_TAGGED - With MO_PAGE, indicates that the page includes a memory tag in bits 56-63.
@ MO_G3
MO_G3 - A symbol operand with this flag (granule 3) represents the high 16-bits of a 64-bit address,...
@ MO_COFFSTUB
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....
unsigned getCheckerSizeInBytes(AuthCheckMethod Method)
Returns the number of bytes added by checkAuthenticatedRegister.
static uint64_t decodeLogicalImmediate(uint64_t val, unsigned regSize)
decodeLogicalImmediate - Decode a logical immediate value in the form "N:immr:imms" (where the immr a...
static unsigned getShiftValue(unsigned Imm)
getShiftValue - Extract the shift value.
static unsigned getArithExtendImm(AArch64_AM::ShiftExtendType ET, unsigned Imm)
getArithExtendImm - Encode the extend type and shift amount for an arithmetic instruction: imm: 3-bit...
constexpr bool isLegalArithImmed(const uint64_t C)
isLegalArithImmed -
static unsigned getArithShiftValue(unsigned Imm)
getArithShiftValue - get the arithmetic shift value.
static uint64_t encodeLogicalImmediate(uint64_t imm, unsigned regSize)
encodeLogicalImmediate - Return the encoded immediate value for a logical immediate instruction of th...
static AArch64_AM::ShiftExtendType getExtendType(unsigned Imm)
getExtendType - Extract the extend type for operands of arithmetic ops.
static AArch64_AM::ShiftExtendType getArithExtendType(unsigned Imm)
static AArch64_AM::ShiftExtendType getShiftType(unsigned Imm)
getShiftType - Extract the shift type.
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 ==...
void expandMOVAddr(unsigned Opcode, unsigned TargetFlags, bool IsTargetMachO, SmallVectorImpl< AddrInsnModel > &Insn)
void expandMOVImm(uint64_t Imm, unsigned BitSize, SmallVectorImpl< ImmInsnModel > &Insn)
Expand a MOVi32imm or MOVi64imm pseudo instruction to one or more real move-immediate instructions to...
static const uint64_t InstrFlagIsWhile
static const uint64_t InstrFlagIsPTestLike
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
@ ScalablePredicateVector
initializer< Ty > init(const Ty &Val)
InstrType
Represents how an instruction should be mapped by the outliner.
NodeAddr< InstrNode * > Instr
LLVM_ABI Instruction & back() const
LLVM_ABI iterator begin() const
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
static bool isCondBranchOpcode(int Opc)
MCCFIInstruction createDefCFA(const TargetRegisterInfo &TRI, unsigned FrameReg, unsigned Reg, const StackOffset &Offset, bool LastAdjustmentWasScalable=true)
static bool isPTrueOpcode(unsigned Opc)
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool succeeded(LogicalResult Result)
Utility function that returns true if the provided LogicalResult corresponds to a success value.
int isAArch64FrameOffsetLegal(const MachineInstr &MI, StackOffset &Offset, bool *OutUseUnscaledOp=nullptr, unsigned *OutUnscaledOp=nullptr, int64_t *EmittableOffset=nullptr)
Check if the Offset is a valid frame offset for MI.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
RegState
Flags to represent properties of register accesses.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
@ Kill
The last use of a register.
@ Undef
Value of the register doesn't matter.
@ Define
Register definition.
@ Renamable
Register that may be renamed.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
constexpr RegState getKillRegState(bool B)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
static bool isIndirectBranchOpcode(int Opc)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
unsigned getBLRCallOpcode(const MachineFunction &MF)
Return opcode to be used for indirect calls.
@ AArch64FrameOffsetIsLegal
Offset is legal.
@ AArch64FrameOffsetCanUpdate
Offset can apply, at least partly.
@ AArch64FrameOffsetCannotUpdate
Offset cannot apply.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
unsigned Log2_64(uint64_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
static bool isSEHInstruction(const MachineInstr &MI)
bool isLFIPrePostMemAccess(unsigned Opcode)
Returns true if Opcode is a pre- or post-indexed memory access that the LFI rewriter expands with a b...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
auto reverse(ContainerTy &&C)
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
void sort(IteratorTy Start, IteratorTy End)
AArch64MachineCombinerPattern
@ MULSUBv2i32_indexed_OP1
@ MULADDv4i16_indexed_OP2
@ MULSUBv8i16_indexed_OP2
@ MULSUBv4i16_indexed_OP2
@ MULSUBv4i32_indexed_OP2
@ MULADDv2i32_indexed_OP1
@ MULADDv4i32_indexed_OP1
@ MULADDv2i32_indexed_OP2
@ MULSUBv4i16_indexed_OP1
@ MULADDv4i32_indexed_OP2
@ MULSUBv8i16_indexed_OP1
@ MULSUBv2i32_indexed_OP2
@ MULADDv8i16_indexed_OP1
@ MULSUBv4i32_indexed_OP1
@ MULADDv8i16_indexed_OP2
@ MULADDv4i16_indexed_OP1
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, StackOffset Offset, const TargetInstrInfo *TII, MachineInstr::MIFlag=MachineInstr::NoFlags, bool SetNZCV=false, bool NeedsWinCFI=false, bool *HasWinCFI=nullptr, bool EmitCFAOffset=false, StackOffset InitialOffset={}, unsigned FrameReg=AArch64::SP)
emitFrameOffset - Emit instructions as needed to set DestReg to SrcReg plus Offset.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
constexpr RegState getDefRegState(bool B)
CombinerObjective
The combiner's goal may differ based on which pattern it is attempting to optimize.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
std::optional< UsedNZCV > examineCFlagsUse(MachineInstr &MI, MachineInstr &CmpInstr, const TargetRegisterInfo &TRI, SmallVectorImpl< MachineInstr * > *CCUseInstrs=nullptr)
CodeGenOptLevel
Code generation optimization level.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
auto instructionsWithoutDebug(IterT It, IterT End, bool SkipPseudoOp=true)
Construct a range iterator which begins at It and moves forwards until End is reached,...
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
auto drop_end(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the last N elements excluded.
static MCRegister getXRegFromWReg(MCRegister Reg)
MCCFIInstruction createCFAOffset(const TargetRegisterInfo &MRI, unsigned Reg, const StackOffset &OffsetFromDefCFA, std::optional< int64_t > IncomingVGOffsetFromDefCFA)
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
static bool isUncondBranchOpcode(int Opc)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
constexpr auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
bool rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, unsigned FrameReg, StackOffset &Offset, const AArch64InstrInfo *TII)
rewriteAArch64FrameIndex - Rewrite MI to access 'Offset' bytes from the FP.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
static const MachineMemOperand::Flags MOSuppressPair
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
void appendLEB128(SmallVectorImpl< U > &Buffer, T Value)
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
bool optimizeTerminators(MachineBasicBlock *MBB, const TargetInstrInfo &TII)
std::pair< MachineOperand, DIExpression * > ParamLoadedValue
bool isNZCVTouchedInInstructionRange(const MachineInstr &DefMI, const MachineInstr &UseMI, const TargetRegisterInfo *TRI)
Return true if there is an instruction /after/ DefMI and before UseMI which either reads or clobbers ...
static const MachineMemOperand::Flags MOStridedAccess
constexpr RegState getUndefRegState(bool B)
void fullyRecomputeLiveIns(ArrayRef< MachineBasicBlock * > MBBs)
Convenience function for recomputing live-in's for a set of MBBs until the computation converges.
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
MCRegisterClass TargetRegisterClass
This struct is a compact representation of a valid (non-zero power of two) alignment.
Used to describe addressing mode similar to ExtAddrMode in CodeGenPrepare.
LLVM_ABI static const MBBSectionID ColdSectionID
This class contains a discriminated union of information about pointers in memory operands,...
static LLVM_ABI MachinePointerInfo getUnknownStack(MachineFunction &MF)
Stack memory without other information.
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
An individual sequence of instructions to be replaced with a call to an outlined function.
MachineFunction * getMF() const
The information necessary to create an outlined function for some class of candidate.