[ARM] - Tidy-up ARMAsmPrinter.cpp

Change to range-loop where missing.

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

llvm-svn: 311993
This commit is contained in:
Javed Absar 2017-08-29 10:04:18 +00:00
parent c9f29c62cc
commit 5766b8eea0
1 changed files with 8 additions and 10 deletions

View File

@ -173,10 +173,10 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (! ThumbIndirectPads.empty()) { if (! ThumbIndirectPads.empty()) {
OutStreamer->EmitAssemblerFlag(MCAF_Code16); OutStreamer->EmitAssemblerFlag(MCAF_Code16);
EmitAlignment(1); EmitAlignment(1);
for (unsigned i = 0, e = ThumbIndirectPads.size(); i < e; i++) { for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
OutStreamer->EmitLabel(ThumbIndirectPads[i].second); OutStreamer->EmitLabel(TIP.second);
EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::tBX) EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::tBX)
.addReg(ThumbIndirectPads[i].first) .addReg(TIP.first)
// Add predicate operands. // Add predicate operands.
.addImm(ARMCC::AL) .addImm(ARMCC::AL)
.addReg(0)); .addReg(0));
@ -945,8 +945,7 @@ void ARMAsmPrinter::EmitJumpTableAddrs(const MachineInstr *MI) {
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables(); const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs; const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) { for (MachineBasicBlock *MBB : JTBBs) {
MachineBasicBlock *MBB = JTBBs[i];
// Construct an MCExpr for the entry. We want a value of the form: // Construct an MCExpr for the entry. We want a value of the form:
// (BasicBlockAddr - TableBeginAddr) // (BasicBlockAddr - TableBeginAddr)
// //
@ -989,8 +988,7 @@ void ARMAsmPrinter::EmitJumpTableInsts(const MachineInstr *MI) {
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables(); const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs; const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) { for (MachineBasicBlock *MBB : JTBBs) {
MachineBasicBlock *MBB = JTBBs[i];
const MCExpr *MBBSymbolExpr = MCSymbolRefExpr::create(MBB->getSymbol(), const MCExpr *MBBSymbolExpr = MCSymbolRefExpr::create(MBB->getSymbol(),
OutContext); OutContext);
// If this isn't a TBB or TBH, the entries are direct branch instructions. // If this isn't a TBB or TBH, the entries are direct branch instructions.
@ -1289,9 +1287,9 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
unsigned TReg = MI->getOperand(0).getReg(); unsigned TReg = MI->getOperand(0).getReg();
MCSymbol *TRegSym = nullptr; MCSymbol *TRegSym = nullptr;
for (unsigned i = 0, e = ThumbIndirectPads.size(); i < e; i++) { for (std::pair<unsigned, MCSymbol *> &TIP : ThumbIndirectPads) {
if (ThumbIndirectPads[i].first == TReg) { if (TIP.first == TReg) {
TRegSym = ThumbIndirectPads[i].second; TRegSym = TIP.second;
break; break;
} }
} }