49 #define DEBUG_TYPE "arm-ldst-opt"
51 STATISTIC(NumLDMGened ,
"Number of ldm instructions generated");
52 STATISTIC(NumSTMGened ,
"Number of stm instructions generated");
53 STATISTIC(NumVLDMGened,
"Number of vldm instructions generated");
54 STATISTIC(NumVSTMGened,
"Number of vstm instructions generated");
55 STATISTIC(NumLdStMoved,
"Number of load / store instructions moved");
56 STATISTIC(NumLDRDFormed,
"Number of ldrd created before allocation");
57 STATISTIC(NumSTRDFormed,
"Number of strd created before allocation");
58 STATISTIC(NumLDRD2LDM,
"Number of ldrd instructions turned back into ldm");
59 STATISTIC(NumSTRD2STM,
"Number of strd instructions turned back into stm");
60 STATISTIC(NumLDRD2LDR,
"Number of ldrd instructions turned back into ldr's");
61 STATISTIC(NumSTRD2STR,
"Number of strd instructions turned back into str's");
72 #define ARM_LOAD_STORE_OPT_NAME "ARM load / store optimization pass"
91 bool RegClassInfoValid;
92 bool isThumb1, isThumb2;
106 struct MemOpQueueEntry {
111 :
MI(&MI),
Offset(Offset), Position(Position) {}
117 struct MergeCandidate {
121 unsigned LatestMIIdx;
123 unsigned EarliestMIIdx;
128 bool CanMergeToLSMulti;
130 bool CanMergeToLSDouble;
141 unsigned Base,
unsigned WordOffset,
145 int Offset,
unsigned Base,
bool BaseKill,
unsigned Opcode,
150 int Offset,
unsigned Base,
bool BaseKill,
unsigned Opcode,
153 void FormCandidates(
const MemOpQueue &MemOps);
154 MachineInstr *MergeOpsUpdate(
const MergeCandidate &Cand);
171 for (
const auto &MO : MI.operands()) {
174 if (MO.isDef() && MO.getReg() == ARM::CPSR && !MO.isDead())
185 bool isAM3 = Opcode == ARM::LDRD || Opcode == ARM::STRD;
189 if (Opcode == ARM::t2LDRi12 || Opcode == ARM::t2LDRi8 ||
190 Opcode == ARM::t2STRi12 || Opcode == ARM::t2STRi8 ||
191 Opcode == ARM::t2LDRDi8 || Opcode == ARM::t2STRDi8 ||
192 Opcode == ARM::LDRi12 || Opcode == ARM::STRi12)
196 if (Opcode == ARM::tLDRi || Opcode == ARM::tSTRi ||
197 Opcode == ARM::tLDRspi || Opcode == ARM::tSTRspi)
313 case ARM::tLDMIA_UPD:
314 case ARM::tSTMIA_UPD:
315 case ARM::t2LDMIA_RET:
317 case ARM::t2LDMIA_UPD:
319 case ARM::t2STMIA_UPD:
321 case ARM::VLDMSIA_UPD:
323 case ARM::VSTMSIA_UPD:
325 case ARM::VLDMDIA_UPD:
327 case ARM::VSTMDIA_UPD:
341 case ARM::t2LDMDB_UPD:
343 case ARM::t2STMDB_UPD:
344 case ARM::VLDMSDB_UPD:
345 case ARM::VSTMSDB_UPD:
346 case ARM::VLDMDDB_UPD:
347 case ARM::VSTMDDB_UPD:
359 return Opc == ARM::tLDRi || Opc == ARM::tLDRspi;
363 return Opc == ARM::t2LDRi12 || Opc == ARM::t2LDRi8;
371 return Opc == ARM::tSTRi || Opc == ARM::tSTRspi;
375 return Opc == ARM::t2STRi12 || Opc == ARM::t2STRi8;
383 return isi32Load(Opc) || Opc == ARM::VLDRS || Opc == ARM::VLDRD;
431 case ARM::tLDMIA_UPD:
432 case ARM::tSTMIA_UPD:
454 assert(isThumb1 &&
"Can only update base register uses for Thumb1!");
457 for (; MBBI != MBB.
end(); ++MBBI) {
458 bool InsertSub =
false;
459 unsigned Opc = MBBI->getOpcode();
461 if (MBBI->readsRegister(Base)) {
464 Opc == ARM::tLDRi || Opc == ARM::tLDRHi || Opc == ARM::tLDRBi;
466 Opc == ARM::tSTRi || Opc == ARM::tSTRHi || Opc == ARM::tSTRBi;
468 if (IsLoad || IsStore) {
474 MBBI->getOperand(MBBI->getDesc().getNumOperands() - 3);
481 if (Offset >= 0 && !(IsStore && InstrSrcReg == Base))
486 }
else if ((Opc == ARM::tSUBi8 || Opc == ARM::tADDi8) &&
487 !definesCPSR(*MBBI)) {
492 MBBI->getOperand(MBBI->getDesc().getNumOperands() - 3);
493 Offset = (Opc == ARM::tSUBi8) ?
494 MO.
getImm() + WordOffset * 4 :
495 MO.
getImm() - WordOffset * 4 ;
496 if (Offset >= 0 && TL->isLegalAddImmediate(Offset)) {
511 }
else if (definesCPSR(*MBBI) || MBBI->isCall() || MBBI->isBranch()) {
520 BuildMI(MBB, MBBI, DL,
TII->get(ARM::tSUBi8), Base)
523 .addImm(WordOffset * 4)
529 if (MBBI->killsRegister(Base) || MBBI->definesRegister(Base))
540 if (MBBI != MBB.
end()) --MBBI;
541 BuildMI(MBB, MBBI, DL,
TII->get(ARM::tSUBi8), Base)
544 .addImm(WordOffset * 4)
552 if (!RegClassInfoValid) {
553 RegClassInfo.runOnMachineFunction(*MF);
554 RegClassInfoValid =
true;
557 for (
unsigned Reg : RegClassInfo.getOrder(&RegClass))
558 if (!LiveRegs.contains(
Reg))
569 if (!LiveRegsValid) {
571 LiveRegs.addLiveOuts(MBB);
572 LiveRegPos = MBB.
end();
573 LiveRegsValid =
true;
576 while (LiveRegPos != Before) {
578 LiveRegs.stepBackward(*LiveRegPos);
584 for (
const std::pair<unsigned, bool> &R :
Regs)
595 int Offset,
unsigned Base,
bool BaseKill,
unsigned Opcode,
598 unsigned NumRegs =
Regs.size();
603 bool SafeToClobberCPSR = !isThumb1 ||
607 bool Writeback = isThumb1;
613 assert(Base != ARM::SP &&
"Thumb1 does not allow SP in register list");
614 if (Opcode == ARM::tLDRi)
616 else if (Opcode == ARM::tSTRi)
623 bool haveIBAndDA = isNotVFP && !isThumb2 && !isThumb1;
625 if (Offset == 4 && haveIBAndDA) {
627 }
else if (Offset == -4 * (
int)NumRegs + 4 && haveIBAndDA) {
629 }
else if (Offset == -4 * (
int)NumRegs && isNotVFP && !isThumb1) {
632 }
else if (Offset != 0 || Opcode == ARM::tLDRspi || Opcode == ARM::tSTRspi) {
645 if (!SafeToClobberCPSR)
652 NewBase =
Regs[NumRegs-1].first;
656 moveLiveRegsBefore(MBB, InsertBefore);
660 for (
const std::pair<unsigned, bool> &R :
Regs)
661 LiveRegs.addReg(R.first);
663 NewBase = findFreeReg(isThumb1 ? ARM::tGPRRegClass : ARM::GPRRegClass);
669 isThumb2 ? ARM::t2ADDri :
670 (isThumb1 && Base == ARM::SP) ? ARM::tADDrSPi :
671 (isThumb1 && Offset < 8) ? ARM::tADDi3 :
672 isThumb1 ? ARM::tADDi8 : ARM::ADDri;
677 isThumb2 ? ARM::t2SUBri :
678 (isThumb1 && Offset < 8 && Base != ARM::SP) ? ARM::tSUBi3 :
679 isThumb1 ? ARM::tSUBi8 : ARM::SUBri;
682 if (!TL->isLegalAddImmediate(Offset))
688 bool KillOldBase = BaseKill &&
697 if (Base != NewBase &&
698 (BaseOpc == ARM::tADDi8 || BaseOpc == ARM::tSUBi8)) {
705 BuildMI(MBB, InsertBefore, DL,
TII->get(ARM::tMOVSr), NewBase)
708 BuildMI(MBB, InsertBefore, DL,
TII->get(ARM::tMOVr), NewBase)
716 if (BaseOpc == ARM::tADDrSPi) {
717 assert(Offset % 4 == 0 &&
"tADDrSPi offset is scaled by 4");
718 BuildMI(MBB, InsertBefore, DL,
TII->get(BaseOpc), NewBase)
723 BuildMI(MBB, InsertBefore, DL,
TII->get(BaseOpc), NewBase)
729 BuildMI(MBB, InsertBefore, DL,
TII->get(BaseOpc), NewBase)
755 if (isThumb1 && !SafeToClobberCPSR && Writeback && !BaseKill)
761 assert(isThumb1 &&
"expected Writeback only inThumb1");
762 if (Opcode == ARM::tLDMIA) {
765 Opcode = ARM::tLDMIA_UPD;
768 MIB =
BuildMI(MBB, InsertBefore, DL,
TII->get(Opcode));
777 UpdateBaseRegUses(MBB, InsertBefore, DL, Base, NumRegs, Pred, PredReg);
781 MIB =
BuildMI(MBB, InsertBefore, DL,
TII->get(Opcode));
787 for (
const std::pair<unsigned, bool> &R : Regs)
795 int Offset,
unsigned Base,
bool BaseKill,
unsigned Opcode,
797 ArrayRef<std::pair<unsigned, bool>> Regs)
const {
799 assert((IsLoad ||
isi32Store(Opcode)) &&
"Must have integer load or store");
800 unsigned LoadStoreOpcode = IsLoad ? ARM::t2LDRDi8 : ARM::t2STRDi8;
804 TII->get(LoadStoreOpcode));
817 MachineInstr *ARMLoadStoreOpt::MergeOpsUpdate(
const MergeCandidate &Cand) {
829 bool IsKill = MO.
isKill();
832 Regs.
push_back(std::make_pair(Reg, IsKill));
843 unsigned DefReg = MO.
getReg();
858 iterator InsertBefore = std::next(iterator(LatestMI));
863 unsigned PredReg = 0;
867 if (Cand.CanMergeToLSDouble)
868 Merged = CreateLoadStoreDouble(MBB, InsertBefore, Offset, Base, BaseKill,
869 Opcode, Pred, PredReg, DL, Regs);
870 if (!Merged && Cand.CanMergeToLSMulti)
871 Merged = CreateLoadStoreMulti(MBB, InsertBefore, Offset, Base, BaseKill,
872 Opcode, Pred, PredReg, DL, Regs);
878 iterator EarliestI(Cand.Instrs[Cand.EarliestMIIdx]);
879 bool EarliestAtBegin =
false;
880 if (EarliestI == MBB.
begin()) {
881 EarliestAtBegin =
true;
883 EarliestI = std::prev(EarliestI);
892 EarliestI = MBB.
begin();
894 EarliestI = std::next(EarliestI);
895 auto FixupRange =
make_range(EarliestI, iterator(Merged));
901 for (
unsigned &ImpDefReg : ImpDefs) {
914 for (
unsigned ImpDef : ImpDefs)
937 return (Value % 4) == 0 && Value < 1024;
959 void ARMLoadStoreOpt::FormCandidates(
const MemOpQueue &MemOps) {
966 unsigned EIndex = MemOps.size();
970 int Offset = MemOps[SIndex].Offset;
972 unsigned PReg = PMO.
getReg();
973 unsigned PRegNum = PMO.
isUndef() ? UINT_MAX : TRI->getEncodingValue(PReg);
974 unsigned Latest = SIndex;
975 unsigned Earliest = SIndex;
977 bool CanMergeToLSDouble =
981 if (STI->isCortexM3() &&
isi32Load(Opcode) &&
983 CanMergeToLSDouble =
false;
985 bool CanMergeToLSMulti =
true;
988 if (STI->hasSlowOddRegister() && !isNotVFP && (PRegNum % 2) == 1)
989 CanMergeToLSMulti =
false;
993 if (PReg == ARM::SP || PReg == ARM::PC)
994 CanMergeToLSMulti = CanMergeToLSDouble =
false;
998 CanMergeToLSMulti = CanMergeToLSDouble =
false;
1001 for (
unsigned I = SIndex+1;
I < EIndex; ++
I, ++Count) {
1002 int NewOffset = MemOps[
I].Offset;
1003 if (NewOffset != Offset + (
int)
Size)
1006 unsigned Reg = MO.
getReg();
1007 if (Reg == ARM::SP || Reg == ARM::PC)
1011 unsigned RegNum = MO.
isUndef() ? UINT_MAX : TRI->getEncodingValue(Reg);
1012 bool PartOfLSMulti = CanMergeToLSMulti;
1013 if (PartOfLSMulti) {
1015 if (RegNum <= PRegNum)
1016 PartOfLSMulti =
false;
1020 else if (!isNotVFP && RegNum != PRegNum+1)
1021 PartOfLSMulti =
false;
1024 bool PartOfLSDouble = CanMergeToLSDouble && Count <= 1;
1026 if (!PartOfLSMulti && !PartOfLSDouble)
1028 CanMergeToLSMulti &= PartOfLSMulti;
1029 CanMergeToLSDouble &= PartOfLSDouble;
1032 unsigned Position = MemOps[
I].Position;
1033 if (Position < MemOps[Latest].Position)
1035 else if (Position > MemOps[Earliest].Position)
1043 MergeCandidate *Candidate =
new(
Allocator.Allocate()) MergeCandidate;
1044 for (
unsigned C = SIndex, CE = SIndex + Count;
C <
CE; ++
C)
1045 Candidate->Instrs.push_back(MemOps[
C].MI);
1046 Candidate->LatestMIIdx = Latest - SIndex;
1047 Candidate->EarliestMIIdx = Earliest - SIndex;
1048 Candidate->InsertPos = MemOps[Latest].Position;
1050 CanMergeToLSMulti = CanMergeToLSDouble =
false;
1051 Candidate->CanMergeToLSMulti = CanMergeToLSMulti;
1052 Candidate->CanMergeToLSDouble = CanMergeToLSDouble;
1053 Candidates.push_back(Candidate);
1056 }
while (SIndex < EIndex);
1134 case ARM::tADDi8: Scale = 4; CheckCPSRDef =
true;
break;
1135 case ARM::tSUBi8: Scale = -4; CheckCPSRDef =
true;
break;
1137 case ARM::SUBri: Scale = -1; CheckCPSRDef =
true;
break;
1139 case ARM::ADDri: Scale = 1; CheckCPSRDef =
true;
break;
1140 case ARM::tADDspi: Scale = 4; CheckCPSRDef =
false;
break;
1141 case ARM::tSUBspi: Scale = -4; CheckCPSRDef =
false;
break;
1149 MIPredReg != PredReg)
1152 if (CheckCPSRDef && definesCPSR(MI))
1165 if (MBBI == BeginMBBI)
1170 while (PrevMBBI->isDebugValue() && PrevMBBI != BeginMBBI)
1174 return Offset == 0 ? EndMBBI : PrevMBBI;
1186 while (NextMBBI != EndMBBI && NextMBBI->isDebugValue())
1188 if (NextMBBI == EndMBBI)
1192 return Offset == 0 ? EndMBBI : NextMBBI;
1207 bool ARMLoadStoreOpt::MergeBaseUpdateLSMultiple(
MachineInstr *MI) {
1209 if (isThumb1)
return false;
1212 unsigned Base = BaseOP.
getReg();
1213 bool BaseKill = BaseOP.
isKill();
1214 unsigned PredReg = 0;
1232 if (Mode ==
ARM_AM::ia && Offset == -Bytes) {
1234 }
else if (Mode ==
ARM_AM::ib && Offset == -Bytes) {
1248 bool HighRegsUsed =
false;
1251 HighRegsUsed =
true;
1256 MergeInstr = MBB.
end();
1261 if (MergeInstr != MBB.
end())
1262 MBB.
erase(MergeInstr);
1268 .addImm(Pred).
addReg(PredReg);
1271 for (
unsigned OpNum = 3, e = MI->
getNumOperands(); OpNum != e; ++OpNum)
1285 return ARM::LDR_PRE_IMM;
1287 return ARM::STR_PRE_IMM;
1289 return Mode ==
ARM_AM::add ? ARM::VLDMSIA_UPD : ARM::VLDMSDB_UPD;
1291 return Mode ==
ARM_AM::add ? ARM::VLDMDIA_UPD : ARM::VLDMDDB_UPD;
1293 return Mode ==
ARM_AM::add ? ARM::VSTMSIA_UPD : ARM::VSTMSDB_UPD;
1295 return Mode ==
ARM_AM::add ? ARM::VSTMDIA_UPD : ARM::VSTMDDB_UPD;
1298 return ARM::t2LDR_PRE;
1301 return ARM::t2STR_PRE;
1310 return ARM::LDR_POST_IMM;
1312 return ARM::STR_POST_IMM;
1314 return Mode ==
ARM_AM::add ? ARM::VLDMSIA_UPD : ARM::VLDMSDB_UPD;
1316 return Mode ==
ARM_AM::add ? ARM::VLDMDIA_UPD : ARM::VLDMDDB_UPD;
1318 return Mode ==
ARM_AM::add ? ARM::VSTMSIA_UPD : ARM::VSTMSDB_UPD;
1320 return Mode ==
ARM_AM::add ? ARM::VSTMDIA_UPD : ARM::VSTMDDB_UPD;
1323 return ARM::t2LDR_POST;
1326 return ARM::t2STR_POST;
1333 bool ARMLoadStoreOpt::MergeBaseUpdateLoadStore(
MachineInstr *MI) {
1336 if (isThumb1)
return false;
1342 bool isAM5 = (Opcode == ARM::VLDRD || Opcode == ARM::VLDRS ||
1343 Opcode == ARM::VSTRD || Opcode == ARM::VSTRS);
1344 bool isAM2 = (Opcode == ARM::LDRi12 || Opcode == ARM::STRi12);
1356 unsigned PredReg = 0;
1365 if (!isAM5 && Offset == Bytes) {
1367 }
else if (Offset == -Bytes) {
1371 if (Offset == Bytes) {
1373 }
else if (!isAM5 && Offset == -Bytes) {
1378 MBB.
erase(MergeInstr);
1392 .addImm(Pred).
addReg(PredReg)
1398 if (NewOpc == ARM::LDR_PRE_IMM || NewOpc == ARM::LDRB_PRE_IMM) {
1424 if (isAM2 && NewOpc == ARM::STR_POST_IMM) {
1427 BuildMI(MBB, MBBI, DL,
TII->get(NewOpc), Base)
1435 BuildMI(MBB, MBBI, DL,
TII->get(NewOpc), Base)
1447 bool ARMLoadStoreOpt::MergeBaseUpdateLSDouble(
MachineInstr &MI)
const {
1449 assert((Opcode == ARM::t2LDRDi8 || Opcode == ARM::t2STRDi8) &&
1450 "Must have t2STRDi8 or t2LDRDi8");
1457 unsigned Base = BaseOp.
getReg();
1460 if (Reg0Op.
getReg() == Base || Reg1Op.
getReg() == Base)
1471 if (Offset == 8 || Offset == -8) {
1472 NewOpc = Opcode == ARM::t2LDRDi8 ? ARM::t2LDRD_PRE : ARM::t2STRD_PRE;
1475 if (Offset == 8 || Offset == -8) {
1476 NewOpc = Opcode == ARM::t2LDRDi8 ? ARM::t2LDRD_POST : ARM::t2STRD_POST;
1480 MBB.
erase(MergeInstr);
1484 if (NewOpc == ARM::t2LDRD_PRE || NewOpc == ARM::t2LDRD_POST) {
1487 assert(NewOpc == ARM::t2STRD_PRE || NewOpc == ARM::t2STRD_POST);
1492 assert(
TII->get(Opcode).getNumOperands() == 6 &&
1493 TII->get(NewOpc).getNumOperands() == 7 &&
1494 "Unexpected number of operands in Opcode specification.");
1562 bool isDef,
const DebugLoc &DL,
unsigned NewOpc,
1563 unsigned Reg,
bool RegDeadKill,
bool RegUndef,
1564 unsigned BaseReg,
bool BaseKill,
bool BaseUndef,
1587 if (Opcode != ARM::LDRD && Opcode != ARM::STRD && Opcode != ARM::t2LDRDi8)
1591 unsigned BaseReg = BaseOp.
getReg();
1594 unsigned EvenRegNum = TRI->getDwarfRegNum(EvenReg,
false);
1595 unsigned OddRegNum = TRI->getDwarfRegNum(OddReg,
false);
1599 bool Errata602117 = EvenReg == BaseReg &&
1600 (Opcode == ARM::LDRD || Opcode == ARM::t2LDRDi8) && STI->isCortexM3();
1602 bool NonConsecutiveRegs = (Opcode == ARM::LDRD || Opcode == ARM::STRD) &&
1603 (EvenRegNum % 2 != 0 || EvenRegNum + 1 != OddRegNum);
1605 if (!Errata602117 && !NonConsecutiveRegs)
1608 bool isT2 = Opcode == ARM::t2LDRDi8 || Opcode == ARM::t2STRDi8;
1609 bool isLd = Opcode == ARM::LDRD || Opcode == ARM::t2LDRDi8;
1610 bool EvenDeadKill = isLd ?
1613 bool OddDeadKill = isLd ?
1616 bool BaseKill = BaseOp.
isKill();
1617 bool BaseUndef = BaseOp.
isUndef();
1621 unsigned PredReg = 0;
1624 if (OddRegNum > EvenRegNum && OffImm == 0) {
1627 unsigned NewOpc = (isLd)
1628 ? (isT2 ? ARM::t2LDMIA : ARM::LDMIA)
1629 : (isT2 ? ARM::t2STMIA : ARM::STMIA);
1631 BuildMI(MBB, MBBI, MBBI->getDebugLoc(),
TII->get(NewOpc))
1633 .addImm(Pred).
addReg(PredReg)
1638 BuildMI(MBB, MBBI, MBBI->getDebugLoc(),
TII->get(NewOpc))
1640 .addImm(Pred).
addReg(PredReg)
1649 unsigned NewOpc = (isLd)
1650 ? (isT2 ? (OffImm < 0 ? ARM::t2LDRi8 : ARM::t2LDRi12) : ARM::LDRi12)
1651 : (isT2 ? (OffImm < 0 ? ARM::t2STRi8 : ARM::t2STRi12) : ARM::STRi12);
1654 unsigned NewOpc2 = (isLd)
1655 ? (isT2 ? (OffImm+4 < 0 ? ARM::t2LDRi8 : ARM::t2LDRi12) : ARM::LDRi12)
1656 : (isT2 ? (OffImm+4 < 0 ? ARM::t2STRi8 : ARM::t2STRi12) : ARM::STRi12);
1661 (BaseKill || OffKill) &&
1662 (TRI->regsOverlap(EvenReg, BaseReg))) {
1663 assert(!TRI->regsOverlap(OddReg, BaseReg));
1665 OddReg, OddDeadKill,
false,
1666 BaseReg,
false, BaseUndef,
false, OffUndef,
1667 Pred, PredReg,
TII, isT2);
1669 EvenReg, EvenDeadKill,
false,
1670 BaseReg, BaseKill, BaseUndef, OffKill, OffUndef,
1671 Pred, PredReg,
TII, isT2);
1673 if (OddReg == EvenReg && EvenDeadKill) {
1677 EvenDeadKill =
false;
1681 if (EvenReg == BaseReg)
1682 EvenDeadKill =
false;
1684 EvenReg, EvenDeadKill, EvenUndef,
1685 BaseReg,
false, BaseUndef,
false, OffUndef,
1686 Pred, PredReg,
TII, isT2);
1688 OddReg, OddDeadKill, OddUndef,
1689 BaseReg, BaseKill, BaseUndef, OffKill, OffUndef,
1690 Pred, PredReg,
TII, isT2);
1698 MBBI = MBB.
erase(MBBI);
1706 unsigned CurrBase = 0;
1707 unsigned CurrOpc = ~0u;
1709 unsigned Position = 0;
1710 assert(Candidates.size() == 0);
1711 assert(MergeBaseCandidates.size() == 0);
1712 LiveRegsValid =
false;
1717 MBBI = std::prev(
I);
1718 if (FixInvalidRegPairOp(MBB, MBBI))
1723 unsigned Opcode = MBBI->getOpcode();
1725 unsigned Reg = MO.
getReg();
1727 unsigned PredReg = 0;
1730 if (CurrBase == 0) {
1735 MemOps.push_back(MemOpQueueEntry(*MBBI, Offset, Position));
1739 if (CurrOpc == Opcode && CurrBase == Base && CurrPred == Pred) {
1747 bool Overlap =
false;
1749 Overlap = (Base ==
Reg);
1751 for (
const MemOpQueueEntry &
E : MemOps) {
1752 if (TRI->regsOverlap(Reg,
E.MI->getOperand(0).getReg())) {
1762 if (Offset > MemOps.back().Offset) {
1763 MemOps.push_back(MemOpQueueEntry(*MBBI, Offset, Position));
1766 MemOpQueue::iterator
MI, ME;
1767 for (MI = MemOps.begin(), ME = MemOps.end(); MI != ME; ++
MI) {
1768 if (Offset < MI->Offset) {
1772 if (Offset == MI->Offset) {
1778 if (MI != MemOps.end()) {
1779 MemOps.insert(MI, MemOpQueueEntry(*MBBI, Offset, Position));
1790 }
else if (MBBI->isDebugValue()) {
1792 }
else if (MBBI->getOpcode() == ARM::t2LDRDi8 ||
1793 MBBI->getOpcode() == ARM::t2STRDi8) {
1796 MergeBaseCandidates.push_back(&*MBBI);
1801 if (MemOps.size() > 0) {
1802 FormCandidates(MemOps);
1810 if (MemOps.size() > 0)
1811 FormCandidates(MemOps);
1815 auto LessThan = [](
const MergeCandidate* M0,
const MergeCandidate *M1) {
1816 return M0->InsertPos < M1->InsertPos;
1818 std::sort(Candidates.begin(), Candidates.end(), LessThan);
1821 bool Changed =
false;
1822 for (
const MergeCandidate *Candidate : Candidates) {
1823 if (Candidate->CanMergeToLSMulti || Candidate->CanMergeToLSDouble) {
1829 if (Opcode == ARM::t2STRDi8 || Opcode == ARM::t2LDRDi8)
1830 MergeBaseUpdateLSDouble(*Merged);
1832 MergeBaseUpdateLSMultiple(Merged);
1835 if (MergeBaseUpdateLoadStore(MI))
1840 assert(Candidate->Instrs.size() == 1);
1841 if (MergeBaseUpdateLoadStore(Candidate->Instrs.front()))
1848 MergeBaseUpdateLSDouble(*MI);
1849 MergeBaseCandidates.clear();
1866 if (isThumb1)
return false;
1867 if (MBB.
empty())
return false;
1870 if (MBBI != MBB.
begin() && MBBI != MBB.
end() &&
1871 (MBBI->getOpcode() == ARM::BX_RET ||
1872 MBBI->getOpcode() == ARM::tBX_RET ||
1873 MBBI->getOpcode() == ARM::MOVPCLR)) {
1876 while (PrevI->isDebugValue() && PrevI != MBB.
begin())
1880 if (Opcode == ARM::LDMIA_UPD || Opcode == ARM::LDMDA_UPD ||
1881 Opcode == ARM::LDMDB_UPD || Opcode == ARM::LDMIB_UPD ||
1882 Opcode == ARM::t2LDMIA_UPD || Opcode == ARM::t2LDMDB_UPD) {
1884 if (MO.
getReg() != ARM::LR)
1886 unsigned NewOpc = (isThumb2 ? ARM::t2LDMIA_RET : ARM::LDMIA_RET);
1887 assert(((isThumb2 && Opcode == ARM::t2LDMIA_UPD) ||
1888 Opcode == ARM::LDMIA_UPD) &&
"Unsupported multiple load-return!");
1901 if (MBBI == MBB.
begin() || MBBI == MBB.
end() ||
1902 MBBI->getOpcode() != ARM::tBX_RET)
1907 if (Prev->getOpcode() != ARM::tMOVr || !Prev->definesRegister(ARM::LR))
1910 for (
auto Use : Prev->uses())
1912 BuildMI(MBB, MBBI, MBBI->getDebugLoc(),
TII->get(ARM::tBX))
1915 .copyImplicitOps(*MBBI);
1932 TII = STI->getInstrInfo();
1935 RegClassInfoValid =
false;
1936 isThumb2 = AFI->isThumb2Function();
1937 isThumb1 = AFI->isThumbFunction() && !isThumb2;
1939 bool Modified =
false;
1943 Modified |= LoadStoreMultipleOpti(MBB);
1944 if (STI->hasV5TOps())
1945 Modified |= MergeReturnIntoLDM(MBB);
1947 Modified |= CombineMovBx(MBB);
1954 #define ARM_PREALLOC_LOAD_STORE_OPT_NAME \
1955 "ARM pre- register allocation load / store optimization pass"
1974 StringRef getPassName()
const override {
1978 virtual void getAnalysisUsage(
AnalysisUsage &AU)
const override {
1985 unsigned &NewOpc,
unsigned &EvenReg,
1986 unsigned &OddReg,
unsigned &BaseReg,
1992 unsigned Base,
bool isLd,
2006 TD = &Fn.getDataLayout();
2007 STI = &
static_cast<const ARMSubtarget &
>(Fn.getSubtarget());
2008 TII = STI->getInstrInfo();
2009 TRI = STI->getRegisterInfo();
2010 MRI = &Fn.getRegInfo();
2012 AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
2014 bool Modified =
false;
2016 Modified |= RescheduleLoadStoreInstrs(&MFI);
2031 if (I->isDebugValue() || MemOps.
count(&*I))
2033 if (I->isCall() || I->isTerminator() || I->hasUnmodeledSideEffects())
2035 if (I->mayStore() || (!isLd && I->mayLoad()))
2037 if (I->mayAlias(AA, *MemOp,
false))
2039 for (
unsigned j = 0, NumOps = I->getNumOperands(); j != NumOps; ++j) {
2043 unsigned Reg = MO.
getReg();
2046 if (Reg != Base && !MemRegs.
count(Reg))
2047 AddedRegPressure.
insert(Reg);
2052 if (MemRegs.
size() <= 4)
2055 return AddedRegPressure.
size() <= MemRegs.
size() * 2;
2062 unsigned &SecondReg,
2063 unsigned &BaseReg,
int &Offset,
2068 if (!STI->hasV5TEOps())
2074 if (Opcode == ARM::LDRi12) {
2076 }
else if (Opcode == ARM::STRi12) {
2078 }
else if (Opcode == ARM::t2LDRi8 || Opcode == ARM::t2LDRi12) {
2079 NewOpc = ARM::t2LDRDi8;
2082 }
else if (Opcode == ARM::t2STRi8 || Opcode == ARM::t2STRi12) {
2083 NewOpc = ARM::t2STRDi8;
2098 const Function *Func = MF->getFunction();
2099 unsigned ReqAlign = STI->hasV6Ops()
2102 if (Align < ReqAlign)
2108 int Limit = (1 << 8) * Scale;
2109 if (OffImm >= Limit || (OffImm <= -Limit) || (OffImm & (Scale-1)))
2118 int Limit = (1 << 8) * Scale;
2119 if (OffImm >= Limit || (OffImm & (Scale-1)))
2125 if (FirstReg == SecondReg)
2135 unsigned Base,
bool isLd,
2137 bool RetVal =
false;
2144 assert(LHS == RHS || LOffset != ROffset);
2145 return LOffset > ROffset;
2152 while (Ops.
size() > 1) {
2153 unsigned FirstLoc = ~0U;
2154 unsigned LastLoc = 0;
2158 unsigned LastOpcode = 0;
2159 unsigned LastBytes = 0;
2160 unsigned NumMove = 0;
2161 for (
int i = Ops.
size() - 1; i >= 0; --i) {
2166 if (LastOpcode && LSMOpcode != LastOpcode)
2173 if (Bytes != LastBytes || Offset != (LastOffset + (
int)Bytes))
2185 LastOpcode = LSMOpcode;
2187 unsigned Loc = MI2LocMap[
Op];
2188 if (Loc <= FirstLoc) {
2192 if (Loc >= LastLoc) {
2203 for (
size_t i = Ops.
size() - NumMove, e = Ops.
size(); i != e; ++i) {
2210 bool DoMove = (LastLoc - FirstLoc) <= NumMove*4;
2213 MemOps, MemRegs, TRI, AA);
2215 for (
unsigned i = 0; i != NumMove; ++i)
2220 while (InsertPos != MBB->
end() &&
2221 (MemOps.
count(&*InsertPos) || InsertPos->isDebugValue()))
2228 unsigned FirstReg = 0, SecondReg = 0;
2229 unsigned BaseReg = 0, PredReg = 0;
2232 unsigned NewOpc = 0;
2235 if (NumMove == 2 && CanFormLdStDWord(Op0, Op1, dl, NewOpc,
2236 FirstReg, SecondReg, BaseReg,
2237 Offset, PredReg, Pred, isT2)) {
2243 MRI->constrainRegClass(FirstReg, TRC);
2244 MRI->constrainRegClass(SecondReg, TRC);
2259 DEBUG(
dbgs() <<
"Formed " << *MIB <<
"\n");
2273 DEBUG(
dbgs() <<
"Formed " << *MIB <<
"\n");
2285 for (
unsigned i = 0; i != NumMove; ++i) {
2288 MBB->
splice(InsertPos, MBB, Op);
2292 NumLdStMoved += NumMove;
2303 bool RetVal =
false;
2315 for (; MBBI !=
E; ++MBBI) {
2324 MI2LocMap[&MI] = ++Loc;
2328 unsigned PredReg = 0;
2337 bool StopHere =
false;
2340 Base2LdsMap.
find(Base);
2341 if (BI != Base2LdsMap.
end()) {
2342 for (
unsigned i = 0, e = BI->second.
size(); i != e; ++i) {
2349 BI->second.push_back(&MI);
2351 Base2LdsMap[Base].push_back(&MI);
2356 Base2StsMap.
find(Base);
2357 if (BI != Base2StsMap.
end()) {
2358 for (
unsigned i = 0, e = BI->second.
size(); i != e; ++i) {
2365 BI->second.push_back(&MI);
2367 Base2StsMap[Base].push_back(&MI);
2381 for (
unsigned i = 0, e = LdBases.
size(); i != e; ++i) {
2382 unsigned Base = LdBases[i];
2385 RetVal |= RescheduleOps(MBB, Lds, Base,
true, MI2LocMap);
2389 for (
unsigned i = 0, e = StBases.
size(); i != e; ++i) {
2390 unsigned Base = StBases[i];
2393 RetVal |= RescheduleOps(MBB, Sts, Base,
false, MI2LocMap);
2397 Base2LdsMap.
clear();
2398 Base2StsMap.
clear();
2411 return new ARMPreAllocLoadStoreOpt();
2412 return new ARMLoadStoreOpt();
static unsigned getPreIndexedLoadStoreOpcode(unsigned Opc, ARM_AM::AddrOpc Mode)
unsigned succ_size() const
void push_back(const T &Elt)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
A parsed version of the target data layout string in and methods for querying it. ...
static bool isT1i32Load(unsigned Opc)
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
static unsigned char getAM3Offset(unsigned AM3Opc)
STATISTIC(NumFunctions,"Total number of functions")
iterator_range< mop_iterator > uses()
Returns a range that includes all operands that are register uses.
static unsigned getImmScale(unsigned Opc)
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
Describe properties that are true of each instruction in the target description file.
void setIsUndef(bool Val=true)
const ARMTargetLowering * getTargetLowering() const override
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
static IntegerType * getInt64Ty(LLVMContext &C)
static int isIncrementOrDecrement(const MachineInstr &MI, unsigned Reg, ARMCC::CondCodes Pred, unsigned PredReg)
Check if the given instruction increments or decrements a register and return the amount it is increm...
bool isTerminator(QueryType Type=AnyInBundle) const
Returns true if this instruction part of the terminator for a basic block.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
AnalysisUsage & addRequired()
static uint32_t getAlignment(const MCSectionCOFF &Sec)
A description of a memory reference used in the backend.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
A Use represents the edge between a Value definition and its users.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Reg
All possible values of the reg field in the ModR/M byte.
Windows NT (Windows on ARM)
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
unsigned getNumOperands() const
Access to explicit operands of the instruction.
const HexagonRegisterInfo & getRegisterInfo() const
HexagonInstrInfo specifics.
void copyImplicitOps(MachineFunction &MF, const MachineInstr &MI)
Copy implicit register operands from specified instruction to this instruction.
static std::array< MachineOperand, 2 > predOps(ARMCC::CondCodes Pred, unsigned PredReg=0)
Get the operands corresponding to the given Pred value.
static ARM_AM::AMSubMode getLoadStoreMultipleSubMode(unsigned Opcode)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
uint64_t getAlignment() const
Return the minimum known alignment in bytes of the actual memory reference.
iterator getLastNonDebugInstr()
Returns an iterator to the last non-debug instruction in the basic block, or end().
unsigned getUndefRegState(bool B)
LivenessQueryResult computeRegisterLiveness(const TargetRegisterInfo *TRI, unsigned Reg, const_iterator Before, unsigned Neighborhood=10) const
Return whether (physical) register Reg has been <def>ined and not <kill>ed as of just before Before...
unsigned getTransientStackAlignment() const
getTransientStackAlignment - This method returns the number of bytes to which the stack pointer must ...
unsigned getKillRegState(bool B)
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
static unsigned getPostIndexedLoadStoreOpcode(unsigned Opc, ARM_AM::AddrOpc Mode)
const MachineBasicBlock * getParent() const
TargetInstrInfo - Interface to description of machine instruction set.
iterator find(const_arg_type_t< KeyT > Val)
bool isDebugValue() const
#define ARM_PREALLOC_LOAD_STORE_OPT_NAME
unsigned getDeadRegState(bool B)
mmo_iterator memoperands_end() const
unsigned getDefRegState(bool B)
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
initializer< Ty > init(const Ty &Val)
const MachineInstrBuilder & setMemRefs(MachineInstr::mmo_iterator b, MachineInstr::mmo_iterator e) const
bool regsOverlap(unsigned regA, unsigned regB) const
Returns true if the two registers are equal or alias each other.
static unsigned getAM2Opc(AddrOpc Opc, unsigned Imm12, ShiftOpc SO, unsigned IdxMode=0)
unsigned const MachineRegisterInfo * MRI
static bool IsSafeAndProfitableToMove(bool isLd, unsigned Base, MachineBasicBlock::iterator I, MachineBasicBlock::iterator E, SmallPtrSetImpl< MachineInstr * > &MemOps, SmallSet< unsigned, 4 > &MemRegs, const TargetRegisterInfo *TRI, AliasAnalysis *AA)
static unsigned char getAM5Offset(unsigned AM5Opc)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
static bool isT2i32Load(unsigned Opc)
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
const MachineOperand & getOperand(unsigned i) const
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
std::pair< iterator, bool > insert(const ValueT &V)
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Register is known to be fully dead.
Represent the analysis usage information of a pass.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setImm(int64_t immVal)
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
FunctionPass class - This class is used to implement most global optimizations.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
ARMCC::CondCodes getInstrPredicate(const MachineInstr &MI, unsigned &PredReg)
getInstrPredicate - If instruction is predicated, returns its predicate condition, otherwise returns AL.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
static bool isMemoryOp(const MachineInstr &MI)
Returns true if instruction is a memory operation that this pass is capable of operating on...
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
static cl::opt< bool > AssumeMisalignedLoadStores("arm-assume-misaligned-load-store", cl::Hidden, cl::init(false), cl::desc("Be more conservative in ARM load/store opt"))
This switch disables formation of double/multi instructions that could potentially lead to (new) alig...
FunctionPass * createARMLoadStoreOptimizationPass(bool PreAlloc=false)
Returns an instance of the load / store optimization pass.
void setIsKill(bool Val=true)
static bool mayCombineMisaligned(const TargetSubtargetInfo &STI, const MachineInstr &MI)
Return true for loads/stores that can be combined to a double/multi operation without increasing the ...
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
static MachineBasicBlock::iterator findIncDecBefore(MachineBasicBlock::iterator MBBI, unsigned Reg, ARMCC::CondCodes Pred, unsigned PredReg, int &Offset)
Searches for an increment or decrement of Reg before MBBI.
static bool isi32Store(unsigned Opc)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr reads the specified register.
virtual const TargetFrameLowering * getFrameLowering() const
Iterator for intrusive lists based on ilist_node.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
static MachineOperand t1CondCodeOp(bool isDead=false)
Get the operand corresponding to the conditional code result for Thumb1.
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
A BumpPtrAllocator that allows only elements of a specific type to be allocated.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
#define ARM_LOAD_STORE_OPT_NAME
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
static AddrOpc getAM3Op(unsigned AM3Opc)
static unsigned getAM3Opc(AddrOpc Opc, unsigned char Offset, unsigned IdxMode=0)
getAM3Opc - This function encodes the addrmode3 opc field.
iterator_range< mop_iterator > implicit_operands()
static const MachineOperand & getLoadStoreBaseOp(const MachineInstr &MI)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
TargetSubtargetInfo - Generic base class for all target subtargets.
static bool isARMLowRegister(unsigned Reg)
isARMLowRegister - Returns true if the register is a low register (r0-r7).
Representation of each machine instruction.
static bool isT2i32Store(unsigned Opc)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
static bool isValidLSDoubleOffset(int Offset)
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
static MachineOperand condCodeOp(unsigned CCReg=0)
Get the operand corresponding to the conditional code result.
A set of physical registers with utility functions to track liveness when walking backward/forward th...
std::pair< mmo_iterator, unsigned > mergeMemRefsWith(const MachineInstr &Other)
Return a set of memrefs (begin iterator, size) which conservatively describe the memory behavior of b...
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
static void InsertLDR_STR(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, int Offset, bool isDef, const DebugLoc &DL, unsigned NewOpc, unsigned Reg, bool RegDeadKill, bool RegUndef, unsigned BaseReg, bool BaseKill, bool BaseUndef, bool OffKill, bool OffUndef, ARMCC::CondCodes Pred, unsigned PredReg, const TargetInstrInfo *TII, bool isT2)
void setReg(unsigned Reg)
Change the register this operand corresponds to.
bool isCall(QueryType Type=AnyInBundle) const
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
APFloat abs(APFloat X)
Returns the absolute value of the argument.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
static bool isLoadSingle(unsigned Opc)
static AddrOpc getAM5Op(unsigned AM5Opc)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
static unsigned getUpdatingLSMultipleOpcode(unsigned Opc, ARM_AM::AMSubMode Mode)
unsigned getReg() const
getReg - Returns the register number.
static bool isi32Load(unsigned Opc)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr kills the specified register.
static unsigned getLSMultipleTransferSize(const MachineInstr *MI)
LLVM Value Representation.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
static int getLoadStoreMultipleOpcode(unsigned Opcode, ARM_AM::AMSubMode Mode)
static const MachineOperand & getLoadStoreRegOp(const MachineInstr &MI)
static MachineBasicBlock::iterator findIncDecAfter(MachineBasicBlock::iterator MBBI, unsigned Reg, ARMCC::CondCodes Pred, unsigned PredReg, int &Offset)
Searches for a increment or decrement of Reg after MBBI.
StringRef - Represent a constant reference to a string, i.e.
bool readsReg() const
readsReg - Returns true if this operand reads the previous value of its register. ...
void sort(Policy policy, RandomAccessIterator Start, RandomAccessIterator End, const Comparator &Comp=Comparator())
static bool isVolatile(Instruction *Inst)
static bool isT1i32Store(unsigned Opc)
static int getMemoryOpOffset(const MachineInstr &MI)
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object...
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd)
Assign this MachineInstr's memory reference descriptor list.
static bool ContainsReg(const ArrayRef< std::pair< unsigned, bool >> &Regs, unsigned Reg)
Properties which a MachineFunction may have at a given point in time.
INITIALIZE_PASS(ARMLoadStoreOpt,"arm-ldst-opt", ARM_LOAD_STORE_OPT_NAME, false, false) static bool definesCPSR(const MachineInstr &MI)
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly. ...