From 5a971a48c36dca0d14c11c980deb8edeb493be0d Mon Sep 17 00:00:00 2001 From: Vasileios Kalintiris Date: Fri, 15 Apr 2016 20:43:17 +0000 Subject: [PATCH] [mips] More range-based for loops. NFC. There are still a couple more inside the MIPS target. I opted for a single commit in order to avoid spamming the list. llvm-svn: 266472 --- llvm/lib/Target/Mips/MipsAsmPrinter.cpp | 7 +++---- llvm/lib/Target/Mips/MipsLongBranch.cpp | 4 ++-- llvm/lib/Target/Mips/MipsSEFrameLowering.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp index cfb9e5c..cd35b0c 100644 --- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp @@ -1053,10 +1053,9 @@ void MipsAsmPrinter::NaClAlignIndirectJumpTargets(MachineFunction &MF) { } // If basic block address is taken, block can be target of indirect branch. - for (MachineFunction::iterator MBB = MF.begin(), E = MF.end(); - MBB != E; ++MBB) { - if (MBB->hasAddressTaken()) - MBB->setAlignment(MIPS_NACL_BUNDLE_ALIGN); + for (auto &MBB : MF) { + if (MBB.hasAddressTaken()) + MBB.setAlignment(MIPS_NACL_BUNDLE_ALIGN); } } diff --git a/llvm/lib/Target/Mips/MipsLongBranch.cpp b/llvm/lib/Target/Mips/MipsLongBranch.cpp index db11291..e8cb45e 100644 --- a/llvm/lib/Target/Mips/MipsLongBranch.cpp +++ b/llvm/lib/Target/Mips/MipsLongBranch.cpp @@ -165,8 +165,8 @@ void MipsLongBranch::splitMBB(MachineBasicBlock *MBB) { void MipsLongBranch::initMBBInfo() { // Split the MBBs if they have two branches. Each basic block should have at // most one branch after this loop is executed. - for (MachineFunction::iterator I = MF->begin(), E = MF->end(); I != E;) - splitMBB(&*I++); + for (auto &MBB : *MF) + splitMBB(&MBB); MF->RenumberBlocks(); MBBInfos.clear(); diff --git a/llvm/lib/Target/Mips/MipsSEFrameLowering.cpp b/llvm/lib/Target/Mips/MipsSEFrameLowering.cpp index e94751ca..abca33a 100644 --- a/llvm/lib/Target/Mips/MipsSEFrameLowering.cpp +++ b/llvm/lib/Target/Mips/MipsSEFrameLowering.cpp @@ -86,10 +86,10 @@ ExpandPseudo::ExpandPseudo(MachineFunction &MF_) bool ExpandPseudo::expand() { bool Expanded = false; - for (MachineFunction::iterator BB = MF.begin(), BBEnd = MF.end(); - BB != BBEnd; ++BB) - for (Iter I = BB->begin(), End = BB->end(); I != End;) - Expanded |= expandInstr(*BB, I++); + for (auto &MBB : MF) { + for (Iter I = MBB.begin(), End = MBB.end(); I != End;) + Expanded |= expandInstr(MBB, I++); + } return Expanded; } -- 2.7.4