@@ -1631,28 +1631,26 @@ MipsConstantIslands::fixupConditionalBr(ImmBranch &Br) {
1631
1631
1632
1632
void MipsConstantIslands::prescanForConstants () {
1633
1633
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 ()) {
1638
1636
case Mips::LwConstant32: {
1639
1637
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 );
1643
1641
if (Literal.isImm ()) {
1644
1642
int64_t V = Literal.getImm ();
1645
1643
LLVM_DEBUG (dbgs () << " literal " << V << " \n " );
1646
1644
Type *Int32Ty = Type::getInt32Ty (MF->getFunction ().getContext ());
1647
1645
const Constant *C = ConstantInt::get (Int32Ty, V);
1648
1646
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 ));
1656
1654
}
1657
1655
break ;
1658
1656
}
0 commit comments