72#define DEBUG_TYPE "arm-instrinfo"
74#define GET_INSTRINFO_CTOR_DTOR
75#include "ARMGenInstrInfo.inc"
89 { ARM::VMLAS, ARM::VMULS, ARM::VADDS,
false,
false },
90 { ARM::VMLSS, ARM::VMULS, ARM::VSUBS,
false,
false },
91 { ARM::VMLAD, ARM::VMULD, ARM::VADDD,
false,
false },
92 { ARM::VMLSD, ARM::VMULD, ARM::VSUBD,
false,
false },
93 { ARM::VNMLAS, ARM::VNMULS, ARM::VSUBS,
true,
false },
94 { ARM::VNMLSS, ARM::VMULS, ARM::VSUBS,
true,
false },
95 { ARM::VNMLAD, ARM::VNMULD, ARM::VSUBD,
true,
false },
96 { ARM::VNMLSD, ARM::VMULD, ARM::VSUBD,
true,
false },
99 { ARM::VMLAfd, ARM::VMULfd, ARM::VADDfd,
false,
false },
100 { ARM::VMLSfd, ARM::VMULfd, ARM::VSUBfd,
false,
false },
101 { ARM::VMLAfq, ARM::VMULfq, ARM::VADDfq,
false,
false },
102 { ARM::VMLSfq, ARM::VMULfq, ARM::VSUBfq,
false,
false },
103 { ARM::VMLAslfd, ARM::VMULslfd, ARM::VADDfd,
false,
true },
104 { ARM::VMLSslfd, ARM::VMULslfd, ARM::VSUBfd,
false,
true },
105 { ARM::VMLAslfq, ARM::VMULslfq, ARM::VADDfq,
false,
true },
106 { ARM::VMLSslfq, ARM::VMULslfq, ARM::VSUBfq,
false,
true },
113 for (
unsigned i = 0, e = std::size(
ARM_MLxTable); i != e; ++i) {
114 if (!MLxEntryMap.insert(std::make_pair(
ARM_MLxTable[i].MLxOpc, i)).second)
126 if (usePreRAHazardRecognizer()) {
128 static_cast<const ARMSubtarget *
>(STI)->getInstrItineraryData();
148 std::make_unique<ARMBankConflictHazardRecognizer>(DAG, 0x4,
true));
164 if (Subtarget.isThumb2() || Subtarget.hasVFP2Base())
185 bool AllowModify)
const {
190 if (
I ==
MBB.instr_begin())
200 bool CantAnalyze =
false;
204 while (
I->isDebugInstr() || !
I->isTerminator() ||
206 I->getOpcode() == ARM::t2DoLoopStartTP){
207 if (
I ==
MBB.instr_begin())
218 TBB =
I->getOperand(0).getMBB();
224 assert(!FBB &&
"FBB should have been null.");
226 TBB =
I->getOperand(0).getMBB();
227 Cond.push_back(
I->getOperand(1));
228 Cond.push_back(
I->getOperand(2));
229 }
else if (
I->isReturn()) {
232 }
else if (
I->getOpcode() == ARM::t2LoopEnd &&
239 TBB =
I->getOperand(1).getMBB();
241 Cond.push_back(
I->getOperand(0));
263 while (DI !=
MBB.instr_end()) {
286 if (
I ==
MBB.instr_begin())
298 int *BytesRemoved)
const {
299 assert(!BytesRemoved &&
"code size not handled");
310 I->eraseFromParent();
314 if (
I ==
MBB.begin())
return 1;
320 I->eraseFromParent();
329 int *BytesAdded)
const {
330 assert(!BytesAdded &&
"code size not handled");
339 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
341 "ARM branch conditions have two or three components!");
351 }
else if (
Cond.size() == 2) {
362 if (
Cond.size() == 2)
367 else if (
Cond.size() == 3)
378 if (
Cond.size() == 2) {
390 while (++
I != E &&
I->isInsideBundle()) {
391 int PIdx =
I->findFirstPredOperandIdx();
392 if (PIdx != -1 &&
I->getOperand(PIdx).getImm() !=
ARMCC::AL)
398 int PIdx =
MI.findFirstPredOperandIdx();
399 return PIdx != -1 &&
MI.getOperand(PIdx).getImm() !=
ARMCC::AL;
404 unsigned OpIdx)
const {
407 std::string GenericComment =
409 if (!GenericComment.empty())
410 return GenericComment;
414 return std::string();
418 int FirstPredOp =
MI.findFirstPredOperandIdx();
419 if (FirstPredOp != (
int) OpIdx)
420 return std::string();
422 std::string
CC =
"CC::";
429 unsigned Opc =
MI.getOpcode();
438 int PIdx =
MI.findFirstPredOperandIdx();
442 MI.getOperand(PIdx+1).setReg(Pred[1].
getReg());
449 "CPSR def isn't expected operand");
450 assert((
MI.getOperand(1).isDead() ||
451 MI.getOperand(1).getReg() != ARM::CPSR) &&
452 "if conversion tried to stop defining used CPSR");
463 if (Pred1.
size() > 2 || Pred2.
size() > 2)
488 std::vector<MachineOperand> &Pred,
489 bool SkipDead)
const {
492 bool ClobbersCPSR = MO.isRegMask() && MO.clobbersPhysReg(ARM::CPSR);
493 bool IsCPSR = MO.isReg() && MO.isDef() && MO.getReg() == ARM::CPSR;
494 if (ClobbersCPSR || IsCPSR) {
512 for (
const auto &MO :
MI.operands())
513 if (MO.isReg() && MO.getReg() == ARM::CPSR && MO.isDef() && !MO.isDead())
519 switch (
MI->getOpcode()) {
520 default:
return true;
551 if (!
MI.isPredicable())
589 if (!MO.isReg() || MO.isUndef() || MO.isUse())
591 if (MO.getReg() != ARM::CPSR)
611 switch (
MI.getOpcode()) {
618 return MCID.getSize();
619 case TargetOpcode::BUNDLE:
620 return getInstBundleSize(
MI);
621 case TargetOpcode::COPY:
626 case TargetOpcode::PATCHABLE_FUNCTION_ENTER:
627 case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
628 case TargetOpcode::PATCHABLE_TAIL_CALL:
631 case ARM::CONSTPOOL_ENTRY:
632 case ARM::JUMPTABLE_INSTS:
633 case ARM::JUMPTABLE_ADDRS:
634 case ARM::JUMPTABLE_TBB:
635 case ARM::JUMPTABLE_TBH:
638 return MI.getOperand(2).getImm();
640 return MI.getOperand(1).getImm();
642 case ARM::INLINEASM_BR: {
644 unsigned Size = getInlineAsmLength(
MI.getOperand(0).getSymbolName(), MAI);
649 case ARM::Int_eh_sjlj_longjmp:
650 return Subtarget.isTargetDarwin() || Subtarget.isTargetWindows() ? 16 : 20;
651 case ARM::tInt_eh_sjlj_longjmp:
652 return Subtarget.isTargetDarwin() || Subtarget.isTargetWindows() ? 10 : 12;
660 unsigned Opc = Subtarget.isThumb()
661 ? (Subtarget.isMClass() ? ARM::t2MRS_M : ARM::t2MRS_AR)
669 if (Subtarget.isMClass())
680 unsigned Opc = Subtarget.isThumb()
681 ? (Subtarget.isMClass() ? ARM::t2MSR_M : ARM::t2MSR_AR)
686 if (Subtarget.isMClass())
715 unsigned Cond,
unsigned Inactive) {
725 bool RenamableSrc)
const {
726 bool GPRDest = ARM::GPRRegClass.contains(DestReg);
727 bool GPRSrc = ARM::GPRRegClass.contains(SrcReg);
729 if (GPRDest && GPRSrc) {
737 bool SPRDest = ARM::SPRRegClass.contains(DestReg);
738 bool SPRSrc = ARM::SPRRegClass.contains(SrcReg);
741 if (SPRDest && SPRSrc)
743 else if (GPRDest && SPRSrc)
745 else if (SPRDest && GPRSrc)
747 else if (ARM::DPRRegClass.
contains(DestReg, SrcReg) && Subtarget.hasFP64())
749 else if (ARM::QPRRegClass.
contains(DestReg, SrcReg))
750 Opc = Subtarget.hasNEON() ? ARM::VORRq : ARM::MQPRCopy;
755 if (
Opc == ARM::VORRq ||
Opc == ARM::MVE_VORR)
757 if (
Opc == ARM::MVE_VORR)
759 else if (
Opc != ARM::MQPRCopy)
765 unsigned BeginIdx = 0;
766 unsigned SubRegs = 0;
770 if (ARM::QQPRRegClass.
contains(DestReg, SrcReg)) {
771 Opc = Subtarget.hasNEON() ? ARM::VORRq : ARM::MVE_VORR;
772 BeginIdx = ARM::qsub_0;
774 }
else if (ARM::QQQQPRRegClass.
contains(DestReg, SrcReg)) {
775 Opc = Subtarget.hasNEON() ? ARM::VORRq : ARM::MVE_VORR;
776 BeginIdx = ARM::qsub_0;
779 }
else if (ARM::DPairRegClass.
contains(DestReg, SrcReg)) {
781 BeginIdx = ARM::dsub_0;
783 }
else if (ARM::DTripleRegClass.
contains(DestReg, SrcReg)) {
785 BeginIdx = ARM::dsub_0;
787 }
else if (ARM::DQuadRegClass.
contains(DestReg, SrcReg)) {
789 BeginIdx = ARM::dsub_0;
791 }
else if (ARM::GPRPairRegClass.
contains(DestReg, SrcReg)) {
792 Opc = Subtarget.isThumb2() ? ARM::tMOVr : ARM::MOVr;
793 BeginIdx = ARM::gsub_0;
795 }
else if (ARM::DPairSpcRegClass.
contains(DestReg, SrcReg)) {
797 BeginIdx = ARM::dsub_0;
800 }
else if (ARM::DTripleSpcRegClass.
contains(DestReg, SrcReg)) {
802 BeginIdx = ARM::dsub_0;
805 }
else if (ARM::DQuadSpcRegClass.
contains(DestReg, SrcReg)) {
807 BeginIdx = ARM::dsub_0;
810 }
else if (ARM::DPRRegClass.
contains(DestReg, SrcReg) &&
811 !Subtarget.hasFP64()) {
813 BeginIdx = ARM::ssub_0;
815 }
else if (SrcReg == ARM::CPSR) {
818 }
else if (DestReg == ARM::CPSR) {
821 }
else if (DestReg == ARM::VPR) {
827 }
else if (SrcReg == ARM::VPR) {
833 }
else if (DestReg == ARM::FPSCR_NZCV) {
835 BuildMI(
MBB,
I,
I->getDebugLoc(),
get(ARM::VMSR_FPSCR_NZCVQC), DestReg)
839 }
else if (SrcReg == ARM::FPSCR_NZCV) {
841 BuildMI(
MBB,
I,
I->getDebugLoc(),
get(ARM::VMRS_FPSCR_NZCVQC), DestReg)
847 assert(
Opc &&
"Impossible reg-to-reg copy");
853 if (
TRI->regsOverlap(SrcReg,
TRI->getSubReg(DestReg, BeginIdx))) {
854 BeginIdx = BeginIdx + ((SubRegs - 1) * Spacing);
860 for (
unsigned i = 0; i != SubRegs; ++i) {
861 Register Dst =
TRI->getSubReg(DestReg, BeginIdx + i * Spacing);
862 Register Src =
TRI->getSubReg(SrcReg, BeginIdx + i * Spacing);
863 assert(Dst && Src &&
"Bad sub-register");
865 assert(!DstRegs.
count(Src) &&
"destructive vector copy");
870 if (
Opc == ARM::VORRq ||
Opc == ARM::MVE_VORR) {
874 if (
Opc == ARM::MVE_VORR)
879 if (
Opc == ARM::MOVr)
888std::optional<DestSourcePair>
897 if (!
MI.isMoveReg() ||
898 (
MI.getOpcode() == ARM::VORRq &&
899 MI.getOperand(1).getReg() !=
MI.getOperand(2).getReg()))
904std::optional<ParamLoadedValue>
908 Register DstReg = DstSrcPair->Destination->getReg();
938 switch (
MI.getOpcode()) {
942 case ARM::tBLXr_noip:
944 return MI.getOperand(2);
955 return MIB.
addReg(Reg, State);
959 return MIB.
addReg(Reg, State, SubIdx);
964 Register SrcReg,
bool isKill,
int FI,
977 switch (
TRI.getSpillSize(*RC)) {
979 if (ARM::HPRRegClass.hasSubClassEq(RC)) {
990 if (ARM::GPRRegClass.hasSubClassEq(RC)) {
997 }
else if (ARM::SPRRegClass.hasSubClassEq(RC)) {
1004 }
else if (ARM::VCCRRegClass.hasSubClassEq(RC)) {
1011 }
else if (ARM::cl_FPSCR_NZCVRegClass.hasSubClassEq(RC)) {
1022 if (ARM::DPRRegClass.hasSubClassEq(RC)) {
1029 }
else if (ARM::GPRPairRegClass.hasSubClassEq(RC)) {
1030 if (Subtarget.hasV5TEOps()) {
1033 AddDReg(MIB, SrcReg, ARM::gsub_1, {});
1044 AddDReg(MIB, SrcReg, ARM::gsub_1, {});
1050 if (ARM::DPairRegClass.hasSubClassEq(RC) && Subtarget.hasNEON()) {
1066 }
else if (ARM::QPRRegClass.hasSubClassEq(RC) &&
1067 Subtarget.hasMVEIntegerOps()) {
1072 .addMemOperand(MMO);
1078 if (ARM::DTripleRegClass.hasSubClassEq(RC)) {
1081 Subtarget.hasNEON()) {
1095 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_1, {});
1096 AddDReg(MIB, SrcReg, ARM::dsub_2, {});
1102 if (ARM::QQPRRegClass.hasSubClassEq(RC) ||
1103 ARM::MQQPRRegClass.hasSubClassEq(RC) ||
1104 ARM::DQuadRegClass.hasSubClassEq(RC)) {
1106 Subtarget.hasNEON()) {
1115 }
else if (Subtarget.hasMVEIntegerOps()) {
1127 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_1, {});
1128 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_2, {});
1129 AddDReg(MIB, SrcReg, ARM::dsub_3, {});
1135 if (ARM::MQQQQPRRegClass.hasSubClassEq(RC) &&
1136 Subtarget.hasMVEIntegerOps()) {
1141 }
else if (ARM::QQQQPRRegClass.hasSubClassEq(RC)) {
1147 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_1, {});
1148 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_2, {});
1149 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_3, {});
1150 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_4, {});
1151 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_5, {});
1152 MIB =
AddDReg(MIB, SrcReg, ARM::dsub_6, {});
1153 AddDReg(MIB, SrcReg, ARM::dsub_7, {});
1163 int &FrameIndex)
const {
1164 switch (
MI.getOpcode()) {
1168 if (
MI.getOperand(1).isFI() &&
MI.getOperand(2).isReg() &&
1169 MI.getOperand(3).isImm() &&
MI.getOperand(2).getReg() == 0 &&
1170 MI.getOperand(3).getImm() == 0) {
1171 FrameIndex =
MI.getOperand(1).getIndex();
1172 return MI.getOperand(0).getReg();
1181 case ARM::VSTR_P0_off:
1182 case ARM::VSTR_FPSCR_NZCVQC_off:
1183 case ARM::MVE_VSTRWU32:
1184 if (
MI.getOperand(1).isFI() &&
MI.getOperand(2).isImm() &&
1185 MI.getOperand(2).getImm() == 0) {
1186 FrameIndex =
MI.getOperand(1).getIndex();
1187 return MI.getOperand(0).getReg();
1191 case ARM::VST1d64TPseudo:
1192 case ARM::VST1d64QPseudo:
1193 if (
MI.getOperand(0).isFI() &&
MI.getOperand(2).getSubReg() == 0) {
1194 FrameIndex =
MI.getOperand(0).getIndex();
1195 return MI.getOperand(2).getReg();
1199 if (
MI.getOperand(1).isFI() &&
MI.getOperand(0).getSubReg() == 0) {
1200 FrameIndex =
MI.getOperand(1).getIndex();
1201 return MI.getOperand(0).getReg();
1204 case ARM::MQQPRStore:
1205 case ARM::MQQQQPRStore:
1206 if (
MI.getOperand(1).isFI()) {
1207 FrameIndex =
MI.getOperand(1).getIndex();
1208 return MI.getOperand(0).getReg();
1217 int &FrameIndex)
const {
1219 if (
MI.mayStore() && hasStoreToStackSlot(
MI,
Accesses) &&
1236 if (
I !=
MBB.end())
DL =
I->getDebugLoc();
1245 switch (
TRI.getSpillSize(*RC)) {
1247 if (ARM::HPRRegClass.hasSubClassEq(RC)) {
1257 if (ARM::GPRRegClass.hasSubClassEq(RC)) {
1263 }
else if (ARM::SPRRegClass.hasSubClassEq(RC)) {
1269 }
else if (ARM::VCCRRegClass.hasSubClassEq(RC)) {
1275 }
else if (ARM::cl_FPSCR_NZCVRegClass.hasSubClassEq(RC)) {
1285 if (ARM::DPRRegClass.hasSubClassEq(RC)) {
1291 }
else if (ARM::GPRPairRegClass.hasSubClassEq(RC)) {
1294 if (Subtarget.hasV5TEOps()) {
1317 if (ARM::DPairRegClass.hasSubClassEq(RC) && Subtarget.hasNEON()) {
1330 }
else if (ARM::QPRRegClass.hasSubClassEq(RC) &&
1331 Subtarget.hasMVEIntegerOps()) {
1333 MIB.addFrameIndex(FI)
1335 .addMemOperand(MMO);
1341 if (ARM::DTripleRegClass.hasSubClassEq(RC)) {
1343 Subtarget.hasNEON()) {
1364 if (ARM::QQPRRegClass.hasSubClassEq(RC) ||
1365 ARM::MQQPRRegClass.hasSubClassEq(RC) ||
1366 ARM::DQuadRegClass.hasSubClassEq(RC)) {
1368 Subtarget.hasNEON()) {
1374 }
else if (Subtarget.hasMVEIntegerOps()) {
1394 if (ARM::MQQQQPRRegClass.hasSubClassEq(RC) &&
1395 Subtarget.hasMVEIntegerOps()) {
1399 }
else if (ARM::QQQQPRRegClass.hasSubClassEq(RC)) {
1423 int &FrameIndex)
const {
1424 switch (
MI.getOpcode()) {
1428 if (
MI.getOperand(1).isFI() &&
MI.getOperand(2).isReg() &&
1429 MI.getOperand(3).isImm() &&
MI.getOperand(2).getReg() == 0 &&
1430 MI.getOperand(3).getImm() == 0) {
1431 FrameIndex =
MI.getOperand(1).getIndex();
1432 return MI.getOperand(0).getReg();
1441 case ARM::VLDR_P0_off:
1442 case ARM::VLDR_FPSCR_NZCVQC_off:
1443 case ARM::MVE_VLDRWU32:
1444 if (
MI.getOperand(1).isFI() &&
MI.getOperand(2).isImm() &&
1445 MI.getOperand(2).getImm() == 0) {
1446 FrameIndex =
MI.getOperand(1).getIndex();
1447 return MI.getOperand(0).getReg();
1451 case ARM::VLD1d8TPseudo:
1452 case ARM::VLD1d16TPseudo:
1453 case ARM::VLD1d32TPseudo:
1454 case ARM::VLD1d64TPseudo:
1455 case ARM::VLD1d8QPseudo:
1456 case ARM::VLD1d16QPseudo:
1457 case ARM::VLD1d32QPseudo:
1458 case ARM::VLD1d64QPseudo:
1459 if (
MI.getOperand(1).isFI() &&
MI.getOperand(0).getSubReg() == 0) {
1460 FrameIndex =
MI.getOperand(1).getIndex();
1461 return MI.getOperand(0).getReg();
1465 if (
MI.getOperand(1).isFI() &&
MI.getOperand(0).getSubReg() == 0) {
1466 FrameIndex =
MI.getOperand(1).getIndex();
1467 return MI.getOperand(0).getReg();
1470 case ARM::MQQPRLoad:
1471 case ARM::MQQQQPRLoad:
1472 if (
MI.getOperand(1).isFI()) {
1473 FrameIndex =
MI.getOperand(1).getIndex();
1474 return MI.getOperand(0).getReg();
1483 int &FrameIndex)
const {
1485 if (
MI.mayLoad() && hasLoadFromStackSlot(
MI,
Accesses) &&
1498 bool isThumb1 =
Subtarget.isThumb1Only();
1506 if (isThumb1 || !
MI->getOperand(1).isDead()) {
1508 LDM =
BuildMI(*BB,
MI, dl,
TII->get(isThumb2 ? ARM::t2LDMIA_UPD
1509 : isThumb1 ? ARM::tLDMIA_UPD
1513 LDM =
BuildMI(*BB,
MI, dl,
TII->get(isThumb2 ? ARM::t2LDMIA : ARM::LDMIA));
1516 if (isThumb1 || !
MI->getOperand(0).isDead()) {
1517 MachineOperand STWb(
MI->getOperand(0));
1518 STM =
BuildMI(*BB,
MI, dl,
TII->get(isThumb2 ? ARM::t2STMIA_UPD
1519 : isThumb1 ? ARM::tSTMIA_UPD
1523 STM =
BuildMI(*BB,
MI, dl,
TII->get(isThumb2 ? ARM::t2STMIA : ARM::STMIA));
1526 MachineOperand LDBase(
MI->getOperand(3));
1529 MachineOperand STBase(
MI->getOperand(2));
1538 [&
TRI](
const unsigned &Reg1,
const unsigned &Reg2) ->
bool {
1539 return TRI.getEncodingValue(Reg1) <
1540 TRI.getEncodingValue(Reg2);
1543 for (
const auto &
Reg : ScratchRegs) {
1552 if (
MI.getOpcode() == TargetOpcode::LOAD_STACK_GUARD) {
1553 expandLoadStackGuard(
MI);
1554 MI.getParent()->erase(
MI);
1558 if (
MI.getOpcode() == ARM::MEMCPY) {
1567 if (!
MI.isCopy() || Subtarget.dontWidenVMOVS() || !Subtarget.hasFP64())
1572 Register DstRegS =
MI.getOperand(0).getReg();
1573 Register SrcRegS =
MI.getOperand(1).getReg();
1574 if (!ARM::SPRRegClass.
contains(DstRegS, SrcRegS))
1579 TRI->getMatchingSuperReg(DstRegS, ARM::ssub_0, &ARM::DPRRegClass);
1581 TRI->getMatchingSuperReg(SrcRegS, ARM::ssub_0, &ARM::DPRRegClass);
1582 if (!DstRegD || !SrcRegD)
1588 if (!
MI.definesRegister(DstRegD,
TRI) ||
MI.readsRegister(DstRegD,
TRI))
1592 if (
MI.getOperand(0).isDead())
1601 int ImpDefIdx =
MI.findRegisterDefOperandIdx(DstRegD,
nullptr);
1602 if (ImpDefIdx != -1)
1603 MI.removeOperand(ImpDefIdx);
1606 MI.setDesc(
get(ARM::VMOVD));
1607 MI.getOperand(0).setReg(DstRegD);
1608 MI.getOperand(1).setReg(SrcRegD);
1615 MI.getOperand(1).setIsUndef();
1620 if (
MI.getOperand(1).isKill()) {
1621 MI.getOperand(1).setIsKill(
false);
1622 MI.addRegisterKilled(SrcRegS,
TRI,
true);
1636 assert(MCPE.isMachineConstantPoolEntry() &&
1637 "Expecting a machine constantpool entry!");
1687 case ARM::tLDRpci_pic:
1688 case ARM::t2LDRpci_pic: {
1708 switch (
I->getOpcode()) {
1709 case ARM::tLDRpci_pic:
1710 case ARM::t2LDRpci_pic: {
1712 unsigned CPI =
I->getOperand(1).getIndex();
1714 I->getOperand(1).setIndex(CPI);
1715 I->getOperand(2).setImm(PCLabelId);
1719 if (!
I->isBundledWithSucc())
1730 if (Opcode == ARM::t2LDRpci || Opcode == ARM::t2LDRpci_pic ||
1731 Opcode == ARM::tLDRpci || Opcode == ARM::tLDRpci_pic ||
1732 Opcode == ARM::LDRLIT_ga_pcrel || Opcode == ARM::LDRLIT_ga_pcrel_ldr ||
1733 Opcode == ARM::tLDRLIT_ga_pcrel || Opcode == ARM::t2LDRLIT_ga_pcrel ||
1734 Opcode == ARM::MOV_ga_pcrel || Opcode == ARM::MOV_ga_pcrel_ldr ||
1735 Opcode == ARM::t2MOV_ga_pcrel) {
1746 if (Opcode == ARM::LDRLIT_ga_pcrel || Opcode == ARM::LDRLIT_ga_pcrel_ldr ||
1747 Opcode == ARM::tLDRLIT_ga_pcrel || Opcode == ARM::t2LDRLIT_ga_pcrel ||
1748 Opcode == ARM::MOV_ga_pcrel || Opcode == ARM::MOV_ga_pcrel_ldr ||
1749 Opcode == ARM::t2MOV_ga_pcrel)
1761 if (isARMCP0 && isARMCP1) {
1767 }
else if (!isARMCP0 && !isARMCP1) {
1771 }
else if (Opcode == ARM::PICLDR) {
1779 if (Addr0 != Addr1) {
1815 int64_t &Offset2)
const {
1817 if (Subtarget.isThumb1Only())
return false;
1822 auto IsLoadOpcode = [&](
unsigned Opcode) {
1837 case ARM::t2LDRSHi8:
1839 case ARM::t2LDRBi12:
1840 case ARM::t2LDRSHi12:
1881 int64_t Offset1, int64_t Offset2,
1882 unsigned NumLoads)
const {
1884 if (Subtarget.isThumb1Only())
return false;
1886 assert(Offset2 > Offset1);
1888 if ((Offset2 - Offset1) / 8 > 64)
1919 if (
MI.isDebugInstr())
1923 if (
MI.isTerminator() ||
MI.isPosition())
1927 if (
MI.getOpcode() == TargetOpcode::INLINEASM_BR)
1941 while (++
I !=
MBB->end() &&
I->isDebugInstr())
1943 if (
I !=
MBB->end() &&
I->getOpcode() == ARM::t2IT)
1954 if (!
MI.isCall() &&
MI.definesRegister(ARM::SP,
nullptr))
1962 unsigned NumCycles,
unsigned ExtraPredCycles,
1970 if (
MBB.getParent()->getFunction().hasOptSize()) {
1972 if (!Pred->empty()) {
1974 if (LastMI->
getOpcode() == ARM::t2Bcc) {
1983 MBB, 0, 0, Probability);
1988 unsigned TCycles,
unsigned TExtra,
1990 unsigned FCycles,
unsigned FExtra,
1999 if (Subtarget.isThumb2() &&
TBB.getParent()->getFunction().hasMinSize()) {
2007 const unsigned ScalingUpFactor = 1024;
2009 unsigned PredCost = (TCycles + FCycles + TExtra + FExtra) * ScalingUpFactor;
2010 unsigned UnpredCost;
2011 if (!Subtarget.hasBranchPredictor()) {
2014 unsigned NotTakenBranchCost = 1;
2015 unsigned TakenBranchCost = Subtarget.getMispredictionPenalty();
2016 unsigned TUnpredCycles, FUnpredCycles;
2019 TUnpredCycles = TCycles + NotTakenBranchCost;
2020 FUnpredCycles = TakenBranchCost;
2023 TUnpredCycles = TCycles + TakenBranchCost;
2024 FUnpredCycles = FCycles + NotTakenBranchCost;
2027 PredCost -= 1 * ScalingUpFactor;
2030 unsigned TUnpredCost = Probability.
scale(TUnpredCycles * ScalingUpFactor);
2031 unsigned FUnpredCost = Probability.
getCompl().
scale(FUnpredCycles * ScalingUpFactor);
2032 UnpredCost = TUnpredCost + FUnpredCost;
2035 if (Subtarget.isThumb2() && TCycles + FCycles > 4) {
2036 PredCost += ((TCycles + FCycles - 4) / 4) * ScalingUpFactor;
2039 unsigned TUnpredCost = Probability.
scale(TCycles * ScalingUpFactor);
2040 unsigned FUnpredCost =
2042 UnpredCost = TUnpredCost + FUnpredCost;
2043 UnpredCost += 1 * ScalingUpFactor;
2044 UnpredCost += Subtarget.getMispredictionPenalty() * ScalingUpFactor / 10;
2047 return PredCost <= UnpredCost;
2052 unsigned NumInsts)
const {
2056 if (!Subtarget.isThumb2())
2060 unsigned MaxInsts = Subtarget.restrictIT() ? 1 : 4;
2069 if (
MI.getOpcode() == ARM::t2Bcc &&
2081 if (Subtarget.isThumb2())
2092 return Subtarget.isProfitableToUnpredicate();
2100 int PIdx =
MI.findFirstPredOperandIdx();
2106 PredReg =
MI.getOperand(PIdx+1).getReg();
2115 if (
Opc == ARM::t2B)
2124 unsigned OpIdx2)
const {
2125 switch (
MI.getOpcode()) {
2127 case ARM::t2MOVCCr: {
2152 if (!Reg.isVirtual())
2154 if (!
MRI.hasOneNonDBGUse(Reg))
2166 if (MO.isFI() || MO.isCPI() || MO.isJTI())
2173 if (MO.getReg().isPhysical())
2175 if (MO.isDef() && !MO.isDead())
2178 bool DontMoveAcrossStores =
true;
2179 if (!
MI->isSafeToMove(DontMoveAcrossStores))
2187 bool PreferFalse)
const {
2188 assert((
MI.getOpcode() == ARM::MOVCCr ||
MI.getOpcode() == ARM::t2MOVCCr) &&
2189 "Unknown select instruction");
2192 bool Invert = !
DefMI;
2194 DefMI = canFoldIntoMOVCC(
MI.getOperand(1).getReg(),
MRI,
this);
2201 Register DestReg =
MI.getOperand(0).getReg();
2204 if (!
MRI.constrainRegClass(DestReg, FalseClass))
2206 if (!
MRI.constrainRegClass(DestReg, TrueClass))
2217 i != e && !DefDesc.
operands()[i].isPredicate(); ++i)
2220 unsigned CondCode =
MI.getOperand(3).getImm();
2225 NewMI.
add(
MI.getOperand(4));
2236 NewMI.
add(FalseReg);
2247 if (
DefMI->getParent() !=
MI.getParent())
2251 DefMI->eraseFromParent();
2267 {ARM::ADDSri, ARM::ADDri},
2268 {ARM::ADDSrr, ARM::ADDrr},
2269 {ARM::ADDSrsi, ARM::ADDrsi},
2270 {ARM::ADDSrsr, ARM::ADDrsr},
2272 {ARM::SUBSri, ARM::SUBri},
2273 {ARM::SUBSrr, ARM::SUBrr},
2274 {ARM::SUBSrsi, ARM::SUBrsi},
2275 {ARM::SUBSrsr, ARM::SUBrsr},
2277 {ARM::RSBSri, ARM::RSBri},
2278 {ARM::RSBSrsi, ARM::RSBrsi},
2279 {ARM::RSBSrsr, ARM::RSBrsr},
2281 {ARM::tADDSi3, ARM::tADDi3},
2282 {ARM::tADDSi8, ARM::tADDi8},
2283 {ARM::tADDSrr, ARM::tADDrr},
2284 {ARM::tADCS, ARM::tADC},
2286 {ARM::tSUBSi3, ARM::tSUBi3},
2287 {ARM::tSUBSi8, ARM::tSUBi8},
2288 {ARM::tSUBSrr, ARM::tSUBrr},
2289 {ARM::tSBCS, ARM::tSBC},
2290 {ARM::tRSBS, ARM::tRSB},
2291 {ARM::tLSLSri, ARM::tLSLri},
2293 {ARM::t2ADDSri, ARM::t2ADDri},
2294 {ARM::t2ADDSrr, ARM::t2ADDrr},
2295 {ARM::t2ADDSrs, ARM::t2ADDrs},
2297 {ARM::t2SUBSri, ARM::t2SUBri},
2298 {ARM::t2SUBSrr, ARM::t2SUBrr},
2299 {ARM::t2SUBSrs, ARM::t2SUBrs},
2301 {ARM::t2RSBSri, ARM::t2RSBri},
2302 {ARM::t2RSBSrs, ARM::t2RSBrs},
2307 if (OldOpc == Entry.PseudoOpc)
2308 return Entry.MachineOpc;
2319 if (NumBytes == 0 && DestReg != BaseReg) {
2328 bool isSub = NumBytes < 0;
2329 if (isSub) NumBytes = -NumBytes;
2334 assert(ThisVal &&
"Didn't extract field correctly");
2337 NumBytes &= ~ThisVal;
2342 unsigned Opc = isSub ? ARM::SUBri : ARM::ADDri;
2355 unsigned NumBytes) {
2366 if (!IsPush && !IsPop)
2369 bool IsVFPPushPop =
MI->getOpcode() == ARM::VSTMDDB_UPD ||
2370 MI->getOpcode() == ARM::VLDMDIA_UPD;
2371 bool IsT1PushPop =
MI->getOpcode() == ARM::tPUSH ||
2372 MI->getOpcode() == ARM::tPOP ||
2373 MI->getOpcode() == ARM::tPOP_RET;
2375 assert((IsT1PushPop || (
MI->getOperand(0).getReg() == ARM::SP &&
2376 MI->getOperand(1).getReg() == ARM::SP)) &&
2377 "trying to fold sp update into non-sp-updating push/pop");
2382 if (NumBytes % (IsVFPPushPop ? 8 : 4) != 0)
2387 int RegListIdx = IsT1PushPop ? 2 : 4;
2390 unsigned RegsNeeded;
2393 RegsNeeded = NumBytes / 8;
2394 RegClass = &ARM::DPRRegClass;
2396 RegsNeeded = NumBytes / 4;
2397 RegClass = &ARM::GPRRegClass;
2407 unsigned FirstRegEnc = -1;
2410 for (
int i =
MI->getNumOperands() - 1; i >= RegListIdx; --i) {
2415 TRI->getEncodingValue(MO.
getReg()) < FirstRegEnc)
2416 FirstRegEnc =
TRI->getEncodingValue(MO.
getReg());
2419 const MCPhysReg *CSRegs =
TRI->getCalleeSavedRegs(&MF);
2422 for (
int CurRegEnc = FirstRegEnc - 1; CurRegEnc >= 0 && RegsNeeded;
2425 if (IsT1PushPop && CurRegEnc >
TRI->getEncodingValue(ARM::R7))
2432 false,
false,
true));
2442 MI->getParent()->computeRegisterLiveness(
TRI, CurReg,
MI) !=
2464 for (
int i =
MI->getNumOperands() - 1; i >= RegListIdx; --i)
2465 MI->removeOperand(i);
2478 unsigned Opcode =
MI.getOpcode();
2484 if (Opcode == ARM::INLINEASM || Opcode == ARM::INLINEASM_BR)
2487 if (Opcode == ARM::ADDri) {
2488 Offset +=
MI.getOperand(FrameRegIdx+1).getImm();
2491 MI.setDesc(
TII.get(ARM::MOVr));
2492 MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg,
false);
2493 MI.removeOperand(FrameRegIdx+1);
2499 MI.setDesc(
TII.get(ARM::SUBri));
2505 MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg,
false);
2506 MI.getOperand(FrameRegIdx+1).ChangeToImmediate(
Offset);
2521 "Bit extraction didn't work?");
2522 MI.getOperand(FrameRegIdx+1).ChangeToImmediate(ThisImmVal);
2524 unsigned ImmIdx = 0;
2526 unsigned NumBits = 0;
2530 ImmIdx = FrameRegIdx + 1;
2531 InstrOffs =
MI.getOperand(ImmIdx).getImm();
2535 ImmIdx = FrameRegIdx+2;
2542 ImmIdx = FrameRegIdx+2;
2553 ImmIdx = FrameRegIdx+1;
2561 ImmIdx = FrameRegIdx+1;
2571 ImmIdx = FrameRegIdx+1;
2572 InstrOffs =
MI.getOperand(ImmIdx).getImm();
2581 Offset += InstrOffs * Scale;
2582 assert((
Offset & (Scale-1)) == 0 &&
"Can't encode this offset!");
2592 int ImmedOffset =
Offset / Scale;
2593 unsigned Mask = (1 << NumBits) - 1;
2594 if ((
unsigned)
Offset <= Mask * Scale) {
2596 MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg,
false);
2602 ImmedOffset = -ImmedOffset;
2604 ImmedOffset |= 1 << NumBits;
2612 ImmedOffset = ImmedOffset & Mask;
2615 ImmedOffset = -ImmedOffset;
2617 ImmedOffset |= 1 << NumBits;
2633 Register &SrcReg2, int64_t &CmpMask,
2634 int64_t &CmpValue)
const {
2635 switch (
MI.getOpcode()) {
2640 SrcReg =
MI.getOperand(0).getReg();
2643 CmpValue =
MI.getOperand(1).getImm();
2648 SrcReg =
MI.getOperand(0).getReg();
2649 SrcReg2 =
MI.getOperand(1).getReg();
2655 SrcReg =
MI.getOperand(0).getReg();
2657 CmpMask =
MI.getOperand(1).getImm();
2670 int CmpMask,
bool CommonUse) {
2671 switch (
MI->getOpcode()) {
2674 if (CmpMask !=
MI->getOperand(2).getImm())
2676 if (SrcReg ==
MI->getOperand(CommonUse ? 1 : 0).getReg())
2766 switch (
MI->getOpcode()) {
2767 default:
return false;
2863 if (!
MI)
return false;
2866 if (CmpMask != ~0) {
2870 UI =
MRI->use_instr_begin(SrcReg), UE =
MRI->use_instr_end();
2872 if (UI->getParent() != CmpInstr.
getParent())
2881 if (!
MI)
return false;
2890 if (
I ==
B)
return false;
2901 else if (
MI->getParent() != CmpInstr.
getParent() || CmpValue != 0) {
2906 if (CmpInstr.
getOpcode() == ARM::CMPri ||
2914 bool IsThumb1 =
false;
2931 if (
MI && IsThumb1) {
2933 if (
I != E && !
MI->readsRegister(ARM::CPSR,
TRI)) {
2935 bool CanReorder =
true;
2939 if (Instr.getOpcode() != ARM::tMOVi8) {
2947 Mov->moveBefore(
MI);
2955 bool SubAddIsThumb1 =
false;
2970 if (Instr.modifiesRegister(ARM::CPSR,
TRI) ||
2971 Instr.readsRegister(ARM::CPSR,
TRI))
2993 IsThumb1 = SubAddIsThumb1;
3008 bool isSafe =
false;
3011 while (!isSafe && ++
I != E) {
3013 for (
unsigned IO = 0, EO = Instr.getNumOperands();
3014 !isSafe && IO != EO; ++IO) {
3028 bool IsInstrVSel =
true;
3029 switch (Instr.getOpcode()) {
3031 IsInstrVSel =
false;
3065 bool IsSub =
Opc == ARM::SUBrr ||
Opc == ARM::t2SUBrr ||
3066 Opc == ARM::SUBri ||
Opc == ARM::t2SUBri ||
3067 Opc == ARM::tSUBrr ||
Opc == ARM::tSUBi3 ||
3069 unsigned OpI =
Opc != ARM::tSUBrr ? 1 : 2;
3081 std::make_pair(&((*I).getOperand(IO - 1)), NewCC));
3115 if (Succ->isLiveIn(ARM::CPSR))
3122 unsigned CPSRRegNum =
MI->getNumExplicitOperands() - 1;
3123 MI->getOperand(CPSRRegNum).setReg(ARM::CPSR);
3124 MI->getOperand(CPSRRegNum).setIsDef(
true);
3132 for (
auto &[MO,
Cond] : OperandsToUpdate)
3135 MI->clearRegisterDeads(ARM::CPSR);
3150 int64_t CmpMask, CmpValue;
3152 if (
Next !=
MI.getParent()->end() &&
3163 unsigned DefOpc =
DefMI.getOpcode();
3164 if (DefOpc != ARM::t2MOVi32imm && DefOpc != ARM::MOVi32imm &&
3165 DefOpc != ARM::tMOVi32imm)
3167 if (!
DefMI.getOperand(1).isImm())
3171 if (!
MRI->hasOneNonDBGUse(Reg))
3187 if (
UseMI.getOperand(
NumOps - 1).getReg() == ARM::CPSR)
3193 unsigned UseOpc =
UseMI.getOpcode();
3194 unsigned NewUseOpc = 0;
3196 uint32_t SOImmValV1 = 0, SOImmValV2 = 0;
3197 bool Commute =
false;
3199 default:
return false;
3207 case ARM::t2EORrr: {
3208 Commute =
UseMI.getOperand(2).getReg() != Reg;
3213 if (UseOpc == ARM::SUBrr && Commute)
3219 NewUseOpc = UseOpc == ARM::ADDrr ? ARM::ADDri : ARM::SUBri;
3222 NewUseOpc = UseOpc == ARM::ADDrr ? ARM::SUBri : ARM::ADDri;
3236 case ARM::ORRrr: NewUseOpc = ARM::ORRri;
break;
3237 case ARM::EORrr: NewUseOpc = ARM::EORri;
break;
3241 case ARM::t2SUBrr: {
3242 if (UseOpc == ARM::t2SUBrr && Commute)
3247 const bool ToSP =
DefMI.getOperand(0).getReg() == ARM::SP;
3248 const unsigned t2ADD = ToSP ? ARM::t2ADDspImm : ARM::t2ADDri;
3249 const unsigned t2SUB = ToSP ? ARM::t2SUBspImm : ARM::t2SUBri;
3251 NewUseOpc = UseOpc == ARM::t2ADDrr ? t2ADD : t2SUB;
3254 NewUseOpc = UseOpc == ARM::t2ADDrr ? t2SUB : t2ADD;
3269 case ARM::t2ORRrr: NewUseOpc = ARM::t2ORRri;
break;
3270 case ARM::t2EORrr: NewUseOpc = ARM::t2EORri;
break;
3277 unsigned OpIdx = Commute ? 2 : 1;
3279 bool isKill =
UseMI.getOperand(OpIdx).isKill();
3281 Register NewReg =
MRI->createVirtualRegister(TRC);
3289 UseMI.getOperand(1).setReg(NewReg);
3290 UseMI.getOperand(2).ChangeToImmediate(SOImmValV2);
3291 DefMI.eraseFromParent();
3298 case ARM::t2ADDspImm:
3299 case ARM::t2SUBspImm:
3302 MRI->constrainRegClass(
UseMI.getOperand(0).getReg(), TRC);
3309 switch (
MI.getOpcode()) {
3313 assert(UOps >= 0 &&
"bad # UOps");
3321 unsigned ShOpVal =
MI.getOperand(3).getImm();
3326 ((ShImm == 1 || ShImm == 2 || ShImm == 3) &&
3334 if (!
MI.getOperand(2).getReg())
3337 unsigned ShOpVal =
MI.getOperand(3).getImm();
3342 ((ShImm == 1 || ShImm == 2 || ShImm == 3) &&
3352 case ARM::LDRSB_POST:
3353 case ARM::LDRSH_POST: {
3356 return (Rt == Rm) ? 4 : 3;
3359 case ARM::LDR_PRE_REG:
3360 case ARM::LDRB_PRE_REG: {
3365 unsigned ShOpVal =
MI.getOperand(4).getImm();
3370 ((ShImm == 1 || ShImm == 2 || ShImm == 3) &&
3376 case ARM::STR_PRE_REG:
3377 case ARM::STRB_PRE_REG: {
3378 unsigned ShOpVal =
MI.getOperand(4).getImm();
3383 ((ShImm == 1 || ShImm == 2 || ShImm == 3) &&
3390 case ARM::STRH_PRE: {
3400 case ARM::LDR_POST_REG:
3401 case ARM::LDRB_POST_REG:
3402 case ARM::LDRH_POST: {
3405 return (Rt == Rm) ? 3 : 2;
3408 case ARM::LDR_PRE_IMM:
3409 case ARM::LDRB_PRE_IMM:
3410 case ARM::LDR_POST_IMM:
3411 case ARM::LDRB_POST_IMM:
3412 case ARM::STRB_POST_IMM:
3413 case ARM::STRB_POST_REG:
3414 case ARM::STRB_PRE_IMM:
3415 case ARM::STRH_POST:
3416 case ARM::STR_POST_IMM:
3417 case ARM::STR_POST_REG:
3418 case ARM::STR_PRE_IMM:
3421 case ARM::LDRSB_PRE:
3422 case ARM::LDRSH_PRE: {
3429 unsigned ShOpVal =
MI.getOperand(4).getImm();
3434 ((ShImm == 1 || ShImm == 2 || ShImm == 3) &&
3447 return (Rt == Rn) ? 3 : 2;
3458 case ARM::LDRD_POST:
3459 case ARM::t2LDRD_POST:
3462 case ARM::STRD_POST:
3463 case ARM::t2STRD_POST:
3466 case ARM::LDRD_PRE: {
3473 return (Rt == Rn) ? 4 : 3;
3476 case ARM::t2LDRD_PRE: {
3479 return (Rt == Rn) ? 4 : 3;
3482 case ARM::STRD_PRE: {
3490 case ARM::t2STRD_PRE:
3493 case ARM::t2LDR_POST:
3494 case ARM::t2LDRB_POST:
3495 case ARM::t2LDRB_PRE:
3496 case ARM::t2LDRSBi12:
3497 case ARM::t2LDRSBi8:
3498 case ARM::t2LDRSBpci:
3500 case ARM::t2LDRH_POST:
3501 case ARM::t2LDRH_PRE:
3503 case ARM::t2LDRSB_POST:
3504 case ARM::t2LDRSB_PRE:
3505 case ARM::t2LDRSH_POST:
3506 case ARM::t2LDRSH_PRE:
3507 case ARM::t2LDRSHi12:
3508 case ARM::t2LDRSHi8:
3509 case ARM::t2LDRSHpci:
3513 case ARM::t2LDRDi8: {
3516 return (Rt == Rn) ? 3 : 2;
3519 case ARM::t2STRB_POST:
3520 case ARM::t2STRB_PRE:
3523 case ARM::t2STRH_POST:
3524 case ARM::t2STRH_PRE:
3526 case ARM::t2STR_POST:
3527 case ARM::t2STR_PRE:
3558 E =
MI.memoperands_end();
3560 Size += (*I)->getSize().getValue();
3567 return std::min(
Size / 4, 16U);
3572 unsigned UOps = 1 + NumRegs;
3576 case ARM::VLDMDIA_UPD:
3577 case ARM::VLDMDDB_UPD:
3578 case ARM::VLDMSIA_UPD:
3579 case ARM::VLDMSDB_UPD:
3580 case ARM::VSTMDIA_UPD:
3581 case ARM::VSTMDDB_UPD:
3582 case ARM::VSTMSIA_UPD:
3583 case ARM::VSTMSDB_UPD:
3584 case ARM::LDMIA_UPD:
3585 case ARM::LDMDA_UPD:
3586 case ARM::LDMDB_UPD:
3587 case ARM::LDMIB_UPD:
3588 case ARM::STMIA_UPD:
3589 case ARM::STMDA_UPD:
3590 case ARM::STMDB_UPD:
3591 case ARM::STMIB_UPD:
3592 case ARM::tLDMIA_UPD:
3593 case ARM::tSTMIA_UPD:
3594 case ARM::t2LDMIA_UPD:
3595 case ARM::t2LDMDB_UPD:
3596 case ARM::t2STMIA_UPD:
3597 case ARM::t2STMDB_UPD:
3600 case ARM::LDMIA_RET:
3602 case ARM::t2LDMIA_RET:
3611 if (!ItinData || ItinData->
isEmpty())
3615 unsigned Class =
Desc.getSchedClass();
3617 if (ItinUOps >= 0) {
3618 if (Subtarget.isSwift() && (
Desc.mayLoad() ||
Desc.mayStore()))
3624 unsigned Opc =
MI.getOpcode();
3643 case ARM::VLDMDIA_UPD:
3644 case ARM::VLDMDDB_UPD:
3646 case ARM::VLDMSIA_UPD:
3647 case ARM::VLDMSDB_UPD:
3649 case ARM::VSTMDIA_UPD:
3650 case ARM::VSTMDDB_UPD:
3652 case ARM::VSTMSIA_UPD:
3653 case ARM::VSTMSDB_UPD: {
3654 unsigned NumRegs =
MI.getNumOperands() -
Desc.getNumOperands();
3655 return (NumRegs / 2) + (NumRegs % 2) + 1;
3658 case ARM::LDMIA_RET:
3663 case ARM::LDMIA_UPD:
3664 case ARM::LDMDA_UPD:
3665 case ARM::LDMDB_UPD:
3666 case ARM::LDMIB_UPD:
3671 case ARM::STMIA_UPD:
3672 case ARM::STMDA_UPD:
3673 case ARM::STMDB_UPD:
3674 case ARM::STMIB_UPD:
3676 case ARM::tLDMIA_UPD:
3677 case ARM::tSTMIA_UPD:
3681 case ARM::t2LDMIA_RET:
3684 case ARM::t2LDMIA_UPD:
3685 case ARM::t2LDMDB_UPD:
3688 case ARM::t2STMIA_UPD:
3689 case ARM::t2STMDB_UPD: {
3690 unsigned NumRegs =
MI.getNumOperands() -
Desc.getNumOperands() + 1;
3691 switch (Subtarget.getLdStMultipleTiming()) {
3702 unsigned UOps = (NumRegs / 2);
3708 unsigned UOps = (NumRegs / 2);
3711 if ((NumRegs % 2) || !
MI.hasOneMemOperand() ||
3712 (*
MI.memoperands_begin())->getAlign() <
Align(8))
3722std::optional<unsigned>
3725 unsigned DefIdx,
unsigned DefAlign)
const {
3734 DefCycle = RegNo / 2 + 1;
3739 bool isSLoad =
false;
3744 case ARM::VLDMSIA_UPD:
3745 case ARM::VLDMSDB_UPD:
3752 if ((isSLoad && (RegNo % 2)) || DefAlign < 8)
3756 DefCycle = RegNo + 2;
3762std::optional<unsigned>
3765 unsigned DefIdx,
unsigned DefAlign)
const {
3772 if (Subtarget.isCortexA8() || Subtarget.isCortexA7()) {
3775 DefCycle = RegNo / 2;
3780 }
else if (Subtarget.isLikeA9() || Subtarget.isSwift()) {
3781 DefCycle = (RegNo / 2);
3784 if ((RegNo % 2) || DefAlign < 8)
3790 DefCycle = RegNo + 2;
3796std::optional<unsigned>
3799 unsigned UseIdx,
unsigned UseAlign)
const {
3805 if (Subtarget.isCortexA8() || Subtarget.isCortexA7()) {
3807 UseCycle = RegNo / 2 + 1;
3810 }
else if (Subtarget.isLikeA9() || Subtarget.isSwift()) {
3812 bool isSStore =
false;
3817 case ARM::VSTMSIA_UPD:
3818 case ARM::VSTMSDB_UPD:
3825 if ((isSStore && (RegNo % 2)) || UseAlign < 8)
3829 UseCycle = RegNo + 2;
3835std::optional<unsigned>
3838 unsigned UseIdx,
unsigned UseAlign)
const {
3844 if (Subtarget.isCortexA8() || Subtarget.isCortexA7()) {
3845 UseCycle = RegNo / 2;
3850 }
else if (Subtarget.isLikeA9() || Subtarget.isSwift()) {
3851 UseCycle = (RegNo / 2);
3854 if ((RegNo % 2) || UseAlign < 8)
3865 unsigned DefIdx,
unsigned DefAlign,
const MCInstrDesc &UseMCID,
3866 unsigned UseIdx,
unsigned UseAlign)
const {
3876 std::optional<unsigned> DefCycle;
3877 bool LdmBypass =
false;
3884 case ARM::VLDMDIA_UPD:
3885 case ARM::VLDMDDB_UPD:
3887 case ARM::VLDMSIA_UPD:
3888 case ARM::VLDMSDB_UPD:
3889 DefCycle = getVLDMDefCycle(ItinData, DefMCID, DefClass, DefIdx, DefAlign);
3892 case ARM::LDMIA_RET:
3897 case ARM::LDMIA_UPD:
3898 case ARM::LDMDA_UPD:
3899 case ARM::LDMDB_UPD:
3900 case ARM::LDMIB_UPD:
3902 case ARM::tLDMIA_UPD:
3904 case ARM::t2LDMIA_RET:
3907 case ARM::t2LDMIA_UPD:
3908 case ARM::t2LDMDB_UPD:
3910 DefCycle = getLDMDefCycle(ItinData, DefMCID, DefClass, DefIdx, DefAlign);
3918 std::optional<unsigned> UseCycle;
3925 case ARM::VSTMDIA_UPD:
3926 case ARM::VSTMDDB_UPD:
3928 case ARM::VSTMSIA_UPD:
3929 case ARM::VSTMSDB_UPD:
3930 UseCycle = getVSTMUseCycle(ItinData, UseMCID, UseClass, UseIdx, UseAlign);
3937 case ARM::STMIA_UPD:
3938 case ARM::STMDA_UPD:
3939 case ARM::STMDB_UPD:
3940 case ARM::STMIB_UPD:
3941 case ARM::tSTMIA_UPD:
3946 case ARM::t2STMIA_UPD:
3947 case ARM::t2STMDB_UPD:
3948 UseCycle = getSTMUseCycle(ItinData, UseMCID, UseClass, UseIdx, UseAlign);
3956 if (UseCycle > *DefCycle + 1)
3957 return std::nullopt;
3959 UseCycle = *DefCycle - *UseCycle + 1;
3960 if (UseCycle > 0u) {
3966 UseCycle = *UseCycle - 1;
3968 UseClass, UseIdx)) {
3969 UseCycle = *UseCycle - 1;
3978 unsigned &DefIdx,
unsigned &Dist) {
3983 assert(
II->isInsideBundle() &&
"Empty bundle?");
3986 while (
II->isInsideBundle()) {
3987 Idx =
II->findRegisterDefOperandIdx(
Reg,
TRI,
false,
true);
3994 assert(Idx != -1 &&
"Cannot find bundled definition!");
4001 unsigned &UseIdx,
unsigned &Dist) {
4005 assert(
II->isInsideBundle() &&
"Empty bundle?");
4010 while (
II !=
E &&
II->isInsideBundle()) {
4011 Idx =
II->findRegisterUseOperandIdx(
Reg,
TRI,
false);
4014 if (
II->getOpcode() != ARM::t2IT)
4042 unsigned ShOpVal =
DefMI.getOperand(3).getImm();
4052 case ARM::t2LDRSHs: {
4054 unsigned ShAmt =
DefMI.getOperand(3).getImm();
4055 if (ShAmt == 0 || ShAmt == 2)
4067 unsigned ShOpVal =
DefMI.getOperand(3).getImm();
4072 ((ShImm == 1 || ShImm == 2 || ShImm == 3) &&
4083 case ARM::t2LDRSHs: {
4085 unsigned ShAmt =
DefMI.getOperand(3).getImm();
4086 if (ShAmt == 0 || ShAmt == 1 || ShAmt == 2 || ShAmt == 3)
4093 if (DefAlign < 8 &&
Subtarget.checkVLDnAccessAlignment()) {
4100 case ARM::VLD1q8wb_fixed:
4101 case ARM::VLD1q16wb_fixed:
4102 case ARM::VLD1q32wb_fixed:
4103 case ARM::VLD1q64wb_fixed:
4104 case ARM::VLD1q8wb_register:
4105 case ARM::VLD1q16wb_register:
4106 case ARM::VLD1q32wb_register:
4107 case ARM::VLD1q64wb_register:
4114 case ARM::VLD2d8wb_fixed:
4115 case ARM::VLD2d16wb_fixed:
4116 case ARM::VLD2d32wb_fixed:
4117 case ARM::VLD2q8wb_fixed:
4118 case ARM::VLD2q16wb_fixed:
4119 case ARM::VLD2q32wb_fixed:
4120 case ARM::VLD2d8wb_register:
4121 case ARM::VLD2d16wb_register:
4122 case ARM::VLD2d32wb_register:
4123 case ARM::VLD2q8wb_register:
4124 case ARM::VLD2q16wb_register:
4125 case ARM::VLD2q32wb_register:
4130 case ARM::VLD3d8_UPD:
4131 case ARM::VLD3d16_UPD:
4132 case ARM::VLD3d32_UPD:
4133 case ARM::VLD1d64Twb_fixed:
4134 case ARM::VLD1d64Twb_register:
4135 case ARM::VLD3q8_UPD:
4136 case ARM::VLD3q16_UPD:
4137 case ARM::VLD3q32_UPD:
4142 case ARM::VLD4d8_UPD:
4143 case ARM::VLD4d16_UPD:
4144 case ARM::VLD4d32_UPD:
4145 case ARM::VLD1d64Qwb_fixed:
4146 case ARM::VLD1d64Qwb_register:
4147 case ARM::VLD4q8_UPD:
4148 case ARM::VLD4q16_UPD:
4149 case ARM::VLD4q32_UPD:
4150 case ARM::VLD1DUPq8:
4151 case ARM::VLD1DUPq16:
4152 case ARM::VLD1DUPq32:
4153 case ARM::VLD1DUPq8wb_fixed:
4154 case ARM::VLD1DUPq16wb_fixed:
4155 case ARM::VLD1DUPq32wb_fixed:
4156 case ARM::VLD1DUPq8wb_register:
4157 case ARM::VLD1DUPq16wb_register:
4158 case ARM::VLD1DUPq32wb_register:
4159 case ARM::VLD2DUPd8:
4160 case ARM::VLD2DUPd16:
4161 case ARM::VLD2DUPd32:
4162 case ARM::VLD2DUPd8wb_fixed:
4163 case ARM::VLD2DUPd16wb_fixed:
4164 case ARM::VLD2DUPd32wb_fixed:
4165 case ARM::VLD2DUPd8wb_register:
4166 case ARM::VLD2DUPd16wb_register:
4167 case ARM::VLD2DUPd32wb_register:
4168 case ARM::VLD4DUPd8:
4169 case ARM::VLD4DUPd16:
4170 case ARM::VLD4DUPd32:
4171 case ARM::VLD4DUPd8_UPD:
4172 case ARM::VLD4DUPd16_UPD:
4173 case ARM::VLD4DUPd32_UPD:
4175 case ARM::VLD1LNd16:
4176 case ARM::VLD1LNd32:
4177 case ARM::VLD1LNd8_UPD:
4178 case ARM::VLD1LNd16_UPD:
4179 case ARM::VLD1LNd32_UPD:
4181 case ARM::VLD2LNd16:
4182 case ARM::VLD2LNd32:
4183 case ARM::VLD2LNq16:
4184 case ARM::VLD2LNq32:
4185 case ARM::VLD2LNd8_UPD:
4186 case ARM::VLD2LNd16_UPD:
4187 case ARM::VLD2LNd32_UPD:
4188 case ARM::VLD2LNq16_UPD:
4189 case ARM::VLD2LNq32_UPD:
4191 case ARM::VLD4LNd16:
4192 case ARM::VLD4LNd32:
4193 case ARM::VLD4LNq16:
4194 case ARM::VLD4LNq32:
4195 case ARM::VLD4LNd8_UPD:
4196 case ARM::VLD4LNd16_UPD:
4197 case ARM::VLD4LNd32_UPD:
4198 case ARM::VLD4LNq16_UPD:
4199 case ARM::VLD4LNq32_UPD:
4213 if (!ItinData || ItinData->
isEmpty())
4214 return std::nullopt;
4220 unsigned DefAdj = 0;
4221 if (
DefMI.isBundle())
4230 unsigned UseAdj = 0;
4231 if (
UseMI.isBundle()) {
4235 return std::nullopt;
4238 return getOperandLatencyImpl(
4239 ItinData, *ResolvedDefMI, DefIdx, ResolvedDefMI->
getDesc(), DefAdj, DefMO,
4240 Reg, *ResolvedUseMI, UseIdx, ResolvedUseMI->
getDesc(), UseAdj);
4243std::optional<unsigned> ARMBaseInstrInfo::getOperandLatencyImpl(
4245 unsigned DefIdx,
const MCInstrDesc &DefMCID,
unsigned DefAdj,
4247 unsigned UseIdx,
const MCInstrDesc &UseMCID,
unsigned UseAdj)
const {
4248 if (Reg == ARM::CPSR) {
4249 if (
DefMI.getOpcode() == ARM::FMSTAT) {
4255 if (
UseMI.isBranch())
4274 return std::nullopt;
4276 unsigned DefAlign =
DefMI.hasOneMemOperand()
4277 ? (*
DefMI.memoperands_begin())->getAlign().value()
4279 unsigned UseAlign =
UseMI.hasOneMemOperand()
4280 ? (*
UseMI.memoperands_begin())->getAlign().value()
4285 ItinData, DefMCID, DefIdx, DefAlign, UseMCID, UseIdx, UseAlign);
4288 return std::nullopt;
4291 int Adj = DefAdj + UseAdj;
4295 if (Adj >= 0 || (
int)*
Latency > -Adj) {
4302std::optional<unsigned>
4304 SDNode *DefNode,
unsigned DefIdx,
4305 SDNode *UseNode,
unsigned UseIdx)
const {
4311 if (isZeroCost(DefMCID.
Opcode))
4314 if (!ItinData || ItinData->
isEmpty())
4315 return DefMCID.
mayLoad() ? 3 : 1;
4318 std::optional<unsigned>
Latency =
4320 int Adj = Subtarget.getPreISelOperandLatencyAdjustment();
4321 int Threshold = 1 + Adj;
4327 unsigned DefAlign = !DefMN->memoperands_empty()
4328 ? (*DefMN->memoperands_begin())->getAlign().value()
4331 unsigned UseAlign = !UseMN->memoperands_empty()
4332 ? (*UseMN->memoperands_begin())->getAlign().value()
4335 ItinData, DefMCID, DefIdx, DefAlign, UseMCID, UseIdx, UseAlign);
4337 return std::nullopt;
4340 (Subtarget.isCortexA8() || Subtarget.isLikeA9() ||
4341 Subtarget.isCortexA7())) {
4358 case ARM::t2LDRSHs: {
4361 if (ShAmt == 0 || ShAmt == 2)
4366 }
else if (DefIdx == 0 &&
Latency > 2U && Subtarget.isSwift()) {
4376 ((ShImm == 1 || ShImm == 2 || ShImm == 3) &&
4393 if (DefAlign < 8 && Subtarget.checkVLDnAccessAlignment())
4400 case ARM::VLD1q8wb_register:
4401 case ARM::VLD1q16wb_register:
4402 case ARM::VLD1q32wb_register:
4403 case ARM::VLD1q64wb_register:
4404 case ARM::VLD1q8wb_fixed:
4405 case ARM::VLD1q16wb_fixed:
4406 case ARM::VLD1q32wb_fixed:
4407 case ARM::VLD1q64wb_fixed:
4411 case ARM::VLD2q8Pseudo:
4412 case ARM::VLD2q16Pseudo:
4413 case ARM::VLD2q32Pseudo:
4414 case ARM::VLD2d8wb_fixed:
4415 case ARM::VLD2d16wb_fixed:
4416 case ARM::VLD2d32wb_fixed:
4417 case ARM::VLD2q8PseudoWB_fixed:
4418 case ARM::VLD2q16PseudoWB_fixed:
4419 case ARM::VLD2q32PseudoWB_fixed:
4420 case ARM::VLD2d8wb_register:
4421 case ARM::VLD2d16wb_register:
4422 case ARM::VLD2d32wb_register:
4423 case ARM::VLD2q8PseudoWB_register:
4424 case ARM::VLD2q16PseudoWB_register:
4425 case ARM::VLD2q32PseudoWB_register:
4426 case ARM::VLD3d8Pseudo:
4427 case ARM::VLD3d16Pseudo:
4428 case ARM::VLD3d32Pseudo:
4429 case ARM::VLD1d8TPseudo:
4430 case ARM::VLD1d16TPseudo:
4431 case ARM::VLD1d32TPseudo:
4432 case ARM::VLD1d64TPseudo:
4433 case ARM::VLD1d64TPseudoWB_fixed:
4434 case ARM::VLD1d64TPseudoWB_register:
4435 case ARM::VLD3d8Pseudo_UPD:
4436 case ARM::VLD3d16Pseudo_UPD:
4437 case ARM::VLD3d32Pseudo_UPD:
4438 case ARM::VLD3q8Pseudo_UPD:
4439 case ARM::VLD3q16Pseudo_UPD:
4440 case ARM::VLD3q32Pseudo_UPD:
4441 case ARM::VLD3q8oddPseudo:
4442 case ARM::VLD3q16oddPseudo:
4443 case ARM::VLD3q32oddPseudo:
4444 case ARM::VLD3q8oddPseudo_UPD:
4445 case ARM::VLD3q16oddPseudo_UPD:
4446 case ARM::VLD3q32oddPseudo_UPD:
4447 case ARM::VLD4d8Pseudo:
4448 case ARM::VLD4d16Pseudo:
4449 case ARM::VLD4d32Pseudo:
4450 case ARM::VLD1d8QPseudo:
4451 case ARM::VLD1d16QPseudo:
4452 case ARM::VLD1d32QPseudo:
4453 case ARM::VLD1d64QPseudo:
4454 case ARM::VLD1d64QPseudoWB_fixed:
4455 case ARM::VLD1d64QPseudoWB_register:
4456 case ARM::VLD1q8HighQPseudo:
4457 case ARM::VLD1q8LowQPseudo_UPD:
4458 case ARM::VLD1q8HighTPseudo:
4459 case ARM::VLD1q8LowTPseudo_UPD:
4460 case ARM::VLD1q16HighQPseudo:
4461 case ARM::VLD1q16LowQPseudo_UPD:
4462 case ARM::VLD1q16HighTPseudo:
4463 case ARM::VLD1q16LowTPseudo_UPD:
4464 case ARM::VLD1q32HighQPseudo:
4465 case ARM::VLD1q32LowQPseudo_UPD:
4466 case ARM::VLD1q32HighTPseudo:
4467 case ARM::VLD1q32LowTPseudo_UPD:
4468 case ARM::VLD1q64HighQPseudo:
4469 case ARM::VLD1q64LowQPseudo_UPD:
4470 case ARM::VLD1q64HighTPseudo:
4471 case ARM::VLD1q64LowTPseudo_UPD:
4472 case ARM::VLD4d8Pseudo_UPD:
4473 case ARM::VLD4d16Pseudo_UPD:
4474 case ARM::VLD4d32Pseudo_UPD:
4475 case ARM::VLD4q8Pseudo_UPD:
4476 case ARM::VLD4q16Pseudo_UPD:
4477 case ARM::VLD4q32Pseudo_UPD:
4478 case ARM::VLD4q8oddPseudo:
4479 case ARM::VLD4q16oddPseudo:
4480 case ARM::VLD4q32oddPseudo:
4481 case ARM::VLD4q8oddPseudo_UPD:
4482 case ARM::VLD4q16oddPseudo_UPD:
4483 case ARM::VLD4q32oddPseudo_UPD:
4484 case ARM::VLD1DUPq8:
4485 case ARM::VLD1DUPq16:
4486 case ARM::VLD1DUPq32:
4487 case ARM::VLD1DUPq8wb_fixed:
4488 case ARM::VLD1DUPq16wb_fixed:
4489 case ARM::VLD1DUPq32wb_fixed:
4490 case ARM::VLD1DUPq8wb_register:
4491 case ARM::VLD1DUPq16wb_register:
4492 case ARM::VLD1DUPq32wb_register:
4493 case ARM::VLD2DUPd8:
4494 case ARM::VLD2DUPd16:
4495 case ARM::VLD2DUPd32:
4496 case ARM::VLD2DUPd8wb_fixed:
4497 case ARM::VLD2DUPd16wb_fixed:
4498 case ARM::VLD2DUPd32wb_fixed:
4499 case ARM::VLD2DUPd8wb_register:
4500 case ARM::VLD2DUPd16wb_register:
4501 case ARM::VLD2DUPd32wb_register:
4502 case ARM::VLD2DUPq8EvenPseudo:
4503 case ARM::VLD2DUPq8OddPseudo:
4504 case ARM::VLD2DUPq16EvenPseudo:
4505 case ARM::VLD2DUPq16OddPseudo:
4506 case ARM::VLD2DUPq32EvenPseudo:
4507 case ARM::VLD2DUPq32OddPseudo:
4508 case ARM::VLD3DUPq8EvenPseudo:
4509 case ARM::VLD3DUPq8OddPseudo:
4510 case ARM::VLD3DUPq16EvenPseudo:
4511 case ARM::VLD3DUPq16OddPseudo:
4512 case ARM::VLD3DUPq32EvenPseudo:
4513 case ARM::VLD3DUPq32OddPseudo:
4514 case ARM::VLD4DUPd8Pseudo:
4515 case ARM::VLD4DUPd16Pseudo:
4516 case ARM::VLD4DUPd32Pseudo:
4517 case ARM::VLD4DUPd8Pseudo_UPD:
4518 case ARM::VLD4DUPd16Pseudo_UPD:
4519 case ARM::VLD4DUPd32Pseudo_UPD:
4520 case ARM::VLD4DUPq8EvenPseudo:
4521 case ARM::VLD4DUPq8OddPseudo:
4522 case ARM::VLD4DUPq16EvenPseudo:
4523 case ARM::VLD4DUPq16OddPseudo:
4524 case ARM::VLD4DUPq32EvenPseudo:
4525 case ARM::VLD4DUPq32OddPseudo:
4526 case ARM::VLD1LNq8Pseudo:
4527 case ARM::VLD1LNq16Pseudo:
4528 case ARM::VLD1LNq32Pseudo:
4529 case ARM::VLD1LNq8Pseudo_UPD:
4530 case ARM::VLD1LNq16Pseudo_UPD:
4531 case ARM::VLD1LNq32Pseudo_UPD:
4532 case ARM::VLD2LNd8Pseudo:
4533 case ARM::VLD2LNd16Pseudo:
4534 case ARM::VLD2LNd32Pseudo:
4535 case ARM::VLD2LNq16Pseudo:
4536 case ARM::VLD2LNq32Pseudo:
4537 case ARM::VLD2LNd8Pseudo_UPD:
4538 case ARM::VLD2LNd16Pseudo_UPD:
4539 case ARM::VLD2LNd32Pseudo_UPD:
4540 case ARM::VLD2LNq16Pseudo_UPD:
4541 case ARM::VLD2LNq32Pseudo_UPD:
4542 case ARM::VLD4LNd8Pseudo:
4543 case ARM::VLD4LNd16Pseudo:
4544 case ARM::VLD4LNd32Pseudo:
4545 case ARM::VLD4LNq16Pseudo:
4546 case ARM::VLD4LNq32Pseudo:
4547 case ARM::VLD4LNd8Pseudo_UPD:
4548 case ARM::VLD4LNd16Pseudo_UPD:
4549 case ARM::VLD4LNd32Pseudo_UPD:
4550 case ARM::VLD4LNq16Pseudo_UPD:
4551 case ARM::VLD4LNq32Pseudo_UPD:
4561unsigned ARMBaseInstrInfo::getPredicationCost(
const MachineInstr &
MI)
const {
4562 if (
MI.isCopyLike() ||
MI.isInsertSubreg() ||
MI.isRegSequence() ||
4571 if (
MCID.isCall() || (
MCID.hasImplicitDefOfPhysReg(ARM::CPSR) &&
4582 unsigned *PredCost)
const {
4583 if (
MI.isCopyLike() ||
MI.isInsertSubreg() ||
MI.isRegSequence() ||
4589 if (
MI.isBundle()) {
4593 while (++
I !=
E &&
I->isInsideBundle()) {
4594 if (
I->getOpcode() != ARM::t2IT)
4595 Latency += getInstrLatency(ItinData, *
I, PredCost);
4600 const MCInstrDesc &MCID =
MI.getDesc();
4602 !Subtarget.cheapPredicableCPSRDef()))) {
4623 MI.hasOneMemOperand() ? (*
MI.memoperands_begin())->getAlign().value() : 0;
4625 if (Adj >= 0 || (
int)
Latency > -Adj) {
4633 if (!
Node->isMachineOpcode())
4636 if (!ItinData || ItinData->
isEmpty())
4639 unsigned Opcode =
Node->getMachineOpcode();
4649bool ARMBaseInstrInfo::hasHighOperandLatency(
const TargetSchedModel &SchedModel,
4654 unsigned UseIdx)
const {
4657 if (Subtarget.nonpipelinedVFP() &&
4672 unsigned DefIdx)
const {
4674 if (!ItinData || ItinData->
isEmpty())
4679 unsigned DefClass =
DefMI.getDesc().getSchedClass();
4680 std::optional<unsigned> DefCycle =
4682 return DefCycle && DefCycle <= 2U;
4690 ErrInfo =
"Pseudo flag setting opcodes only exist in Selection DAG";
4693 if (
MI.getOpcode() == ARM::tMOVr && !Subtarget.hasV6Ops()) {
4695 if (!ARM::hGPRRegClass.
contains(
MI.getOperand(0).getReg()) &&
4696 !ARM::hGPRRegClass.contains(
MI.getOperand(1).getReg())) {
4697 ErrInfo =
"Non-flag-setting Thumb1 mov is v6-only";
4701 if (
MI.getOpcode() == ARM::tPUSH ||
4702 MI.getOpcode() == ARM::tPOP ||
4703 MI.getOpcode() == ARM::tPOP_RET) {
4705 if (MO.isImplicit() || !MO.isReg())
4709 if (!(
MI.getOpcode() == ARM::tPUSH &&
Reg == ARM::LR) &&
4710 !(
MI.getOpcode() == ARM::tPOP_RET &&
Reg == ARM::PC)) {
4711 ErrInfo =
"Unsupported register in Thumb1 push/pop";
4717 if (
MI.getOpcode() == ARM::MVE_VMOV_q_rr) {
4718 assert(
MI.getOperand(4).isImm() &&
MI.getOperand(5).isImm());
4719 if ((
MI.getOperand(4).getImm() != 2 &&
MI.getOperand(4).getImm() != 3) ||
4720 MI.getOperand(4).getImm() !=
MI.getOperand(5).getImm() + 2) {
4721 ErrInfo =
"Incorrect array index for MVE_VMOV_q_rr";
4742 for (
auto Op :
MI.operands()) {
4749 ErrInfo =
"Incorrect AddrMode Imm for instruction";
4759 unsigned LoadImmOpc,
4760 unsigned LoadOpc)
const {
4761 assert(!Subtarget.isROPI() && !Subtarget.isRWPI() &&
4762 "ROPI/RWPI not currently supported with stack guard");
4770 if (LoadImmOpc == ARM::MRC || LoadImmOpc == ARM::t2MRC) {
4771 assert(!Subtarget.isReadTPSoft() &&
4772 "TLS stack protector requires hardware TLS register");
4782 Module &M = *
MBB.getParent()->getFunction().getParent();
4783 Offset = M.getStackProtectorGuardOffset();
4788 unsigned AddOpc = (LoadImmOpc == ARM::MRC) ? ARM::ADDri : ARM::t2ADDri;
4799 bool IsIndirect = Subtarget.isGVIndirectSymbol(GV);
4802 if (Subtarget.isTargetMachO()) {
4804 }
else if (Subtarget.isTargetCOFF()) {
4807 else if (IsIndirect)
4809 }
else if (IsIndirect) {
4813 if (LoadImmOpc == ARM::tMOVi32imm) {
4816 ARMSysReg::lookupMClassSysRegByName(
"apsr_nzcvq")->Encoding;
4852 unsigned &AddSubOpc,
4853 bool &NegAcc,
bool &HasLane)
const {
4854 auto I = MLxEntryMap.find(Opcode);
4855 if (
I == MLxEntryMap.end())
4859 MulOpc = Entry.MulOpc;
4860 AddSubOpc = Entry.AddSubOpc;
4861 NegAcc = Entry.NegAcc;
4862 HasLane = Entry.HasLane;
4886std::pair<uint16_t, uint16_t>
4890 if (Subtarget.hasNEON()) {
4899 (
MI.getOpcode() == ARM::VMOVRS ||
MI.getOpcode() == ARM::VMOVSR ||
4900 MI.getOpcode() == ARM::VMOVS))
4907 return std::make_pair(
ExeNEON, 0);
4912 return std::make_pair(
ExeNEON, 0);
4915 return std::make_pair(
ExeVFP, 0);
4921 unsigned SReg,
unsigned &Lane) {
4923 TRI->getMatchingSuperReg(SReg, ARM::ssub_0, &ARM::DPRRegClass);
4930 DReg =
TRI->getMatchingSuperReg(SReg, ARM::ssub_1, &ARM::DPRRegClass);
4932 assert(DReg &&
"S-register with no D super-register?");
4957 if (
MI.definesRegister(DReg,
TRI) ||
MI.readsRegister(DReg,
TRI)) {
4963 ImplicitSReg =
TRI->getSubReg(DReg,
4964 (Lane & 1) ? ARM::ssub_0 : ARM::ssub_1);
4966 MI.getParent()->computeRegisterLiveness(
TRI, ImplicitSReg,
MI);
4981 unsigned DstReg, SrcReg;
4986 switch (
MI.getOpcode()) {
4998 assert(Subtarget.hasNEON() &&
"VORRd requires NEON");
5001 DstReg =
MI.getOperand(0).getReg();
5002 SrcReg =
MI.getOperand(1).getReg();
5004 for (
unsigned i =
MI.getDesc().getNumOperands(); i; --i)
5005 MI.removeOperand(i - 1);
5008 MI.setDesc(
get(ARM::VORRd));
5020 DstReg =
MI.getOperand(0).getReg();
5021 SrcReg =
MI.getOperand(1).getReg();
5023 for (
unsigned i =
MI.getDesc().getNumOperands(); i; --i)
5024 MI.removeOperand(i - 1);
5031 MI.setDesc(
get(ARM::VGETLNi32));
5047 DstReg =
MI.getOperand(0).getReg();
5048 SrcReg =
MI.getOperand(1).getReg();
5056 for (
unsigned i =
MI.getDesc().getNumOperands(); i; --i)
5057 MI.removeOperand(i - 1);
5061 MI.setDesc(
get(ARM::VSETLNi32));
5080 DstReg =
MI.getOperand(0).getReg();
5081 SrcReg =
MI.getOperand(1).getReg();
5083 unsigned DstLane = 0, SrcLane = 0;
5092 for (
unsigned i =
MI.getDesc().getNumOperands(); i; --i)
5093 MI.removeOperand(i - 1);
5098 MI.setDesc(
get(ARM::VDUPLN32d));
5132 MCRegister CurReg = SrcLane == 1 && DstLane == 1 ? DSrc : DDst;
5133 bool CurUndef = !
MI.readsRegister(CurReg,
TRI);
5136 CurReg = SrcLane == 0 && DstLane == 0 ? DSrc : DDst;
5137 CurUndef = !
MI.readsRegister(CurReg,
TRI);
5142 if (SrcLane == DstLane)
5145 MI.setDesc(
get(ARM::VEXTd32));
5150 CurReg = SrcLane == 1 && DstLane == 0 ? DSrc : DDst;
5151 CurUndef = CurReg == DSrc && !
MI.readsRegister(CurReg,
TRI);
5154 CurReg = SrcLane == 0 && DstLane == 1 ? DSrc : DDst;
5155 CurUndef = CurReg == DSrc && !
MI.readsRegister(CurReg,
TRI);
5160 if (SrcLane != DstLane)
5166 if (ImplicitSReg != 0)
5190 unsigned OpNum)
const {
5191 auto PartialUpdateClearance = Subtarget.getPartialUpdateClearance();
5192 if (!PartialUpdateClearance)
5202 switch (
MI.getOpcode()) {
5208 case ARM::VMOVv4i16:
5209 case ARM::VMOVv2i32:
5210 case ARM::VMOVv2f32:
5211 case ARM::VMOVv1i64:
5212 UseOp =
MI.findRegisterUseOperandIdx(Reg, &
TRI,
false);
5216 case ARM::VLD1LNd32:
5225 if (UseOp != -1 &&
MI.getOperand(UseOp).readsReg())
5229 if (Reg.isVirtual()) {
5231 if (!MO.
getSubReg() ||
MI.readsVirtualRegister(Reg))
5233 }
else if (ARM::SPRRegClass.
contains(Reg)) {
5236 TRI.getMatchingSuperReg(Reg, ARM::ssub_0, &ARM::DPRRegClass);
5237 if (!DReg || !
MI.definesRegister(DReg, &
TRI))
5243 return PartialUpdateClearance;
5249 unsigned OpNum)
const {
5250 assert(OpNum <
MI.getDesc().getNumDefs() &&
"OpNum is not a def");
5255 assert(Reg.isPhysical() &&
"Can't break virtual register dependencies.");
5256 unsigned DReg = Reg;
5259 if (ARM::SPRRegClass.
contains(Reg)) {
5260 DReg = ARM::D0 + (Reg - ARM::S0) / 2;
5261 assert(
TRI.isSuperRegister(Reg, DReg) &&
"Register enums broken");
5264 assert(ARM::DPRRegClass.
contains(DReg) &&
"Can only break D-reg deps");
5265 assert(
MI.definesRegister(DReg, &
TRI) &&
"MI doesn't clobber full D-reg");
5278 MI.addRegisterKilled(DReg, &
TRI,
true);
5282 return Subtarget.hasFeature(ARM::HasV6KOps);
5286 if (
MI->getNumOperands() < 4)
5288 unsigned ShOpVal =
MI->getOperand(3).getImm();
5292 ((ShImm == 1 || ShImm == 2) &&
5302 assert(DefIdx <
MI.getDesc().getNumDefs() &&
"Invalid definition index");
5303 assert(
MI.isRegSequenceLike() &&
"Invalid kind of instruction");
5305 switch (
MI.getOpcode()) {
5317 MOReg = &
MI.getOperand(2);
5329 assert(DefIdx <
MI.getDesc().getNumDefs() &&
"Invalid definition index");
5330 assert(
MI.isExtractSubregLike() &&
"Invalid kind of instruction");
5332 switch (
MI.getOpcode()) {
5343 InputReg.
SubIdx = DefIdx == 0 ? ARM::ssub_0 : ARM::ssub_1;
5352 assert(DefIdx <
MI.getDesc().getNumDefs() &&
"Invalid definition index");
5353 assert(
MI.isInsertSubregLike() &&
"Invalid kind of instruction");
5355 switch (
MI.getOpcode()) {
5356 case ARM::VSETLNi32:
5357 case ARM::MVE_VMOV_to_lane_32:
5365 BaseReg.Reg = MOBaseReg.
getReg();
5368 InsertedReg.
Reg = MOInsertedReg.
getReg();
5376std::pair<unsigned, unsigned>
5379 return std::make_pair(TF & Mask, TF & ~Mask);
5384 using namespace ARMII;
5386 static const std::pair<unsigned, const char *> TargetFlags[] = {
5387 {MO_LO16,
"arm-lo16"}, {MO_HI16,
"arm-hi16"},
5388 {MO_LO_0_7,
"arm-lo-0-7"}, {MO_HI_0_7,
"arm-hi-0-7"},
5389 {MO_LO_8_15,
"arm-lo-8-15"}, {MO_HI_8_15,
"arm-hi-8-15"},
5396 using namespace ARMII;
5398 static const std::pair<unsigned, const char *> TargetFlags[] = {
5399 {MO_COFFSTUB,
"arm-coffstub"},
5400 {MO_GOT,
"arm-got"},
5401 {MO_SBREL,
"arm-sbrel"},
5402 {MO_DLLIMPORT,
"arm-dllimport"},
5403 {MO_SECREL,
"arm-secrel"},
5404 {MO_NONLAZY,
"arm-nonlazy"}};
5408std::optional<RegImmPair>
5411 unsigned Opcode =
MI.getOpcode();
5418 return std::nullopt;
5421 if (Opcode == ARM::SUBri)
5423 else if (Opcode != ARM::ADDri)
5424 return std::nullopt;
5429 if (!
MI.getOperand(1).isReg() || !
MI.getOperand(2).isImm())
5430 return std::nullopt;
5440 for (
auto I = From;
I != To; ++
I)
5441 if (
I->modifiesRegister(Reg,
TRI))
5454 if (CmpMI->modifiesRegister(ARM::CPSR,
TRI))
5456 if (CmpMI->readsRegister(ARM::CPSR,
TRI))
5462 if (CmpMI->getOpcode() != ARM::tCMPi8 && CmpMI->getOpcode() != ARM::t2CMPri)
5464 Register Reg = CmpMI->getOperand(0).getReg();
5467 if (Pred !=
ARMCC::AL || CmpMI->getOperand(1).getImm() != 0)
5482 return ForCodesize ? 2 : 1;
5483 if (
Subtarget->hasV6T2Ops() && (Val <= 0xffff ||
5486 return ForCodesize ? 4 : 1;
5488 return ForCodesize ? 4 : 2;
5490 return ForCodesize ? 4 : 2;
5492 return ForCodesize ? 4 : 2;
5495 return ForCodesize ? 4 : 1;
5497 return ForCodesize ? 4 : 1;
5498 if (
Subtarget->hasV6T2Ops() && Val <= 0xffff)
5499 return ForCodesize ? 4 : 1;
5501 return ForCodesize ? 8 : 2;
5503 return ForCodesize ? 8 : 2;
5506 return ForCodesize ? 8 : 2;
5507 return ForCodesize ? 8 : 3;
5673 const ARMBaseRegisterInfo *ARI =
5674 static_cast<const ARMBaseRegisterInfo *
>(&
TRI);
5683 C.isAvailableAcrossAndOutOfSeq(
Reg,
TRI) &&
5684 C.isAvailableInsideSeq(
Reg,
TRI))
5701 if (
MI.modifiesRegister(ARM::LR, &
TRI))
5705 unsigned Opcode =
MI.getOpcode();
5706 if (Opcode == ARM::BX_RET || Opcode == ARM::MOVPCLR ||
5707 Opcode == ARM::SUBS_PC_LR || Opcode == ARM::tBX_RET ||
5708 Opcode == ARM::tBXNS_RET || Opcode == ARM::t2BXAUT_RET) {
5714 if (
MI.readsRegister(ARM::LR, &
TRI))
5723 auto Opcode =
MI.getOpcode();
5724 return (Opcode == ARM::BL || Opcode == ARM::BLX || Opcode == ARM::BLX_noip ||
5725 Opcode == ARM::tBL || Opcode == ARM::tBLXi || Opcode == ARM::tBLXr ||
5726 Opcode == ARM::tBLXr_noip);
5729std::optional<std::unique_ptr<outliner::OutlinedFunction>>
5732 std::vector<outliner::Candidate> &RepeatedSequenceLocs,
5733 unsigned MinRepeats)
const {
5734 unsigned SequenceSize = 0;
5735 for (
auto &
MI : RepeatedSequenceLocs[0])
5739 unsigned FlagsSetInAll = 0xF;
5744 FlagsSetInAll &=
C.Flags;
5763 return C.isAnyUnavailableAcrossOrOutOfSeq({ARM::R12, ARM::CPSR},
TRI);
5771 llvm::erase_if(RepeatedSequenceLocs, CantGuaranteeValueAcrossCall);
5774 if (RepeatedSequenceLocs.size() < MinRepeats)
5775 return std::nullopt;
5794 if (std::distance(RepeatedSequenceLocs.begin(), NoBTI) >
5795 std::distance(NoBTI, RepeatedSequenceLocs.end()))
5796 RepeatedSequenceLocs.erase(NoBTI, RepeatedSequenceLocs.end());
5798 RepeatedSequenceLocs.erase(RepeatedSequenceLocs.begin(), NoBTI);
5800 if (RepeatedSequenceLocs.size() < MinRepeats)
5801 return std::nullopt;
5811 if (std::distance(RepeatedSequenceLocs.begin(), NoPAC) >
5812 std::distance(NoPAC, RepeatedSequenceLocs.end()))
5813 RepeatedSequenceLocs.erase(NoPAC, RepeatedSequenceLocs.end());
5815 RepeatedSequenceLocs.erase(RepeatedSequenceLocs.begin(), NoPAC);
5817 if (RepeatedSequenceLocs.size() < MinRepeats)
5818 return std::nullopt;
5824 auto SetCandidateCallInfo =
5825 [&RepeatedSequenceLocs](
unsigned CallID,
unsigned NumBytesForCall) {
5827 C.setCallInfo(CallID, NumBytesForCall);
5832 const auto &SomeMFI =
5835 if (SomeMFI.branchTargetEnforcement()) {
5844 if (SomeMFI.shouldSignReturnAddress(
true)) {
5854 if (RepeatedSequenceLocs[0].back().isTerminator()) {
5866 unsigned NumBytesNoStackCalls = 0;
5867 std::vector<outliner::Candidate> CandidatesWithoutStackFixups;
5872 const auto Last =
C.getMBB()->rbegin();
5873 const bool LRIsAvailable =
5874 C.getMBB()->isReturnBlock() && !
Last->isCall()
5877 :
C.isAvailableAcrossAndOutOfSeq(ARM::LR,
TRI);
5878 if (LRIsAvailable) {
5882 CandidatesWithoutStackFixups.push_back(
C);
5887 else if (findRegisterToSaveLRTo(
C)) {
5891 CandidatesWithoutStackFixups.push_back(
C);
5896 else if (
C.isAvailableInsideSeq(ARM::SP,
TRI)) {
5899 CandidatesWithoutStackFixups.push_back(
C);
5905 NumBytesNoStackCalls += SequenceSize;
5911 if (NumBytesNoStackCalls <=
5912 RepeatedSequenceLocs.size() * Costs.
CallDefault) {
5913 RepeatedSequenceLocs = CandidatesWithoutStackFixups;
5915 if (RepeatedSequenceLocs.size() < MinRepeats)
5916 return std::nullopt;
5941 return std::make_unique<outliner::OutlinedFunction>(
5942 RepeatedSequenceLocs, SequenceSize, NumBytesToCreateFrame, FrameID);
5945bool ARMBaseInstrInfo::checkAndUpdateStackOffset(
MachineInstr *
MI,
5948 int SPIdx =
MI->findRegisterUseOperandIdx(ARM::SP,
nullptr);
5973 unsigned NumOps =
MI->getDesc().getNumOperands();
5974 unsigned ImmIdx =
NumOps - 3;
5978 int64_t OffVal =
Offset.getImm();
5984 unsigned NumBits = 0;
6013 assert((Fixup & 3) == 0 &&
"Can't encode this offset!");
6033 assert(((OffVal * Scale + Fixup) & (Scale - 1)) == 0 &&
6034 "Can't encode this offset!");
6035 OffVal += Fixup / Scale;
6037 unsigned Mask = (1 << NumBits) - 1;
6039 if (OffVal <= Mask) {
6041 MI->getOperand(ImmIdx).setImm(OffVal);
6049 Function &
F, std::vector<outliner::Candidate> &Candidates)
const {
6053 const Function &CFn =
C.getMF()->getFunction();
6060 ARMGenInstrInfo::mergeOutliningCandidateAttributes(
F, Candidates);
6066 OutlineFromLinkOnceODRs))
6078 unsigned &Flags)
const {
6081 assert(
MBB.getParent()->getRegInfo().tracksLiveness() &&
6082 "Suitable Machine Function for outlining must track liveness");
6090 bool R12AvailableInBlock = LRU.
available(ARM::R12);
6091 bool CPSRAvailableInBlock = LRU.
available(ARM::CPSR);
6095 if (R12AvailableInBlock && CPSRAvailableInBlock)
6103 if (R12AvailableInBlock && !LRU.
available(ARM::R12))
6105 if (CPSRAvailableInBlock && !LRU.
available(ARM::CPSR))
6115 bool LRIsAvailable =
6116 MBB.isReturnBlock() && !
MBB.back().isCall()
6128 unsigned Flags)
const {
6134 unsigned Opc =
MI.getOpcode();
6135 if (
Opc == ARM::tPICADD ||
Opc == ARM::PICADD ||
Opc == ARM::PICSTR ||
6136 Opc == ARM::PICSTRB ||
Opc == ARM::PICSTRH ||
Opc == ARM::PICLDR ||
6137 Opc == ARM::PICLDRB ||
Opc == ARM::PICLDRH ||
Opc == ARM::PICLDRSB ||
6138 Opc == ARM::PICLDRSH ||
Opc == ARM::t2LDRpci_pic ||
6139 Opc == ARM::t2MOVi16_ga_pcrel ||
Opc == ARM::t2MOVTi16_ga_pcrel ||
6140 Opc == ARM::t2MOV_ga_pcrel)
6144 if (
Opc == ARM::t2BF_LabelPseudo ||
Opc == ARM::t2DoLoopStart ||
6145 Opc == ARM::t2DoLoopStartTP ||
Opc == ARM::t2WhileLoopStart ||
6146 Opc == ARM::t2WhileLoopStartLR ||
Opc == ARM::t2WhileLoopStartTP ||
6147 Opc == ARM::t2LoopDec ||
Opc == ARM::t2LoopEnd ||
6148 Opc == ARM::t2LoopEndDec)
6152 uint64_t MIFlags =
MCID.TSFlags;
6157 if (
MI.isTerminator())
6163 if (
MI.readsRegister(ARM::LR,
TRI) ||
MI.readsRegister(ARM::PC,
TRI))
6171 if (MOP.isGlobal()) {
6180 (Callee->getName() ==
"\01__gnu_mcount_nc" ||
6181 Callee->getName() ==
"\01mcount" || Callee->getName() ==
"__mcount"))
6193 return UnknownCallOutlineType;
6201 return UnknownCallOutlineType;
6209 return UnknownCallOutlineType;
6217 if (
MI.modifiesRegister(ARM::LR,
TRI) ||
MI.modifiesRegister(ARM::PC,
TRI))
6221 if (
MI.modifiesRegister(ARM::SP,
TRI) ||
MI.readsRegister(ARM::SP,
TRI)) {
6234 bool MightNeedStackFixUp =
6238 if (!MightNeedStackFixUp)
6244 if (
MI.modifiesRegister(ARM::SP,
TRI))
6249 if (checkAndUpdateStackOffset(&
MI, Subtarget.getStackAlignment().value(),
6258 if (
MI.readsRegister(ARM::ITSTATE,
TRI) ||
6259 MI.modifiesRegister(ARM::ITSTATE,
TRI))
6263 if (
MI.isCFIInstruction())
6271 checkAndUpdateStackOffset(&
MI,
Subtarget.getStackAlignment().value(),
true);
6278 int Align = std::max(Subtarget.getStackAlignment().value(),
uint64_t(8));
6280 assert(Align >= 8 && Align <= 256);
6282 assert(Subtarget.isThumb2());
6294 unsigned Opc = Subtarget.isThumb() ? ARM::t2STR_PRE : ARM::STR_PRE_IMM;
6308 CFIBuilder.buildDefCFAOffset(Align);
6313 CFIBuilder.buildOffset(ARM::LR, -LROffset);
6316 CFIBuilder.buildOffset(ARM::RA_AUTH_CODE, -Align);
6322 bool CFI,
bool Auth)
const {
6323 int Align = Subtarget.getStackAlignment().value();
6326 assert(Subtarget.isThumb2());
6338 unsigned Opc = Subtarget.isThumb() ? ARM::t2LDR_POST : ARM::LDR_POST_IMM;
6342 if (!Subtarget.isThumb())
6344 MIB.
addImm(Subtarget.getStackAlignment().value())
6352 CFIBuilder.buildDefCFAOffset(0);
6353 CFIBuilder.buildRestore(ARM::LR);
6355 CFIBuilder.buildUndefined(ARM::RA_AUTH_CODE);
6369 bool isThumb = Subtarget.isThumb();
6370 unsigned FuncOp =
isThumb ? 2 : 0;
6371 unsigned Opc =
Call->getOperand(FuncOp).isReg()
6372 ?
isThumb ? ARM::tTAILJMPr : ARM::TAILJMPr
6373 :
isThumb ? Subtarget.isTargetMachO() ? ARM::tTAILJMPd
6377 .
add(
Call->getOperand(FuncOp));
6380 Call->eraseFromParent();
6385 return MI.isCall() && !
MI.isReturn();
6393 Et = std::prev(
MBB.end());
6398 if (!
MBB.isLiveIn(ARM::LR))
6399 MBB.addLiveIn(ARM::LR);
6403 saveLROnStack(
MBB, It,
true, Auth);
6408 "Can only fix up stack references once");
6409 fixupPostOutline(
MBB);
6412 restoreLRFromStack(
MBB, Et,
true, Auth);
6432 fixupPostOutline(
MBB);
6441 bool isThumb = Subtarget.isThumb();
6447 ? Subtarget.isTargetMachO() ? ARM::tTAILJMPd : ARM::tTAILJMPdND
6453 It =
MBB.insert(It, MIB);
6467 It =
MBB.insert(It, CallMIB);
6474 Register Reg = findRegisterToSaveLRTo(
C);
6475 assert(Reg != 0 &&
"No callee-saved register available?");
6482 CallPt =
MBB.insert(It, CallMIB);
6490 if (!
MBB.isLiveIn(ARM::LR))
6491 MBB.addLiveIn(ARM::LR);
6494 CallPt =
MBB.insert(It, CallMIB);
6505bool ARMBaseInstrInfo::isReMaterializableImpl(
6539 static int constexpr MAX_STAGES = 30;
6540 static int constexpr LAST_IS_USE = MAX_STAGES;
6541 static int constexpr SEEN_AS_LIVE = MAX_STAGES + 1;
6542 typedef std::bitset<MAX_STAGES + 2> IterNeed;
6543 typedef std::map<Register, IterNeed> IterNeeds;
6546 const IterNeeds &CIN);
6558 : EndLoop(EndLoop), LoopCount(LoopCount),
6560 TII(MF->getSubtarget().getInstrInfo()) {}
6562 bool shouldIgnoreForPipelining(
const MachineInstr *
MI)
const override {
6564 return MI == EndLoop ||
MI == LoopCount;
6567 bool shouldUseSchedule(SwingSchedulerDAG &SSD, SMSchedule &SMS)
override {
6568 if (tooMuchRegisterPressure(SSD, SMS))
6574 std::optional<bool> createTripCountGreaterCondition(
6575 int TC, MachineBasicBlock &
MBB,
6576 SmallVectorImpl<MachineOperand> &
Cond)
override {
6585 }
else if (EndLoop->
getOpcode() == ARM::t2LoopEnd) {
6588 MachineInstr *LoopDec =
nullptr;
6590 if (
I.getOpcode() == ARM::t2LoopDec)
6592 assert(LoopDec &&
"Unable to find copied LoopDec");
6606 void setPreheader(MachineBasicBlock *NewPreheader)
override {}
6608 void adjustTripCount(
int TripCountAdjust)
override {}
6612 const IterNeeds &CIN) {
6614 for (
const auto &
N : CIN) {
6615 int Cnt =
N.second.count() -
N.second[SEEN_AS_LIVE] * 2;
6616 for (
int I = 0;
I < Cnt; ++
I)
6621 for (
const auto &
N : CIN) {
6622 int Cnt =
N.second.count() -
N.second[SEEN_AS_LIVE] * 2;
6623 for (
int I = 0;
I < Cnt; ++
I)
6631 IterNeeds CrossIterationNeeds;
6636 for (
auto &SU : SSD.
SUnits) {
6639 for (
auto &S : SU.Succs)
6643 CrossIterationNeeds[
Reg.
id()].set(0);
6644 }
else if (S.isAssignedRegDep()) {
6646 if (OStg >= 0 && OStg != Stg) {
6649 CrossIterationNeeds[
Reg.
id()] |= ((1 << (OStg - Stg)) - 1);
6658 std::vector<SUnit *> ProposedSchedule;
6662 std::deque<SUnit *> Instrs =
6664 std::sort(Instrs.begin(), Instrs.end(),
6665 [](
SUnit *
A,
SUnit *
B) { return A->NodeNum > B->NodeNum; });
6672 for (
auto *SU : ProposedSchedule)
6676 if (!MO.isReg() || !MO.getReg())
6679 auto CIter = CrossIterationNeeds.find(
Reg.
id());
6680 if (CIter == CrossIterationNeeds.end() || CIter->second[LAST_IS_USE] ||
6681 CIter->second[SEEN_AS_LIVE])
6683 if (MO.isDef() && !MO.isDead())
6684 CIter->second.set(SEEN_AS_LIVE);
6685 else if (MO.isUse())
6686 CIter->second.set(LAST_IS_USE);
6688 for (
auto &CI : CrossIterationNeeds)
6689 CI.second.reset(LAST_IS_USE);
6695 RPTracker.init(MF, &RegClassInfo,
nullptr, EndLoop->
getParent(),
6698 bumpCrossIterationPressure(RPTracker, CrossIterationNeeds);
6700 for (
auto *SU : ProposedSchedule) {
6702 RPTracker.setPos(std::next(CurInstI));
6708 if (!MO.isReg() || !MO.getReg())
6711 if (MO.isDef() && !MO.isDead()) {
6712 auto CIter = CrossIterationNeeds.find(
Reg.
id());
6713 if (CIter != CrossIterationNeeds.end()) {
6714 CIter->second.reset(0);
6715 CIter->second.reset(SEEN_AS_LIVE);
6719 for (
auto &S : SU->Preds) {
6721 if (S.isAssignedRegDep()) {
6723 auto CIter = CrossIterationNeeds.find(
Reg.
id());
6724 if (CIter != CrossIterationNeeds.end()) {
6726 assert(Stg2 <= Stg &&
"Data dependence upon earlier stage");
6727 if (Stg - Stg2 < MAX_STAGES)
6728 CIter->second.set(Stg - Stg2);
6729 CIter->second.set(SEEN_AS_LIVE);
6734 bumpCrossIterationPressure(RPTracker, CrossIterationNeeds);
6737 auto &
P = RPTracker.getPressure().MaxSetPressure;
6738 for (
unsigned I = 0,
E =
P.size();
I <
E; ++
I) {
6740 if (
I == ARM::DQuad_with_ssub_0 ||
I == ARM::DTripleSpc_with_ssub_0 ||
6741 I == ARM::DTriple_with_qsub_0_in_QPR)
6753std::unique_ptr<TargetInstrInfo::PipelinerLoopInfo>
6757 if (Preheader == LoopBB)
6758 Preheader = *std::next(LoopBB->
pred_begin());
6760 if (
I != LoopBB->
end() &&
I->getOpcode() == ARM::t2Bcc) {
6766 for (
auto &L : LoopBB->
instrs()) {
6773 return std::make_unique<ARMPipelinerLoopInfo>(&*
I, CCSetter);
6787 if (
I != LoopBB->
end() &&
I->getOpcode() == ARM::t2LoopEnd) {
6788 for (
auto &L : LoopBB->
instrs())
6793 Register LoopDecResult =
I->getOperand(0).getReg();
6796 if (!LoopDec || LoopDec->
getOpcode() != ARM::t2LoopDec)
6799 for (
auto &J : Preheader->
instrs())
6800 if (J.getOpcode() == ARM::t2DoLoopStart)
6804 return std::make_unique<ARMPipelinerLoopInfo>(&*
I, LoopDec);
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
const AArch64Subtarget & Subtarget
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.
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const AArch64InstrInfo & TII
static bool isThumb(const MCSubtargetInfo &STI)
static bool getImplicitSPRUseForDPRUse(const TargetRegisterInfo *TRI, MachineInstr &MI, MCRegister DReg, unsigned Lane, MCRegister &ImplicitSReg)
getImplicitSPRUseForDPRUse - Given a use of a DPR register and lane, set ImplicitSReg to a register n...
static const MachineInstr * getBundledUseMI(const TargetRegisterInfo *TRI, const MachineInstr &MI, unsigned Reg, unsigned &UseIdx, unsigned &Dist)
static unsigned duplicateCPV(MachineFunction &MF, unsigned &CPI)
Create a copy of a const pool value.
static bool isSuitableForMask(MachineInstr *&MI, Register SrcReg, int CmpMask, bool CommonUse)
isSuitableForMask - Identify a suitable 'and' instruction that operates on the given source register ...
static int adjustDefLatency(const ARMSubtarget &Subtarget, const MachineInstr &DefMI, const MCInstrDesc &DefMCID, unsigned DefAlign)
Return the number of cycles to add to (or subtract from) the static itinerary based on the def opcode...
static unsigned getNumMicroOpsSwiftLdSt(const InstrItineraryData *ItinData, const MachineInstr &MI)
static MCRegister getCorrespondingDRegAndLane(const TargetRegisterInfo *TRI, unsigned SReg, unsigned &Lane)
static bool CanTransformInstrIntoTailCall(const MachineInstr &MI)
Return true if MI is a call instruction that the outliner can rewrite as a tail call.
static const AddSubFlagsOpcodePair AddSubFlagsOpcodeMap[]
static bool isEligibleForITBlock(const MachineInstr *MI)
static ARMCC::CondCodes getCmpToAddCondition(ARMCC::CondCodes CC)
getCmpToAddCondition - assume the flags are set by CMP(a,b), return the condition code if we modify t...
static bool isOptimizeCompareCandidate(MachineInstr *MI, bool &IsThumb1)
static bool isLRAvailable(const TargetRegisterInfo &TRI, MachineBasicBlock::reverse_iterator I, MachineBasicBlock::reverse_iterator E)
static const ARM_MLxEntry ARM_MLxTable[]
static bool isRedundantFlagInstr(const MachineInstr *CmpI, Register SrcReg, Register SrcReg2, int64_t ImmValue, const MachineInstr *OI, bool &IsThumb1)
isRedundantFlagInstr - check whether the first instruction, whose only purpose is to update flags,...
static unsigned getNumMicroOpsSingleIssuePlusExtras(unsigned Opc, unsigned NumRegs)
static const MachineInstr * getBundledDefMI(const TargetRegisterInfo *TRI, const MachineInstr *MI, unsigned Reg, unsigned &DefIdx, unsigned &Dist)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
This file contains the simple types necessary to represent the attributes associated with functions a...
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< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
DXIL Forward Handle Accesses
This file defines the DenseMap class.
Module.h This file contains the declarations for the Module class.
const size_t AbstractManglingParser< Derived, Alloc >::NumOps
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
TargetInstrInfo::RegSubRegPair RegSubRegPair
Register const TargetRegisterInfo * TRI
Promote Memory to Register
static MCRegister getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
uint64_t IntrinsicInst * II
TargetInstrInfo::RegSubRegPairAndIdx RegSubRegPairAndIdx
SmallVector< MachineOperand, 4 > Cond
MachineRegisterInfo & MRI
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallSet class.
This file defines the SmallVector class.
static X86::CondCode getSwappedCondition(X86::CondCode CC)
Assuming the flags are set by MI(a,b), return the condition code if we modify the instructions such t...
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
static bool isCPSRDefined(const MachineInstr &MI)
const MachineOperand & getCalleeOperand(const MachineInstr &MI) 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 to set the zero flag so that we can remove a "comparis...
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
ScheduleHazardRecognizer * CreateTargetHazardRecognizer(const TargetSubtargetInfo *STI, const ScheduleDAG *DAG) 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
bool foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, Register Reg, MachineRegisterInfo *MRI) const override
foldImmediate - 'Reg' is known to be defined by a move immediate instruction, try to fold the immedia...
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
bool ClobbersPredicate(MachineInstr &MI, std::vector< MachineOperand > &Pred, bool SkipDead) 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
void copyFromCPSR(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, MCRegister DestReg, bool KillSrc, const ARMSubtarget &Subtarget) const
unsigned getNumMicroOps(const InstrItineraryData *ItinData, const MachineInstr &MI) const override
std::optional< RegImmPair > isAddImmediate(const MachineInstr &MI, Register Reg) const override
unsigned getNumLDMAddresses(const MachineInstr &MI) const
Get the number of addresses by LDM or VLDM or zero for unknown.
MachineInstr * optimizeSelect(MachineInstr &MI, SmallPtrSetImpl< MachineInstr * > &SeenMIs, bool) const override
bool produceSameValue(const MachineInstr &MI0, const MachineInstr &MI1, const MachineRegisterInfo *MRI) const override
void setExecutionDomain(MachineInstr &MI, unsigned Domain) const override
ArrayRef< std::pair< unsigned, const char * > > getSerializableBitmaskMachineOperandTargetFlags() const override
ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, const ScheduleDAG *DAG) const override
std::unique_ptr< TargetInstrInfo::PipelinerLoopInfo > analyzeLoopForPipelining(MachineBasicBlock *LoopBB) const override
Analyze loop L, which must be a single-basic-block loop, and if the conditions can be understood enou...
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Returns the size of the specified MachineInstr.
void copyToCPSR(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, MCRegister SrcReg, bool KillSrc, const ARMSubtarget &Subtarget) const
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
void mergeOutliningCandidateAttributes(Function &F, std::vector< outliner::Candidate > &Candidates) const override
const MachineInstrBuilder & AddDReg(MachineInstrBuilder &MIB, unsigned Reg, unsigned SubIdx, RegState State) const
unsigned getPartialRegUpdateClearance(const MachineInstr &, unsigned) const override
bool isFunctionSafeToOutlineFrom(MachineFunction &MF, bool OutlineFromLinkOnceODRs) const override
ARM supports the MachineOutliner.
bool shouldOutlineFromFunctionByDefault(MachineFunction &MF) const override
Enable outlining by default at -Oz.
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...
MachineInstr & duplicate(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig) const override
ScheduleHazardRecognizer * CreateTargetMIHazardRecognizer(const InstrItineraryData *II, const ScheduleDAGMI *DAG) const override
MachineBasicBlock::iterator insertOutlinedCall(Module &M, MachineBasicBlock &MBB, MachineBasicBlock::iterator &It, MachineFunction &MF, outliner::Candidate &C) const override
bool isPredicated(const MachineInstr &MI) const override
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
void expandLoadStackGuardBase(MachineBasicBlock::iterator MI, unsigned LoadImmOpc, unsigned LoadOpc) const
bool isPredicable(const MachineInstr &MI) const override
isPredicable - Return true if the specified instruction can be predicated.
Register isLoadFromStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
std::optional< ParamLoadedValue > describeLoadedValue(const MachineInstr &MI, Register Reg) const override
Specialization of TargetInstrInfo::describeLoadedValue, used to enhance debug entry value description...
std::optional< std::unique_ptr< outliner::OutlinedFunction > > getOutliningCandidateInfo(const MachineModuleInfo &MMI, std::vector< outliner::Candidate > &RepeatedSequenceLocs, unsigned MinRepeats) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const override
unsigned extraSizeToPredicateInstructions(const MachineFunction &MF, unsigned NumInsts) const override
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
const ARMBaseRegisterInfo & getRegisterInfo() const
bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2, int64_t &Offset1, int64_t &Offset2) const override
areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler to determine if two loads are lo...
void breakPartialRegDependency(MachineInstr &, unsigned) const override
std::optional< unsigned > getOperandLatency(const InstrItineraryData *ItinData, const MachineInstr &DefMI, unsigned DefIdx, const MachineInstr &UseMI, unsigned UseIdx) const override
std::string createMIROperandComment(const MachineInstr &MI, const MachineOperand &Op, unsigned OpIdx) const override
bool getRegSequenceLikeInputs(const MachineInstr &MI, unsigned DefIdx, SmallVectorImpl< RegSubRegPairAndIdx > &InputRegs) const override
Build the equivalent inputs of a REG_SEQUENCE for the given MI and DefIdx.
unsigned predictBranchSizeForIfCvt(MachineInstr &MI) const override
bool getInsertSubregLikeInputs(const MachineInstr &MI, unsigned DefIdx, RegSubRegPair &BaseReg, RegSubRegPairAndIdx &InsertedReg) const override
Build the equivalent inputs of a INSERT_SUBREG for the given MI and DefIdx.
bool expandPostRAPseudo(MachineInstr &MI) const override
outliner::InstrType getOutliningTypeImpl(const MachineModuleInfo &MMI, MachineBasicBlock::iterator &MIT, unsigned Flags) const override
bool SubsumesPredicate(ArrayRef< MachineOperand > Pred1, ArrayRef< MachineOperand > Pred2) const override
bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, int64_t Offset1, int64_t Offset2, unsigned NumLoads) const override
shouldScheduleLoadsNear - This is a used by the pre-regalloc scheduler to determine (in conjunction w...
bool PredicateInstruction(MachineInstr &MI, ArrayRef< MachineOperand > Pred) const override
std::pair< uint16_t, uint16_t > getExecutionDomain(const MachineInstr &MI) const override
VFP/NEON execution domains.
bool isProfitableToUnpredicate(MachineBasicBlock &TMBB, MachineBasicBlock &FMBB) const override
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
bool isFpMLxInstruction(unsigned Opcode) const
isFpMLxInstruction - Return true if the specified opcode is a fp MLA / MLS instruction.
bool isSwiftFastImmShift(const MachineInstr *MI) const
Returns true if the instruction has a shift by immediate that can be executed in one cycle less.
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, unsigned SubIdx, const MachineInstr &Orig, LaneBitmask UsedLanes=LaneBitmask::getAll()) const override
ARMBaseInstrInfo(const ARMSubtarget &STI, const ARMBaseRegisterInfo &TRI)
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
Register isStoreToStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
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 if h...
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
bool isMBBSafeToOutlineFrom(MachineBasicBlock &MBB, unsigned &Flags) const override
void buildOutlinedFrame(MachineBasicBlock &MBB, MachineFunction &MF, const outliner::OutlinedFunction &OF) const override
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
const ARMSubtarget & getSubtarget() const
MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned OpIdx1, unsigned OpIdx2) const override
Commutes the operands in the given instruction.
bool getExtractSubregLikeInputs(const MachineInstr &MI, unsigned DefIdx, RegSubRegPairAndIdx &InputReg) const override
Build the equivalent inputs of a EXTRACT_SUBREG for the given MI and DefIdx.
bool shouldSink(const MachineInstr &MI) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
static ARMConstantPoolConstant * Create(const Constant *C, unsigned ID)
static ARMConstantPoolMBB * Create(LLVMContext &C, const MachineBasicBlock *mbb, unsigned ID, unsigned char PCAdj)
static ARMConstantPoolSymbol * Create(LLVMContext &C, StringRef s, unsigned ID, unsigned char PCAdj, ARMCP::ARMCPModifier Modifier=ARMCP::no_modifier, bool AddCurrentAddress=false)
ARMConstantPoolValue - ARM specific constantpool value.
bool isMachineBasicBlock() const
bool isGlobalValue() const
ARMCP::ARMCPModifier getModifier() const
bool mustAddCurrentAddress() const
virtual bool hasSameValue(ARMConstantPoolValue *ACPV)
hasSameValue - Return true if this ARM constpool value can share the same constantpool entry as anoth...
bool isBlockAddress() const
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
bool isThumb2Function() const
bool branchTargetEnforcement() const
unsigned createPICLabelUId()
bool isThumb1OnlyFunction() const
bool isThumbFunction() const
bool shouldSignReturnAddress() const
bool enableMachinePipeliner() const override
Returns true if machine pipeliner should be enabled.
@ DoubleIssueCheckUnalignedAccess
Can load/store 2 registers/cycle, but needs an extra cycle if the access is not 64-bit aligned.
@ SingleIssue
Can load/store 1 register/cycle.
@ DoubleIssue
Can load/store 2 registers/cycle.
@ SingleIssuePlusExtras
Can load/store 1 register/cycle, but needs an extra cycle for address computation and potentially als...
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
bool test(unsigned Idx) const
Returns true if bit Idx is set.
size_type size() const
Returns the number of bits in this bitvector.
LLVM_ABI uint64_t scale(uint64_t Num) const
Scale a large integer.
BranchProbability getCompl() const
Helper class for creating CFI instructions and inserting them into MIR.
void buildRegister(MCRegister Reg1, MCRegister Reg2) const
void buildRestore(MCRegister Reg) const
ConstMIBundleOperands - Iterate over all operands in a const bundle of machine instructions.
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool hasDLLImportStorageClass() const
Itinerary data supplied by a subtarget to be used by a target.
int getNumMicroOps(unsigned ItinClassIndx) const
Return the number of micro-ops that the given class decodes to.
std::optional< unsigned > getOperandCycle(unsigned ItinClassIndx, unsigned OperandIdx) const
Return the cycle for the given class and operand.
unsigned getStageLatency(unsigned ItinClassIndx) const
Return the total stage latency of the given class.
std::optional< unsigned > getOperandLatency(unsigned DefClass, unsigned DefIdx, unsigned UseClass, unsigned UseIdx) const
Compute and return the use operand latency of a given itinerary class and operand index if the value ...
bool hasPipelineForwarding(unsigned DefClass, unsigned DefIdx, unsigned UseClass, unsigned UseIdx) const
Return true if there is a pipeline forwarding between instructions of itinerary classes DefClass and ...
bool isEmpty() const
Returns true if there are no itineraries.
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 addLiveOuts(const MachineBasicBlock &MBB)
Adds registers living out of block MBB.
LLVM_ABI void accumulate(const MachineInstr &MI)
Adds all register units used, defined or clobbered in MI.
This class is intended to be used as a base class for asm properties and features specific to the tar...
Describe properties that are true of each instruction in the target description file.
unsigned getSchedClass() const
Return the scheduling class for this instruction.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
ArrayRef< MCOperandInfo > operands() const
bool mayLoad() const
Return true if this instruction could possibly read memory.
bool hasOptionalDef() const
Set if this instruction has an optional definition, e.g.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
bool isCall() const
Return true if the instruction is a call.
unsigned getOpcode() const
Return the opcode number for this descriptor.
LLVM_ABI bool hasImplicitDefOfPhysReg(MCRegister Reg, const MCRegisterInfo *MRI=nullptr) const
Return true if this instruction implicitly defines the specified physical register.
MCRegister getRegister(unsigned i) const
getRegister - Return the specified register in the class.
Wrapper class representing physical registers. Should be passed by value.
bool isValid() const
isValid - Returns true until all the operands have been visited.
unsigned pred_size() const
MachineInstrBundleIterator< const MachineInstr > const_iterator
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
Instructions::iterator instr_iterator
pred_iterator pred_begin()
MachineInstrBundleIterator< MachineInstr, true > reverse_iterator
Instructions::const_iterator const_instr_iterator
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.
MachineInstrBundleIterator< MachineInstr > iterator
LivenessQueryResult
Possible outcome of a register liveness query to computeRegisterLiveness()
@ LQR_Dead
Register is known to be fully dead.
@ LQR_Live
Register is known to be (at least partially) live.
@ LQR_Unknown
Register liveness not decidable from local neighborhood.
This class is a data container for one entry in a MachineConstantPool.
union llvm::MachineConstantPoolEntry::@004270020304201266316354007027341142157160323045 Val
The constant itself.
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
MachineConstantPoolValue * MachineCPVal
const Constant * ConstVal
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
const std::vector< MachineConstantPoolEntry > & getConstants() const
LLVM_ABI unsigned getConstantPoolIndex(const Constant *C, Align Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one.
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.
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.
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.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
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 TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addFrameIndex(int Idx) const
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned TargetFlags=0) 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 & cloneMemRefs(const MachineInstr &OtherMI) const
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
Representation of each machine instruction.
ArrayRef< MachineMemOperand * >::iterator mmo_iterator
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool isImplicitDef() const
const MachineBasicBlock * getParent() const
bool isCopyLike() const
Return true if the instruction behaves like a copy.
bool isCall(QueryType Type=AnyInBundle) const
unsigned getNumOperands() const
Retuns the total number of operands.
LLVM_ABI int findFirstPredOperandIdx() const
Find the index of the first operand in the operand list that is used to represent the predicate.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
bool isRegSequence() const
bool isInsertSubreg() const
LLVM_ABI void tieOperands(unsigned DefIdx, unsigned UseIdx)
Add a tie between the register operands at DefIdx and UseIdx.
LLVM_ABI bool isIdenticalTo(const MachineInstr &Other, MICheckType Check=CheckDefs) const
Return true if this instruction is identical to Other.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
LLVM_ABI bool addRegisterKilled(Register IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI kills a register.
bool hasOptionalDef(QueryType Type=IgnoreBundle) const
Set if this instruction has an optional definition, e.g.
LLVM_ABI void addRegisterDefined(Register Reg, const TargetRegisterInfo *RegInfo=nullptr)
We have determined MI defines a register.
const MachineOperand & getOperand(unsigned i) const
LLVM_ABI void clearKillInfo()
Clears kill flags on all operands.
LLVM_ABI MachineInstrBundleIterator< MachineInstr > eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
A description of a memory reference used in the backend.
@ MODereferenceable
The memory access is dereferenceable (i.e., doesn't trap).
@ MOLoad
The memory access reads data.
@ MOInvariant
The memory access always returns the same value (or traps).
@ 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.
unsigned getSubReg() const
const GlobalValue * getGlobal() const
void setImplicit(bool Val=true)
void setImm(int64_t immVal)
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
MachineBasicBlock * getMBB() const
LLVM_ABI void ChangeToImmediate(int64_t ImmVal, unsigned TargetFlags=0)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value.
static MachineOperand CreateImm(int64_t Val)
Register getReg() const
getReg - Returns the register number.
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 bool clobbersPhysReg(const uint32_t *RegMask, MCRegister PhysReg)
clobbersPhysReg - Returns true if this RegMask clobbers PhysReg.
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)
int64_t getOffset() const
Return the offset from the symbol in this operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
defusechain_instr_iterator< true, false, false, true > use_instr_iterator
use_instr_iterator/use_instr_begin/use_instr_end - Walk all uses of the specified register,...
const TargetRegisterInfo * getTargetRegisterInfo() const
A Module instance is used to store all the information related to an LLVM module.
void AddHazardRecognizer(std::unique_ptr< ScheduleHazardRecognizer > &&)
Track the current register pressure at some position in the instruction stream, and remember the high...
LLVM_ABI void increaseRegPressure(VirtRegOrUnit VRegOrUnit, LaneBitmask PreviousMask, LaneBitmask NewMask)
LLVM_ABI void decreaseRegPressure(VirtRegOrUnit VRegOrUnit, LaneBitmask PreviousMask, LaneBitmask NewMask)
unsigned getRegPressureSetLimit(unsigned Idx) const
Get the register unit limit for the given pressure set index.
LLVM_ABI void runOnMachineFunction(const MachineFunction &MF, bool Rev=false)
runOnFunction - Prepare to answer questions about MF.
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
static constexpr bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
constexpr unsigned id() const
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
Represents one node in the SelectionDAG.
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode.
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
const SDValue & getOperand(unsigned Num) const
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
@ Anti
A register anti-dependence (aka WAR).
This class represents the scheduled code.
unsigned getMaxStageCount()
Return the maximum stage count needed for this schedule.
int stageScheduled(SUnit *SU) const
Return the stage for a scheduled instruction.
int getInitiationInterval() const
Return the initiation interval for this schedule.
std::deque< SUnit * > & getInstructions(int cycle)
Return the instructions that are scheduled at the specified cycle.
int getFirstCycle() const
Return the first cycle in the completed schedule.
int getFinalCycle() const
Return the last cycle in the finalized schedule.
Scheduling unit. This is a node in the scheduling DAG.
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
virtual bool hasVRegLiveness() const
Return true if this DAG supports VReg liveness and RegPressure.
std::vector< SUnit > SUnits
The scheduling units.
HazardRecognizer - This determines whether or not an instruction can be issued this cycle,...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
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.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
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.
Represent a constant reference to a string, i.e.
This class builds the dependence graph for the instructions in a loop, and attempts to schedule the i...
Object returned by analyzeLoopForPipelining.
TargetInstrInfo - Interface to description of machine instruction set.
virtual ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *, const ScheduleDAG *DAG) const
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
virtual ScheduleHazardRecognizer * CreateTargetMIHazardRecognizer(const InstrItineraryData *, const ScheduleDAGMI *DAG) const
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
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 ScheduleHazardRecognizer * CreateTargetHazardRecognizer(const TargetSubtargetInfo *STI, const ScheduleDAG *DAG) const
Allocate and return a hazard recognizer to use for this target when scheduling the machine instructio...
virtual bool isReMaterializableImpl(const MachineInstr &MI) const
For instructions with opcodes for which the M_REMATERIALIZABLE flag is set, this hook lets the target...
virtual MachineInstr & duplicate(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig) const
Clones instruction or the whole instruction bundle Orig and insert into MBB before InsertBefore.
virtual std::string createMIROperandComment(const MachineInstr &MI, const MachineOperand &Op, unsigned OpIdx) const
virtual bool isFunctionSafeToOutlineFrom(MachineFunction &MF, bool OutlineFromLinkOnceODRs) const
Return true if the function can safely be outlined from.
virtual const MachineOperand & getCalleeOperand(const MachineInstr &MI) const
Returns the callee operand from the given MI.
virtual MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned OpIdx1, unsigned OpIdx2) const
This method commutes the operands of the given machine instruction MI.
const MCAsmInfo & getMCAsmInfo() const
Return target specific asm information.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Provide an instruction scheduling machine model to CodeGen passes.
LLVM_ABI unsigned computeOperandLatency(const MachineInstr *DefMI, unsigned DefOperIdx, const MachineInstr *UseMI, unsigned UseOperIdx) const
Compute operand latency based on the available machine model.
const InstrItineraryData * getInstrItineraries() const
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
Wrapper class representing a virtual register or register unit.
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
static CondCodes getOppositeCondition(CondCodes CC)
ARMII - This namespace holds all of the target specific flags that instruction info tracks.
@ MO_OPTION_MASK
MO_OPTION_MASK - Most flags are mutually exclusive; this mask selects just that part of the flag set.
@ MO_NONLAZY
MO_NONLAZY - This is an independent flag, on a symbol operand "FOO" it represents a symbol which,...
@ MO_DLLIMPORT
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
@ MO_GOT
MO_GOT - On a symbol operand, this represents a GOT relative relocation.
@ MO_COFFSTUB
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....
AddrMode
ARM Addressing Modes.
unsigned char getAM3Offset(unsigned AM3Opc)
unsigned char getAM5FP16Offset(unsigned AM5Opc)
unsigned getSORegOffset(unsigned Op)
int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
ShiftOpc getAM2ShiftOpc(unsigned AM2Opc)
unsigned getAM2Offset(unsigned AM2Opc)
unsigned getSOImmValRotate(unsigned Imm)
getSOImmValRotate - Try to handle Imm with an immediate shifter operand, computing the rotate amount ...
bool isThumbImmShiftedVal(unsigned V)
isThumbImmShiftedVal - Return true if the specified value can be obtained by left shifting a 8-bit im...
int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
ShiftOpc getSORegShOp(unsigned Op)
AddrOpc getAM5Op(unsigned AM5Opc)
bool isSOImmTwoPartValNeg(unsigned V)
isSOImmTwoPartValNeg - Return true if the specified value can be obtained by two SOImmVal,...
unsigned getSOImmTwoPartSecond(unsigned V)
getSOImmTwoPartSecond - If V is a value that satisfies isSOImmTwoPartVal, return the second chunk of ...
bool isSOImmTwoPartVal(unsigned V)
isSOImmTwoPartVal - Return true if the specified value can be obtained by or'ing together two SOImmVa...
AddrOpc getAM5FP16Op(unsigned AM5Opc)
unsigned getT2SOImmTwoPartSecond(unsigned Imm)
unsigned getT2SOImmTwoPartFirst(unsigned Imm)
bool isT2SOImmTwoPartVal(unsigned Imm)
unsigned char getAM5Offset(unsigned AM5Opc)
unsigned getSOImmTwoPartFirst(unsigned V)
getSOImmTwoPartFirst - If V is a value that satisfies isSOImmTwoPartVal, return the first chunk of it...
AddrOpc getAM2Op(unsigned AM2Opc)
AddrOpc getAM3Op(unsigned AM3Opc)
Define some predicates that are used for node matching.
InstrType
Represents how an instruction should be mapped by the outliner.
NodeAddr< NodeBase * > Node
This is an optimization pass for GlobalISel generic memory operations.
IterT next_nodbg(IterT It, IterT End, bool SkipPseudoOp=true)
Increment It, then continue incrementing it while it points to a debug instruction.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
constexpr T rotr(T V, int R)
static bool isIndirectCall(const MachineInstr &MI)
MachineInstr * findCMPToFoldIntoCBZ(MachineInstr *Br, const TargetRegisterInfo *TRI)
Search backwards from a tBcc to find a tCMPi8 against 0, meaning we can convert them to a tCBZ or tCB...
static bool isCondBranchOpcode(int Opc)
bool HasLowerConstantMaterializationCost(unsigned Val1, unsigned Val2, const ARMSubtarget *Subtarget, bool ForCodesize=false)
Returns true if Val1 has a lower Constant Materialization Cost than Val2.
static bool isPushOpcode(int Opc)
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void addPredicatedMveVpredNOp(MachineInstrBuilder &MIB, unsigned Cond)
static bool isVCTP(const MachineInstr *MI)
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.
bool IsCPSRDead< MachineInstr >(const MachineInstr *MI)
constexpr RegState getKillRegState(bool B)
unsigned getBLXpredOpcode(const MachineFunction &MF)
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
static bool isARMLowRegister(MCRegister Reg)
isARMLowRegister - Returns true if the register is a low register (r0-r7).
static bool isIndirectBranchOpcode(int Opc)
bool isLegalAddressImm(unsigned Opcode, int Imm, const TargetInstrInfo *TII)
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
bool registerDefinedBetween(unsigned Reg, MachineBasicBlock::iterator From, MachineBasicBlock::iterator To, const TargetRegisterInfo *TRI)
Return true if Reg is defd between From and To.
static std::array< MachineOperand, 2 > predOps(ARMCC::CondCodes Pred, unsigned PredReg=0)
Get the operands corresponding to the given Pred value.
static bool isSEHInstruction(const MachineInstr &MI)
static bool isCalleeSavedRegister(MCRegister Reg, const MCPhysReg *CSRegs)
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
bool tryFoldSPUpdateIntoPushPop(const ARMSubtarget &Subtarget, MachineFunction &MF, MachineInstr *MI, unsigned NumBytes)
Tries to add registers to the reglist of a given base-updating push/pop instruction to adjust the sta...
auto reverse(ContainerTy &&C)
static bool isJumpTableBranchOpcode(int Opc)
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)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
static bool isPopOpcode(int Opc)
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,...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
void addPredicatedMveVpredROp(MachineInstrBuilder &MIB, unsigned Cond, unsigned Inactive)
auto drop_end(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the last N elements excluded.
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
void addUnpredicatedMveVpredROp(MachineInstrBuilder &MIB, Register DestReg)
unsigned ConstantMaterializationCost(unsigned Val, const ARMSubtarget *Subtarget, bool ForCodesize=false)
Returns the number of instructions required to materialize the given constant in a register,...
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, Register FrameReg, int &Offset, const ARMBaseInstrInfo &TII)
rewriteARMFrameIndex / rewriteT2FrameIndex - Rewrite MI to access 'Offset' bytes from the FP.
static bool isIndirectControlFlowNotComingBack(const MachineInstr &MI)
ARMCC::CondCodes getInstrPredicate(const MachineInstr &MI, Register &PredReg)
getInstrPredicate - If instruction is predicated, returns its predicate condition,...
unsigned getMatchingCondBranchOpcode(unsigned Opc)
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
static bool isUncondBranchOpcode(int Opc)
auto partition(R &&Range, UnaryPredicate P)
Provide wrappers to std::partition which take ranges instead of having to pass begin/end explicitly.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
static const char * ARMCondCodeToString(ARMCC::CondCodes CC)
static MachineOperand condCodeOp(unsigned CCReg=0)
Get the operand corresponding to the conditional code result.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
unsigned gettBLXrOpcode(const MachineFunction &MF)
static bool isSpeculationBarrierEndBBOpcode(int Opc)
unsigned getBLXOpcode(const MachineFunction &MF)
void addUnpredicatedMveVpredNOp(MachineInstrBuilder &MIB)
bool isV8EligibleForIT(const InstrType *Instr)
void emitARMRegPlusImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const DebugLoc &dl, Register DestReg, Register BaseReg, int NumBytes, ARMCC::CondCodes Pred, Register PredReg, const ARMBaseInstrInfo &TII, unsigned MIFlags=0)
emitARMRegPlusImmediate / emitT2RegPlusImmediate - Emits a series of instructions to materializea des...
constexpr RegState getUndefRegState(bool B)
unsigned convertAddSubFlagsOpcode(unsigned OldOpc)
Map pseudo instructions that imply an 'S' bit onto real opcodes.
MCRegisterClass TargetRegisterClass
ARM_MLxEntry - Record information about MLA / MLS instructions.
Map pseudo instructions that imply an 'S' bit onto real opcodes.
OutlinerCosts(const ARMSubtarget &target)
This struct is a compact representation of a valid (non-zero power of two) alignment.
static constexpr LaneBitmask getAll()
static constexpr LaneBitmask getNone()
static LLVM_ABI MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
Used to describe a register and immediate addition.
RegisterPressure computed within a region of instructions delimited by TopPos and BottomPos.
An individual sequence of instructions to be replaced with a call to an outlined function.
The information necessary to create an outlined function for some class of candidate.