@@ -1631,28 +1631,26 @@ MipsConstantIslands::fixupConditionalBr(ImmBranch &Br) {
16311631
16321632void MipsConstantIslands::prescanForConstants () {
16331633 for (MachineBasicBlock &B : *MF) {
1634- for (MachineBasicBlock::instr_iterator I = B.instr_begin (),
1635- EB = B.instr_end ();
1636- I != EB; ++I) {
1637- switch (I->getDesc ().getOpcode ()) {
1634+ for (MachineInstr &MI : B) {
1635+ switch (MI.getDesc ().getOpcode ()) {
16381636 case Mips::LwConstant32: {
16391637 PrescannedForConstants = true ;
1640- LLVM_DEBUG (dbgs () << " constant island constant " << *I << " \n " );
1641- LLVM_DEBUG (dbgs () << " num operands " << I-> getNumOperands () << " \n " );
1642- MachineOperand &Literal = I-> getOperand (1 );
1638+ LLVM_DEBUG (dbgs () << " constant island constant " << MI << " \n " );
1639+ LLVM_DEBUG (dbgs () << " num operands " << MI. getNumOperands () << " \n " );
1640+ MachineOperand &Literal = MI. getOperand (1 );
16431641 if (Literal.isImm ()) {
16441642 int64_t V = Literal.getImm ();
16451643 LLVM_DEBUG (dbgs () << " literal " << V << " \n " );
16461644 Type *Int32Ty = Type::getInt32Ty (MF->getFunction ().getContext ());
16471645 const Constant *C = ConstantInt::get (Int32Ty, V);
16481646 unsigned index = MCP->getConstantPoolIndex (C, Align (4 ));
1649- I-> getOperand (2 ).ChangeToImmediate (index);
1650- LLVM_DEBUG (dbgs () << " constant island constant " << *I << " \n " );
1651- I-> setDesc (TII->get (Mips::LwRxPcTcp16));
1652- I-> removeOperand (1 );
1653- I-> removeOperand (1 );
1654- I-> addOperand (MachineOperand::CreateCPI (index, 0 ));
1655- I-> addOperand (MachineOperand::CreateImm (4 ));
1647+ MI. getOperand (2 ).ChangeToImmediate (index);
1648+ LLVM_DEBUG (dbgs () << " constant island constant " << MI << " \n " );
1649+ MI. setDesc (TII->get (Mips::LwRxPcTcp16));
1650+ MI. removeOperand (1 );
1651+ MI. removeOperand (1 );
1652+ MI. addOperand (MachineOperand::CreateCPI (index, 0 ));
1653+ MI. addOperand (MachineOperand::CreateImm (4 ));
16561654 }
16571655 break ;
16581656 }
0 commit comments