livein_iterator livein_begin() const { return LiveIns.begin(); }
livein_iterator livein_end() const { return LiveIns.end(); }
bool livein_empty() const { return LiveIns.empty(); }
+ iterator_range<livein_iterator> liveins() const {
+ return make_range(livein_begin(), livein_end());
+ }
bool isLiveIn(unsigned Reg) const;
}
// Print the live ins.
- for (auto I = RegInfo.livein_begin(), E = RegInfo.livein_end(); I != E; ++I) {
+ for (std::pair<unsigned, unsigned> LI : RegInfo.liveins()) {
yaml::MachineFunctionLiveIn LiveIn;
- printReg(I->first, LiveIn.Register, TRI);
- if (I->second)
- printReg(I->second, LiveIn.VirtualRegister, TRI);
+ printReg(LI.first, LiveIn.Register, TRI);
+ if (LI.second)
+ printReg(LI.second, LiveIn.VirtualRegister, TRI);
MF.LiveIns.push_back(LiveIn);
}
DenseMap<unsigned, unsigned> LiveInMap;
if (!FuncInfo->ArgDbgValues.empty())
- for (MachineRegisterInfo::livein_iterator LI = RegInfo->livein_begin(),
- E = RegInfo->livein_end(); LI != E; ++LI)
- if (LI->second)
- LiveInMap.insert(std::make_pair(LI->first, LI->second));
+ for (std::pair<unsigned, unsigned> LI : RegInfo->liveins())
+ if (LI.second)
+ LiveInMap.insert(LI);
// Insert DBG_VALUE instructions for function arguments to the entry block.
for (unsigned i = 0, e = FuncInfo->ArgDbgValues.size(); i != e; ++i) {
}
const TargetRegisterClass *IndirectRC = getIndirectAddrRegClass();
- for (MachineRegisterInfo::livein_iterator LI = MRI.livein_begin(),
- LE = MRI.livein_end();
- LI != LE; ++LI) {
- unsigned Reg = LI->first;
+ for (std::pair<unsigned, unsigned> LI : MRI.liveins()) {
+ unsigned Reg = LI.first;
if (TargetRegisterInfo::isVirtualRegister(Reg) ||
!IndirectRC->contains(Reg))
continue;
}
unsigned HexagonEvaluator::getVirtRegFor(unsigned PReg) const {
- using iterator = MachineRegisterInfo::livein_iterator;
-
- for (iterator I = MRI.livein_begin(), E = MRI.livein_end(); I != E; ++I) {
- if (I->first == PReg)
- return I->second;
- }
+ for (std::pair<unsigned,unsigned> P : MRI.liveins())
+ if (P.first == PReg)
+ return P.second;
return 0;
}
MachineRegisterInfo &MRI = MF.getRegInfo();
MachineBasicBlock &EntryB = *EA.Addr->getCode();
assert(EntryB.pred_empty() && "Function entry block has predecessors");
- for (auto I = MRI.livein_begin(), E = MRI.livein_end(); I != E; ++I)
- LiveIns.insert(RegisterRef(I->first));
+ for (std::pair<unsigned,unsigned> P : MRI.liveins())
+ LiveIns.insert(RegisterRef(P.first));
if (MRI.tracksLiveness()) {
for (auto I : EntryB.liveins())
LiveIns.insert(RegisterRef(I.PhysReg, I.LaneMask));
// Live in and live out values already must be in the mask, so don't bother
// marking them.
- for (MachineRegisterInfo::livein_iterator
- I = MF->getRegInfo().livein_begin(),
- E = MF->getRegInfo().livein_end(); I != E; ++I) {
- unsigned RegNo = TRI->getEncodingValue(I->first);
- if (VRRegNo[RegNo] == I->first) // If this really is a vector reg.
+ for (std::pair<unsigned, unsigned> LI : MF->getRegInfo().liveins()) {
+ unsigned RegNo = TRI->getEncodingValue(LI.first);
+ if (VRRegNo[RegNo] == LI.first) // If this really is a vector reg.
UsedRegMask &= ~(1 << (31-RegNo)); // Doesn't need to be marked.
}
if (CallConv == CallingConv::X86_RegCall ||
Fn->hasFnAttribute("no_caller_saved_registers")) {
- const MachineRegisterInfo &MRI = MF.getRegInfo();
- for (const auto &Pair : make_range(MRI.livein_begin(), MRI.livein_end()))
- MF.getRegInfo().disableCalleeSavedRegister(Pair.first);
+ MachineRegisterInfo &MRI = MF.getRegInfo();
+ for (std::pair<unsigned, unsigned> Pair : MRI.liveins())
+ MRI.disableCalleeSavedRegister(Pair.first);
}
return Chain;
}
static bool checkFnHasLiveInYmmOrZmm(MachineRegisterInfo &MRI) {
- for (MachineRegisterInfo::livein_iterator I = MRI.livein_begin(),
- E = MRI.livein_end(); I != E; ++I)
- if (isYmmOrZmmReg(I->first))
+ for (std::pair<unsigned, unsigned> LI : MRI.liveins())
+ if (isYmmOrZmmReg(LI.first))
return true;
return false;