[llvm] r311993 - [ARM] - Tidy-up ARMAsmPrinter.cpp

Javed Absar via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 03:04:18 PDT 2017


Author: javed.absar
Date: Tue Aug 29 03:04:18 2017
New Revision: 311993

URL: http://llvm.org/viewvc/llvm-project?rev=311993&view=rev
Log:
[ARM] - Tidy-up ARMAsmPrinter.cpp

Change to range-loop where missing.

Reviwewed by: @fhahn, @asb
Differential Revision: https://reviews.llvm.org/D37199


Modified:
    llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=311993&r1=311992&r2=311993&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Tue Aug 29 03:04:18 2017
@@ -173,10 +173,10 @@ bool ARMAsmPrinter::runOnMachineFunction
   if (! ThumbIndirectPads.empty()) {
     OutStreamer->EmitAssemblerFlag(MCAF_Code16);
     EmitAlignment(1);
-    for (unsigned i = 0, e = ThumbIndirectPads.size(); i < e; i++) {
-      OutStreamer->EmitLabel(ThumbIndirectPads[i].second);
+    for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
+      OutStreamer->EmitLabel(TIP.second);
       EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::tBX)
-        .addReg(ThumbIndirectPads[i].first)
+        .addReg(TIP.first)
         // Add predicate operands.
         .addImm(ARMCC::AL)
         .addReg(0));
@@ -945,8 +945,7 @@ void ARMAsmPrinter::EmitJumpTableAddrs(c
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
 
-  for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
-    MachineBasicBlock *MBB = JTBBs[i];
+  for (MachineBasicBlock *MBB : JTBBs) {
     // Construct an MCExpr for the entry. We want a value of the form:
     // (BasicBlockAddr - TableBeginAddr)
     //
@@ -989,8 +988,7 @@ void ARMAsmPrinter::EmitJumpTableInsts(c
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
 
-  for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
-    MachineBasicBlock *MBB = JTBBs[i];
+  for (MachineBasicBlock *MBB : JTBBs) {
     const MCExpr *MBBSymbolExpr = MCSymbolRefExpr::create(MBB->getSymbol(),
                                                           OutContext);
     // If this isn't a TBB or TBH, the entries are direct branch instructions.
@@ -1289,9 +1287,9 @@ void ARMAsmPrinter::EmitInstruction(cons
 
     unsigned TReg = MI->getOperand(0).getReg();
     MCSymbol *TRegSym = nullptr;
-    for (unsigned i = 0, e = ThumbIndirectPads.size(); i < e; i++) {
-      if (ThumbIndirectPads[i].first == TReg) {
-        TRegSym = ThumbIndirectPads[i].second;
+    for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
+      if (TIP.first == TReg) {
+        TRegSym = TIP.second;
         break;
       }
     }




More information about the llvm-commits mailing list