diff options
author | Craig Topper <craig.topper@gmail.com> | 2015-10-08 06:06:42 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2015-10-08 06:06:42 +0000 |
commit | da5168b7ce40521abe005f7af7918ea3fd23a615 (patch) | |
tree | 9e71c1d15c1b0489c7fc5180fbf3152c92f4402c /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | |
parent | 060f5b4836835ec559f13c1d2500945fab3690a8 (diff) | |
download | bcm5719-llvm-da5168b7ce40521abe005f7af7918ea3fd23a615.tar.gz bcm5719-llvm-da5168b7ce40521abe005f7af7918ea3fd23a615.zip |
Use range-based for loops. NFC.
llvm-svn: 249659
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index 1b4fe705eb8..f2b4f4c665a 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -200,8 +200,7 @@ sink3AddrInstruction(MachineInstr *MI, unsigned SavedReg, unsigned DefReg = 0; SmallSet<unsigned, 4> UseRegs; - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI->getOperand(i); + for (const MachineOperand &MO : MI->operands()) { if (!MO.isReg()) continue; unsigned MOReg = MO.getReg(); @@ -236,10 +235,7 @@ sink3AddrInstruction(MachineInstr *MI, unsigned SavedReg, KillMI = LIS->getInstructionFromIndex(I->end); } if (!KillMI) { - for (MachineRegisterInfo::use_nodbg_iterator - UI = MRI->use_nodbg_begin(SavedReg), - UE = MRI->use_nodbg_end(); UI != UE; ++UI) { - MachineOperand &UseMO = *UI; + for (MachineOperand &UseMO : MRI->use_nodbg_operands(SavedReg)) { if (!UseMO.isKill()) continue; KillMI = UseMO.getParent(); @@ -1383,10 +1379,9 @@ tryInstructionTransform(MachineBasicBlock::iterator &mi, SmallVector<unsigned, 4> OrigRegs; if (LIS) { - for (MachineInstr::const_mop_iterator MOI = MI.operands_begin(), - MOE = MI.operands_end(); MOI != MOE; ++MOI) { - if (MOI->isReg()) - OrigRegs.push_back(MOI->getReg()); + for (const MachineOperand &MO : MI.operands()) { + if (MO.isReg()) + OrigRegs.push_back(MO.getReg()); } } @@ -1705,9 +1700,8 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &Func) { } // Now iterate over the information collected above. - for (TiedOperandMap::iterator OI = TiedOperands.begin(), - OE = TiedOperands.end(); OI != OE; ++OI) { - processTiedPairs(mi, OI->second, Dist); + for (auto &TO : TiedOperands) { + processTiedPairs(mi, TO.second, Dist); DEBUG(dbgs() << "\t\trewrite to:\t" << *mi); } |