71 #define DEBUG_TYPE "arm-ldst-opt" 73 STATISTIC(NumLDMGened ,
"Number of ldm instructions generated");
74 STATISTIC(NumSTMGened ,
"Number of stm instructions generated");
75 STATISTIC(NumVLDMGened,
"Number of vldm instructions generated");
76 STATISTIC(NumVSTMGened,
"Number of vstm instructions generated");
77 STATISTIC(NumLdStMoved,
"Number of load / store instructions moved");
78 STATISTIC(NumLDRDFormed,
"Number of ldrd created before allocation");
79 STATISTIC(NumSTRDFormed,
"Number of strd created before allocation");
80 STATISTIC(NumLDRD2LDM,
"Number of ldrd instructions turned back into ldm");
81 STATISTIC(NumSTRD2STM,
"Number of strd instructions turned back into stm");
82 STATISTIC(NumLDRD2LDR,
"Number of ldrd instructions turned back into ldr's");
83 STATISTIC(NumSTRD2STR,
"Number of strd instructions turned back into str's");
94 #define ARM_LOAD_STORE_OPT_NAME "ARM load / store optimization pass" 113 bool RegClassInfoValid;
114 bool isThumb1, isThumb2;
130 struct MemOpQueueEntry {
135 MemOpQueueEntry(
MachineInstr &MI,
int Offset,
unsigned Position)
142 struct MergeCandidate {
147 unsigned LatestMIIdx;
150 unsigned EarliestMIIdx;
157 bool CanMergeToLSMulti;
160 bool CanMergeToLSDouble;
171 unsigned Base,
unsigned WordOffset,
175 int Offset,
unsigned Base,
bool BaseKill,
unsigned Opcode,
180 int Offset,
unsigned Base,
bool BaseKill,
unsigned Opcode,
183 void FormCandidates(
const MemOpQueue &MemOps);
184 MachineInstr *MergeOpsUpdate(
const MergeCandidate &Cand);
203 for (
const auto &MO : MI.operands()) {
206 if (MO.isDef() && MO.getReg() == ARM::CPSR && !MO.isDead())
217 bool isAM3 = Opcode == ARM::LDRD || Opcode == ARM::STRD;
221 if (Opcode == ARM::t2LDRi12 || Opcode == ARM::t2LDRi8 ||
222 Opcode == ARM::t2STRi12 || Opcode == ARM::t2STRi8 ||
223 Opcode == ARM::t2LDRDi8 || Opcode == ARM::t2STRDi8 ||
224 Opcode == ARM::LDRi12 || Opcode == ARM::STRi12)
228 if (Opcode == ARM::tLDRi || Opcode == ARM::tSTRi ||
229 Opcode == ARM::tLDRspi || Opcode == ARM::tSTRspi)
345 case ARM::tLDMIA_UPD:
346 case ARM::tSTMIA_UPD:
347 case ARM::t2LDMIA_RET:
349 case ARM::t2LDMIA_UPD:
351 case ARM::t2STMIA_UPD:
353 case ARM::VLDMSIA_UPD:
355 case ARM::VSTMSIA_UPD:
357 case ARM::VLDMDIA_UPD:
359 case ARM::VSTMDIA_UPD:
373 case ARM::t2LDMDB_UPD:
375 case ARM::t2STMDB_UPD:
376 case ARM::VLDMSDB_UPD:
377 case ARM::VSTMSDB_UPD:
378 case ARM::VLDMDDB_UPD:
379 case ARM::VSTMDDB_UPD:
391 return Opc == ARM::tLDRi || Opc == ARM::tLDRspi;
395 return Opc == ARM::t2LDRi12 || Opc == ARM::t2LDRi8;
403 return Opc == ARM::tSTRi || Opc == ARM::tSTRspi;
407 return Opc == ARM::t2STRi12 || Opc == ARM::t2STRi8;
415 return isi32Load(Opc) || Opc == ARM::VLDRS || Opc == ARM::VLDRD;
463 case ARM::tLDMIA_UPD:
464 case ARM::tSTMIA_UPD:
486 assert(isThumb1 &&
"Can only update base register uses for Thumb1!");
489 for (; MBBI != MBB.
end(); ++MBBI) {
490 bool InsertSub =
false;
491 unsigned Opc = MBBI->getOpcode();
493 if (MBBI->readsRegister(Base)) {
496 Opc == ARM::tLDRi || Opc == ARM::tLDRHi || Opc == ARM::tLDRBi;
498 Opc == ARM::tSTRi || Opc == ARM::tSTRHi || Opc == ARM::tSTRBi;
500 if (IsLoad || IsStore) {
506 MBBI->getOperand(MBBI->getDesc().getNumOperands() - 3);
513 if (Offset >= 0 && !(IsStore && InstrSrcReg == Base))
517 }
else if ((Opc == ARM::tSUBi8 || Opc == ARM::tADDi8) &&
518 !definesCPSR(*MBBI)) {
523 MBBI->getOperand(MBBI->getDesc().getNumOperands() - 3);
524 Offset = (Opc == ARM::tSUBi8) ?
525 MO.
getImm() + WordOffset * 4 :
526 MO.
getImm() - WordOffset * 4 ;
527 if (Offset >= 0 && TL->isLegalAddImmediate(Offset)) {
540 }
else if (definesCPSR(*MBBI) || MBBI->isCall() || MBBI->isBranch()) {
549 BuildMI(MBB, MBBI, DL,
TII->get(ARM::tSUBi8), Base)
552 .addImm(WordOffset * 4)
558 if (MBBI->killsRegister(Base) || MBBI->definesRegister(Base))
569 if (MBBI != MBB.
end()) --MBBI;
570 BuildMI(MBB, MBBI, DL,
TII->get(ARM::tSUBi8), Base)
573 .addImm(WordOffset * 4)
581 if (!RegClassInfoValid) {
582 RegClassInfo.runOnMachineFunction(*MF);
583 RegClassInfoValid =
true;
586 for (
unsigned Reg : RegClassInfo.getOrder(&RegClass))
587 if (!LiveRegs.contains(
Reg))
598 if (!LiveRegsValid) {
600 LiveRegs.addLiveOuts(MBB);
601 LiveRegPos = MBB.
end();
602 LiveRegsValid =
true;
605 while (LiveRegPos != Before) {
607 LiveRegs.stepBackward(*LiveRegPos);
613 for (
const std::pair<unsigned, bool> &R :
Regs)
624 int Offset,
unsigned Base,
bool BaseKill,
unsigned Opcode,
627 unsigned NumRegs =
Regs.size();
632 bool SafeToClobberCPSR = !isThumb1 ||
636 bool Writeback = isThumb1;
642 assert(Base != ARM::SP &&
"Thumb1 does not allow SP in register list");
643 if (Opcode == ARM::tLDRi)
645 else if (Opcode == ARM::tSTRi)
652 bool haveIBAndDA = isNotVFP && !isThumb2 && !isThumb1;
654 if (Offset == 4 && haveIBAndDA) {
656 }
else if (Offset == -4 * (
int)NumRegs + 4 && haveIBAndDA) {
658 }
else if (Offset == -4 * (
int)NumRegs && isNotVFP && !isThumb1) {
661 }
else if (Offset != 0 || Opcode == ARM::tLDRspi || Opcode == ARM::tSTRspi) {
674 if (!SafeToClobberCPSR)
681 NewBase =
Regs[NumRegs-1].first;
685 moveLiveRegsBefore(MBB, InsertBefore);
689 for (
const std::pair<unsigned, bool> &R :
Regs)
690 LiveRegs.addReg(R.first);
692 NewBase = findFreeReg(isThumb1 ? ARM::tGPRRegClass : ARM::GPRRegClass);
698 isThumb2 ? ARM::t2ADDri :
699 (isThumb1 && Base == ARM::SP) ? ARM::tADDrSPi :
700 (isThumb1 && Offset < 8) ? ARM::tADDi3 :
701 isThumb1 ? ARM::tADDi8 : ARM::ADDri;
706 isThumb2 ? ARM::t2SUBri :
707 (isThumb1 && Offset < 8 && Base != ARM::SP) ? ARM::tSUBi3 :
708 isThumb1 ? ARM::tSUBi8 : ARM::SUBri;
711 if (!TL->isLegalAddImmediate(Offset))
717 bool KillOldBase = BaseKill &&
726 if (Base != NewBase &&
727 (BaseOpc == ARM::tADDi8 || BaseOpc == ARM::tSUBi8)) {
734 BuildMI(MBB, InsertBefore, DL,
TII->get(ARM::tMOVSr), NewBase)
737 BuildMI(MBB, InsertBefore, DL,
TII->get(ARM::tMOVr), NewBase)
745 if (BaseOpc == ARM::tADDrSPi) {
746 assert(Offset % 4 == 0 &&
"tADDrSPi offset is scaled by 4");
747 BuildMI(MBB, InsertBefore, DL,
TII->get(BaseOpc), NewBase)
752 BuildMI(MBB, InsertBefore, DL,
TII->get(BaseOpc), NewBase)
758 BuildMI(MBB, InsertBefore, DL,
TII->get(BaseOpc), NewBase)
784 if (isThumb1 && !SafeToClobberCPSR && Writeback && !BaseKill)
790 assert(isThumb1 &&
"expected Writeback only inThumb1");
791 if (Opcode == ARM::tLDMIA) {
794 Opcode = ARM::tLDMIA_UPD;
797 MIB =
BuildMI(MBB, InsertBefore, DL,
TII->get(Opcode));
806 UpdateBaseRegUses(MBB, InsertBefore, DL, Base, NumRegs, Pred, PredReg);
809 MIB =
BuildMI(MBB, InsertBefore, DL,
TII->get(Opcode));
815 for (
const std::pair<unsigned, bool> &R :
Regs)
823 int Offset,
unsigned Base,
bool BaseKill,
unsigned Opcode,
827 assert((IsLoad ||
isi32Store(Opcode)) &&
"Must have integer load or store");
828 unsigned LoadStoreOpcode = IsLoad ? ARM::t2LDRDi8 : ARM::t2STRDi8;
832 TII->get(LoadStoreOpcode));
845 MachineInstr *ARMLoadStoreOpt::MergeOpsUpdate(
const MergeCandidate &Cand) {
857 bool IsKill = MO.
isKill();
860 Regs.
push_back(std::make_pair(Reg, IsKill));
871 unsigned DefReg = MO.
getReg();
887 iterator InsertBefore = std::next(iterator(LatestMI));
892 unsigned PredReg = 0;
896 if (Cand.CanMergeToLSDouble)
897 Merged = CreateLoadStoreDouble(MBB, InsertBefore, Offset, Base, BaseKill,
898 Opcode, Pred, PredReg, DL, Regs);
899 if (!Merged && Cand.CanMergeToLSMulti)
900 Merged = CreateLoadStoreMulti(MBB, InsertBefore, Offset, Base, BaseKill,
901 Opcode, Pred, PredReg, DL, Regs);
907 iterator EarliestI(Cand.Instrs[Cand.EarliestMIIdx]);
908 bool EarliestAtBegin =
false;
909 if (EarliestI == MBB.
begin()) {
910 EarliestAtBegin =
true;
912 EarliestI = std::prev(EarliestI);
921 EarliestI = MBB.
begin();
923 EarliestI = std::next(EarliestI);
924 auto FixupRange =
make_range(EarliestI, iterator(Merged));
930 for (
unsigned &ImpDefReg : ImpDefs) {
932 if (!MO.isReg() || MO.getReg() != ImpDefReg)
943 for (
unsigned ImpDef : ImpDefs)
950 if (!MO.isReg() || !MO.isKill())
952 if (UsedRegs.
count(MO.getReg()))
966 return (Value % 4) == 0 && Value < 1024;
988 void ARMLoadStoreOpt::FormCandidates(
const MemOpQueue &MemOps) {
995 unsigned EIndex = MemOps.size();
999 int Offset = MemOps[SIndex].Offset;
1001 unsigned PReg = PMO.
getReg();
1003 :
TRI->getEncodingValue(PReg);
1004 unsigned Latest = SIndex;
1005 unsigned Earliest = SIndex;
1007 bool CanMergeToLSDouble =
1011 if (STI->isCortexM3() &&
isi32Load(Opcode) &&
1013 CanMergeToLSDouble =
false;
1015 bool CanMergeToLSMulti =
true;
1018 if (STI->hasSlowOddRegister() && !isNotVFP && (PRegNum % 2) == 1)
1019 CanMergeToLSMulti =
false;
1023 if (PReg == ARM::SP || PReg == ARM::PC)
1024 CanMergeToLSMulti = CanMergeToLSDouble =
false;
1028 CanMergeToLSMulti = CanMergeToLSDouble =
false;
1031 for (
unsigned I = SIndex+1;
I < EIndex; ++
I, ++Count) {
1032 int NewOffset = MemOps[
I].Offset;
1033 if (NewOffset != Offset + (
int)
Size)
1037 if (Reg == ARM::SP || Reg == ARM::PC)
1042 :
TRI->getEncodingValue(Reg);
1043 bool PartOfLSMulti = CanMergeToLSMulti;
1044 if (PartOfLSMulti) {
1046 if (RegNum <= PRegNum)
1047 PartOfLSMulti =
false;
1051 else if (!isNotVFP && RegNum != PRegNum+1)
1052 PartOfLSMulti =
false;
1055 bool PartOfLSDouble = CanMergeToLSDouble && Count <= 1;
1057 if (!PartOfLSMulti && !PartOfLSDouble)
1059 CanMergeToLSMulti &= PartOfLSMulti;
1060 CanMergeToLSDouble &= PartOfLSDouble;
1064 if (Position < MemOps[Latest].Position)
1066 else if (Position > MemOps[Earliest].Position)
1074 MergeCandidate *Candidate =
new(
Allocator.Allocate()) MergeCandidate;
1075 for (
unsigned C = SIndex, CE = SIndex + Count;
C < CE; ++
C)
1076 Candidate->Instrs.push_back(MemOps[
C].MI);
1077 Candidate->LatestMIIdx = Latest - SIndex;
1078 Candidate->EarliestMIIdx = Earliest - SIndex;
1079 Candidate->InsertPos = MemOps[Latest].Position;
1081 CanMergeToLSMulti = CanMergeToLSDouble =
false;
1082 Candidate->CanMergeToLSMulti = CanMergeToLSMulti;
1083 Candidate->CanMergeToLSDouble = CanMergeToLSDouble;
1084 Candidates.push_back(Candidate);
1087 }
while (SIndex < EIndex);
1165 case ARM::tADDi8: Scale = 4; CheckCPSRDef =
true;
break;
1166 case ARM::tSUBi8: Scale = -4; CheckCPSRDef =
true;
break;
1168 case ARM::SUBri: Scale = -1; CheckCPSRDef =
true;
break;
1170 case ARM::ADDri: Scale = 1; CheckCPSRDef =
true;
break;
1171 case ARM::tADDspi: Scale = 4; CheckCPSRDef =
false;
break;
1172 case ARM::tSUBspi: Scale = -4; CheckCPSRDef =
false;
break;
1180 MIPredReg != PredReg)
1183 if (CheckCPSRDef && definesCPSR(MI))
1196 if (MBBI == BeginMBBI)
1201 while (PrevMBBI->isDebugInstr() && PrevMBBI != BeginMBBI)
1205 return Offset == 0 ? EndMBBI : PrevMBBI;
1217 while (NextMBBI != EndMBBI && NextMBBI->isDebugInstr())
1219 if (NextMBBI == EndMBBI)
1223 return Offset == 0 ? EndMBBI : NextMBBI;
1238 bool ARMLoadStoreOpt::MergeBaseUpdateLSMultiple(
MachineInstr *
MI) {
1240 if (isThumb1)
return false;
1243 unsigned Base = BaseOP.
getReg();
1244 bool BaseKill = BaseOP.
isKill();
1245 unsigned PredReg = 0;
1263 if (Mode ==
ARM_AM::ia && Offset == -Bytes) {
1265 }
else if (Mode ==
ARM_AM::ib && Offset == -Bytes) {
1279 bool HighRegsUsed =
false;
1282 HighRegsUsed =
true;
1287 MergeInstr = MBB.
end();
1292 if (MergeInstr != MBB.
end())
1293 MBB.
erase(MergeInstr);
1299 .addImm(Pred).
addReg(PredReg);
1302 for (
unsigned OpNum = 3, e = MI->
getNumOperands(); OpNum != e; ++OpNum)
1316 return ARM::LDR_PRE_IMM;
1318 return ARM::STR_PRE_IMM;
1320 return Mode ==
ARM_AM::add ? ARM::VLDMSIA_UPD : ARM::VLDMSDB_UPD;
1322 return Mode ==
ARM_AM::add ? ARM::VLDMDIA_UPD : ARM::VLDMDDB_UPD;
1324 return Mode ==
ARM_AM::add ? ARM::VSTMSIA_UPD : ARM::VSTMSDB_UPD;
1326 return Mode ==
ARM_AM::add ? ARM::VSTMDIA_UPD : ARM::VSTMDDB_UPD;
1329 return ARM::t2LDR_PRE;
1332 return ARM::t2STR_PRE;
1341 return ARM::LDR_POST_IMM;
1343 return ARM::STR_POST_IMM;
1345 return Mode ==
ARM_AM::add ? ARM::VLDMSIA_UPD : ARM::VLDMSDB_UPD;
1347 return Mode ==
ARM_AM::add ? ARM::VLDMDIA_UPD : ARM::VLDMDDB_UPD;
1349 return Mode ==
ARM_AM::add ? ARM::VSTMSIA_UPD : ARM::VSTMSDB_UPD;
1351 return Mode ==
ARM_AM::add ? ARM::VSTMDIA_UPD : ARM::VSTMDDB_UPD;
1354 return ARM::t2LDR_POST;
1357 return ARM::t2STR_POST;
1364 bool ARMLoadStoreOpt::MergeBaseUpdateLoadStore(
MachineInstr *MI) {
1367 if (isThumb1)
return false;
1373 bool isAM5 = (Opcode == ARM::VLDRD || Opcode == ARM::VLDRS ||
1374 Opcode == ARM::VSTRD || Opcode == ARM::VSTRS);
1375 bool isAM2 = (Opcode == ARM::LDRi12 || Opcode == ARM::STRi12);
1387 unsigned PredReg = 0;
1396 if (!isAM5 && Offset == Bytes) {
1398 }
else if (Offset == -Bytes) {
1402 if (Offset == Bytes) {
1404 }
else if (!isAM5 && Offset == -Bytes) {
1409 MBB.
erase(MergeInstr);
1423 .addImm(Pred).
addReg(PredReg)
1429 if (NewOpc == ARM::LDR_PRE_IMM || NewOpc == ARM::LDRB_PRE_IMM) {
1455 if (isAM2 && NewOpc == ARM::STR_POST_IMM) {
1458 BuildMI(MBB, MBBI, DL,
TII->get(NewOpc), Base)
1466 BuildMI(MBB, MBBI, DL,
TII->get(NewOpc), Base)
1478 bool ARMLoadStoreOpt::MergeBaseUpdateLSDouble(
MachineInstr &MI)
const {
1480 assert((Opcode == ARM::t2LDRDi8 || Opcode == ARM::t2STRDi8) &&
1481 "Must have t2STRDi8 or t2LDRDi8");
1488 unsigned Base = BaseOp.
getReg();
1491 if (Reg0Op.
getReg() == Base || Reg1Op.
getReg() == Base)
1502 if (Offset == 8 || Offset == -8) {
1503 NewOpc = Opcode == ARM::t2LDRDi8 ? ARM::t2LDRD_PRE : ARM::t2STRD_PRE;
1506 if (Offset == 8 || Offset == -8) {
1507 NewOpc = Opcode == ARM::t2LDRDi8 ? ARM::t2LDRD_POST : ARM::t2STRD_POST;
1511 MBB.
erase(MergeInstr);
1515 if (NewOpc == ARM::t2LDRD_PRE || NewOpc == ARM::t2LDRD_POST) {
1518 assert(NewOpc == ARM::t2STRD_PRE || NewOpc == ARM::t2STRD_POST);
1523 assert(
TII->get(Opcode).getNumOperands() == 6 &&
1524 TII->get(NewOpc).getNumOperands() == 7 &&
1525 "Unexpected number of operands in Opcode specification.");
1593 bool isDef,
unsigned NewOpc,
unsigned Reg,
1594 bool RegDeadKill,
bool RegUndef,
unsigned BaseReg,
1618 if (Opcode != ARM::LDRD && Opcode != ARM::STRD && Opcode != ARM::t2LDRDi8)
1622 unsigned BaseReg = BaseOp.
getReg();
1625 unsigned EvenRegNum =
TRI->getDwarfRegNum(EvenReg,
false);
1626 unsigned OddRegNum =
TRI->getDwarfRegNum(OddReg,
false);
1630 bool Errata602117 = EvenReg == BaseReg &&
1631 (Opcode == ARM::LDRD || Opcode == ARM::t2LDRDi8) && STI->isCortexM3();
1633 bool NonConsecutiveRegs = (Opcode == ARM::LDRD || Opcode == ARM::STRD) &&
1634 (EvenRegNum % 2 != 0 || EvenRegNum + 1 != OddRegNum);
1636 if (!Errata602117 && !NonConsecutiveRegs)
1639 bool isT2 = Opcode == ARM::t2LDRDi8 || Opcode == ARM::t2STRDi8;
1640 bool isLd = Opcode == ARM::LDRD || Opcode == ARM::t2LDRDi8;
1641 bool EvenDeadKill = isLd ?
1644 bool OddDeadKill = isLd ?
1647 bool BaseKill = BaseOp.
isKill();
1648 bool BaseUndef = BaseOp.
isUndef();
1650 "register offset not handled below");
1652 unsigned PredReg = 0;
1655 if (OddRegNum > EvenRegNum && OffImm == 0) {
1658 unsigned NewOpc = (isLd)
1659 ? (isT2 ? ARM::t2LDMIA : ARM::LDMIA)
1660 : (isT2 ? ARM::t2STMIA : ARM::STMIA);
1662 BuildMI(MBB, MBBI, MBBI->getDebugLoc(),
TII->get(NewOpc))
1664 .addImm(Pred).
addReg(PredReg)
1669 BuildMI(MBB, MBBI, MBBI->getDebugLoc(),
TII->get(NewOpc))
1671 .addImm(Pred).
addReg(PredReg)
1680 unsigned NewOpc = (isLd)
1681 ? (isT2 ? (OffImm < 0 ? ARM::t2LDRi8 : ARM::t2LDRi12) : ARM::LDRi12)
1682 : (isT2 ? (OffImm < 0 ? ARM::t2STRi8 : ARM::t2STRi12) : ARM::STRi12);
1685 unsigned NewOpc2 = (isLd)
1686 ? (isT2 ? (OffImm+4 < 0 ? ARM::t2LDRi8 : ARM::t2LDRi12) : ARM::LDRi12)
1687 : (isT2 ? (OffImm+4 < 0 ? ARM::t2STRi8 : ARM::t2STRi12) : ARM::STRi12);
1690 if (isLd &&
TRI->regsOverlap(EvenReg, BaseReg)) {
1691 assert(!
TRI->regsOverlap(OddReg, BaseReg));
1692 InsertLDR_STR(MBB, MBBI, OffImm + 4, isLd, NewOpc2, OddReg, OddDeadKill,
1693 false, BaseReg,
false, BaseUndef, Pred, PredReg,
TII);
1694 InsertLDR_STR(MBB, MBBI, OffImm, isLd, NewOpc, EvenReg, EvenDeadKill,
1695 false, BaseReg, BaseKill, BaseUndef, Pred, PredReg,
TII);
1697 if (OddReg == EvenReg && EvenDeadKill) {
1701 EvenDeadKill =
false;
1705 if (EvenReg == BaseReg)
1706 EvenDeadKill =
false;
1707 InsertLDR_STR(MBB, MBBI, OffImm, isLd, NewOpc, EvenReg, EvenDeadKill,
1708 EvenUndef, BaseReg,
false, BaseUndef, Pred, PredReg,
TII);
1709 InsertLDR_STR(MBB, MBBI, OffImm + 4, isLd, NewOpc2, OddReg, OddDeadKill,
1710 OddUndef, BaseReg, BaseKill, BaseUndef, Pred, PredReg,
TII);
1718 MBBI = MBB.
erase(MBBI);
1726 unsigned CurrBase = 0;
1727 unsigned CurrOpc = ~0u;
1730 assert(Candidates.size() == 0);
1731 assert(MergeBaseCandidates.size() == 0);
1732 LiveRegsValid =
false;
1737 MBBI = std::prev(
I);
1738 if (FixInvalidRegPairOp(MBB, MBBI))
1743 unsigned Opcode = MBBI->getOpcode();
1747 unsigned PredReg = 0;
1750 if (CurrBase == 0) {
1755 MemOps.push_back(MemOpQueueEntry(*MBBI, Offset, Position));
1759 if (CurrOpc == Opcode && CurrBase == Base && CurrPred == Pred) {
1767 bool Overlap =
false;
1769 Overlap = (Base ==
Reg);
1771 for (
const MemOpQueueEntry &
E : MemOps) {
1772 if (
TRI->regsOverlap(Reg,
E.MI->getOperand(0).getReg())) {
1782 if (Offset > MemOps.back().Offset) {
1783 MemOps.push_back(MemOpQueueEntry(*MBBI, Offset, Position));
1786 MemOpQueue::iterator
MI, ME;
1787 for (MI = MemOps.begin(), ME = MemOps.end(); MI != ME; ++
MI) {
1788 if (Offset < MI->Offset) {
1792 if (Offset == MI->Offset) {
1798 if (MI != MemOps.end()) {
1799 MemOps.insert(MI, MemOpQueueEntry(*MBBI, Offset, Position));
1810 }
else if (MBBI->isDebugInstr()) {
1812 }
else if (MBBI->getOpcode() == ARM::t2LDRDi8 ||
1813 MBBI->getOpcode() == ARM::t2STRDi8) {
1816 MergeBaseCandidates.push_back(&*MBBI);
1820 if (MemOps.size() > 0) {
1821 FormCandidates(MemOps);
1829 if (MemOps.size() > 0)
1830 FormCandidates(MemOps);
1834 auto LessThan = [](
const MergeCandidate* M0,
const MergeCandidate *M1) {
1835 return M0->InsertPos < M1->InsertPos;
1837 llvm::sort(Candidates.begin(), Candidates.end(), LessThan);
1840 bool Changed =
false;
1841 for (
const MergeCandidate *Candidate : Candidates) {
1842 if (Candidate->CanMergeToLSMulti || Candidate->CanMergeToLSDouble) {
1848 if (Opcode == ARM::t2STRDi8 || Opcode == ARM::t2LDRDi8)
1849 MergeBaseUpdateLSDouble(*Merged);
1851 MergeBaseUpdateLSMultiple(Merged);
1854 if (MergeBaseUpdateLoadStore(MI))
1859 assert(Candidate->Instrs.size() == 1);
1860 if (MergeBaseUpdateLoadStore(Candidate->Instrs.front()))
1867 MergeBaseUpdateLSDouble(*MI);
1868 MergeBaseCandidates.clear();
1885 if (isThumb1)
return false;
1886 if (MBB.
empty())
return false;
1889 if (MBBI != MBB.
begin() && MBBI != MBB.
end() &&
1890 (MBBI->getOpcode() == ARM::BX_RET ||
1891 MBBI->getOpcode() == ARM::tBX_RET ||
1892 MBBI->getOpcode() == ARM::MOVPCLR)) {
1895 while (PrevI->isDebugInstr() && PrevI != MBB.
begin())
1899 if (Opcode == ARM::LDMIA_UPD || Opcode == ARM::LDMDA_UPD ||
1900 Opcode == ARM::LDMDB_UPD || Opcode == ARM::LDMIB_UPD ||
1901 Opcode == ARM::t2LDMIA_UPD || Opcode == ARM::t2LDMDB_UPD) {
1903 if (MO.
getReg() != ARM::LR)
1905 unsigned NewOpc = (isThumb2 ? ARM::t2LDMIA_RET : ARM::LDMIA_RET);
1906 assert(((isThumb2 && Opcode == ARM::t2LDMIA_UPD) ||
1907 Opcode == ARM::LDMIA_UPD) &&
"Unsupported multiple load-return!");
1918 if (Info.getReg() == ARM::LR) {
1919 Info.setRestored(
false);
1931 if (MBBI == MBB.
begin() || MBBI == MBB.
end() ||
1932 MBBI->getOpcode() != ARM::tBX_RET)
1937 if (Prev->getOpcode() != ARM::tMOVr || !Prev->definesRegister(ARM::LR))
1940 for (
auto Use : Prev->uses())
1942 assert(STI->hasV4TOps());
1943 BuildMI(MBB, MBBI, MBBI->getDebugLoc(),
TII->get(ARM::tBX))
1946 .copyImplicitOps(*MBBI);
1963 TII = STI->getInstrInfo();
1964 TRI = STI->getRegisterInfo();
1966 RegClassInfoValid =
false;
1967 isThumb2 = AFI->isThumb2Function();
1968 isThumb1 = AFI->isThumbFunction() && !isThumb2;
1974 Modified |= LoadStoreMultipleOpti(MBB);
1975 if (STI->hasV5TOps())
1976 Modified |= MergeReturnIntoLDM(MBB);
1978 Modified |= CombineMovBx(MBB);
1985 #define ARM_PREALLOC_LOAD_STORE_OPT_NAME \ 1986 "ARM pre- register allocation load / store optimization pass" 2007 StringRef getPassName()
const override {
2018 unsigned &NewOpc,
unsigned &EvenReg,
2019 unsigned &OddReg,
unsigned &BaseReg,
2025 unsigned Base,
bool isLd,
2041 TD = &Fn.getDataLayout();
2042 STI = &
static_cast<const ARMSubtarget &
>(Fn.getSubtarget());
2043 TII = STI->getInstrInfo();
2044 TRI = STI->getRegisterInfo();
2045 MRI = &Fn.getRegInfo();
2047 AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
2051 Modified |= RescheduleLoadStoreInstrs(&MFI);
2066 if (I->isDebugInstr() || MemOps.
count(&*I))
2068 if (I->isCall() || I->isTerminator() || I->hasUnmodeledSideEffects())
2070 if (I->mayStore() || (!isLd && I->mayLoad()))
2072 if (I->mayAlias(AA, *MemOp,
false))
2074 for (
unsigned j = 0, NumOps = I->getNumOperands(); j != NumOps; ++j) {
2081 if (Reg != Base && !MemRegs.
count(Reg))
2082 AddedRegPressure.
insert(Reg);
2087 if (MemRegs.
size() <= 4)
2090 return AddedRegPressure.
size() <= MemRegs.
size() * 2;
2097 unsigned &SecondReg,
2098 unsigned &BaseReg,
int &Offset,
2103 if (!STI->hasV5TEOps())
2109 if (Opcode == ARM::LDRi12) {
2111 }
else if (Opcode == ARM::STRi12) {
2113 }
else if (Opcode == ARM::t2LDRi8 || Opcode == ARM::t2LDRi12) {
2114 NewOpc = ARM::t2LDRDi8;
2117 }
else if (Opcode == ARM::t2STRi8 || Opcode == ARM::t2STRi12) {
2118 NewOpc = ARM::t2STRDi8;
2134 unsigned ReqAlign = STI->hasV6Ops()
2137 if (Align < ReqAlign)
2143 int Limit = (1 << 8) * Scale;
2144 if (OffImm >= Limit || (OffImm <= -Limit) || (OffImm & (Scale-1)))
2153 int Limit = (1 << 8) * Scale;
2154 if (OffImm >= Limit || (OffImm & (Scale-1)))
2160 if (FirstReg == SecondReg)
2170 unsigned Base,
bool isLd,
2172 bool RetVal =
false;
2179 assert(LHS == RHS || LOffset != ROffset);
2180 return LOffset > ROffset;
2187 while (Ops.
size() > 1) {
2188 unsigned FirstLoc = ~0U;
2189 unsigned LastLoc = 0;
2193 unsigned LastOpcode = 0;
2194 unsigned LastBytes = 0;
2195 unsigned NumMove = 0;
2196 for (
int i = Ops.
size() - 1; i >= 0; --i) {
2201 if (LastOpcode && LSMOpcode != LastOpcode)
2208 if (Bytes != LastBytes || Offset != (LastOffset + (
int)Bytes))
2220 LastOpcode = LSMOpcode;
2222 unsigned Loc = MI2LocMap[
Op];
2223 if (Loc <= FirstLoc) {
2227 if (Loc >= LastLoc) {
2238 for (
size_t i = Ops.
size() - NumMove, e = Ops.
size(); i != e; ++i) {
2245 bool DoMove = (LastLoc - FirstLoc) <= NumMove*4;
2248 MemOps, MemRegs,
TRI, AA);
2250 for (
unsigned i = 0; i != NumMove; ++i)
2255 while (InsertPos != MBB->
end() &&
2256 (MemOps.
count(&*InsertPos) || InsertPos->isDebugInstr()))
2263 unsigned FirstReg = 0, SecondReg = 0;
2264 unsigned BaseReg = 0, PredReg = 0;
2267 unsigned NewOpc = 0;
2270 if (NumMove == 2 && CanFormLdStDWord(Op0, Op1, dl, NewOpc,
2271 FirstReg, SecondReg, BaseReg,
2272 Offset, PredReg, Pred, isT2)) {
2278 MRI->constrainRegClass(FirstReg, TRC);
2279 MRI->constrainRegClass(SecondReg, TRC);
2320 for (
unsigned i = 0; i != NumMove; ++i) {
2323 MBB->
splice(InsertPos, MBB, Op);
2327 NumLdStMoved += NumMove;
2338 bool RetVal =
false;
2350 for (; MBBI !=
E; ++MBBI) {
2359 MI2LocMap[&MI] = ++Loc;
2363 unsigned PredReg = 0;
2372 bool StopHere =
false;
2375 Base2LdsMap.
find(Base);
2376 if (BI != Base2LdsMap.
end()) {
2377 for (
unsigned i = 0, e = BI->second.
size(); i != e; ++i) {
2384 BI->second.push_back(&MI);
2386 Base2LdsMap[Base].push_back(&MI);
2391 Base2StsMap.
find(Base);
2392 if (BI != Base2StsMap.
end()) {
2393 for (
unsigned i = 0, e = BI->second.
size(); i != e; ++i) {
2400 BI->second.push_back(&MI);
2402 Base2StsMap[Base].push_back(&MI);
2416 for (
unsigned i = 0, e = LdBases.
size(); i != e; ++i) {
2417 unsigned Base = LdBases[i];
2420 RetVal |= RescheduleOps(MBB, Lds, Base,
true, MI2LocMap);
2424 for (
unsigned i = 0, e = StBases.
size(); i != e; ++i) {
2425 unsigned Base = StBases[i];
2428 RetVal |= RescheduleOps(MBB, Sts, Base,
false, MI2LocMap);
2432 Base2LdsMap.
clear();
2433 Base2StsMap.
clear();
2445 return new ARMPreAllocLoadStoreOpt();
2446 return new ARMLoadStoreOpt();
const Function & getFunction() const
static unsigned getPreIndexedLoadStoreOpcode(unsigned Opc, ARM_AM::AddrOpc Mode)
void push_back(const T &Elt)
const MachineInstrBuilder & add(const MachineOperand &MO) const
A parsed version of the target data layout string in and methods for querying it. ...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
bool isCalleeSavedInfoValid() const
Has the callee saved info been calculated yet?
static bool isT1i32Load(unsigned Opc)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
bool isCall(QueryType Type=AnyInBundle) const
Compute iterated dominance frontiers using a linear time algorithm.
iterator_range< mop_iterator > uses()
Returns a range that includes all operands that are register uses.
LivenessQueryResult computeRegisterLiveness(const TargetRegisterInfo *TRI, unsigned Reg, const_iterator Before, unsigned Neighborhood=10) const
Return whether (physical) register Reg has been defined and not killed as of just before Before...
static unsigned getImmScale(unsigned Opc)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
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.
unsigned getReg() const
getReg - Returns the register number.
const ARMTargetLowering * getTargetLowering() const override
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
unsigned getAM3Opc(AddrOpc Opc, unsigned char Offset, unsigned IdxMode=0)
getAM3Opc - This function encodes the addrmode3 opc field.
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...
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
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.
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...
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
const HexagonInstrInfo * TII
unsigned getNumOperands() const
Access to explicit operands of the instruction.
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)
A Use represents the edge between a Value definition and its users.
bool isTerminator(QueryType Type=AnyInBundle) const
Returns true if this instruction part of the terminator for a basic block.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Position
Position to insert a new instruction relative to an existing instruction.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
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)
unsigned char getAM3Offset(unsigned AM3Opc)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
iterator getLastNonDebugInstr()
Returns an iterator to the last non-debug instruction in the basic block, or end().
unsigned getUndefRegState(bool B)
unsigned getKillRegState(bool B)
static unsigned getPostIndexedLoadStoreOpcode(unsigned Opc, ARM_AM::AddrOpc Mode)
TargetInstrInfo - Interface to description of machine instruction set.
iterator find(const_arg_type_t< KeyT > Val)
#define ARM_PREALLOC_LOAD_STORE_OPT_NAME
unsigned getDeadRegState(bool B)
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)
MachineInstrBundleIterator< MachineInstr > iterator
unsigned char getAM5Offset(unsigned AM5Opc)
AddrOpc getAM3Op(unsigned AM3Opc)
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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...
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.
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setImm(int64_t immVal)
FunctionPass class - This class is used to implement most global optimizations.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
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...
bool isDebugInstr() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
uint64_t getAlignment() const
Return the minimum known alignment in bytes of the actual memory reference.
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 sort(IteratorTy Start, IteratorTy End)
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 ...
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.
static void InsertLDR_STR(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, int Offset, bool isDef, unsigned NewOpc, unsigned Reg, bool RegDeadKill, bool RegUndef, unsigned BaseReg, bool BaseKill, bool BaseUndef, ARMCC::CondCodes Pred, unsigned PredReg, const TargetInstrInfo *TII)
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.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
bool regsOverlap(unsigned regA, unsigned regB) const
Returns true if the two registers are equal or alias each other.
unsigned getAM2Opc(AddrOpc Opc, unsigned Imm12, ShiftOpc SO, unsigned IdxMode=0)
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...
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly. ...
INITIALIZE_PASS(ARMLoadStoreOpt, "arm-ldst-opt", ARM_LOAD_STORE_OPT_NAME, false, false) static bool definesCPSR(const MachineInstr &MI)
A BumpPtrAllocator that allows only elements of a specific type to be allocated.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...
#define ARM_LOAD_STORE_OPT_NAME
unsigned getTransientStackAlignment() const
getTransientStackAlignment - This method returns the number of bytes to which the stack pointer must ...
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr reads the specified register.
iterator_range< mop_iterator > implicit_operands()
static const MachineOperand & getLoadStoreBaseOp(const MachineInstr &MI)
unsigned succ_size() const
const MachineBasicBlock * getParent() const
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)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr kills the specified register.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
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...
LLVM_NODISCARD bool empty() const
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
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...
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
void setReg(unsigned Reg)
Change the register this operand corresponds to.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
bool optForMinSize() const
Optimize this function for minimum size (-Oz).
virtual const TargetFrameLowering * getFrameLowering() const
static bool isLoadSingle(unsigned Opc)
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
static unsigned getUpdatingLSMultipleOpcode(unsigned Opc, ARM_AM::AMSubMode Mode)
static bool isi32Load(unsigned Opc)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static unsigned getLSMultipleTransferSize(const MachineInstr *MI)
LLVM Value Representation.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
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.
AddrOpc getAM5Op(unsigned AM5Opc)
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 & setMemRefs(MachineInstr::mmo_iterator b, MachineInstr::mmo_iterator e) const
const MachineOperand & getOperand(unsigned i) const
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.
This file describes how to lower LLVM code to machine code.
mmo_iterator memoperands_end() const
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.