@@ -1635,30 +1635,29 @@ void MipsConstantIslands::prescanForConstants() {
16351635 EB = B.instr_end ();
16361636 I != EB; ++I) {
16371637 switch (I->getDesc ().getOpcode ()) {
1638- case Mips::LwConstant32: {
1639- PrescannedForConstants = true ;
1638+ case Mips::LwConstant32: {
1639+ 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 );
1643+ if (Literal.isImm ()) {
1644+ int64_t V = Literal.getImm ();
1645+ LLVM_DEBUG (dbgs () << " literal " << V << " \n " );
1646+ Type *Int32Ty = Type::getInt32Ty (MF->getFunction ().getContext ());
1647+ const Constant *C = ConstantInt::get (Int32Ty, V);
1648+ unsigned index = MCP->getConstantPoolIndex (C, Align (4 ));
1649+ I->getOperand (2 ).ChangeToImmediate (index);
16401650 LLVM_DEBUG (dbgs () << " constant island constant " << *I << " \n " );
1641- LLVM_DEBUG (dbgs () << " num operands " << I->getNumOperands () << " \n " );
1642- MachineOperand& Literal = I->getOperand (1 );
1643- if (Literal.isImm ()) {
1644- int64_t V = Literal.getImm ();
1645- LLVM_DEBUG (dbgs () << " literal " << V << " \n " );
1646- Type *Int32Ty =
1647- Type::getInt32Ty (MF->getFunction ().getContext ());
1648- const Constant *C = ConstantInt::get (Int32Ty, V);
1649- unsigned index = MCP->getConstantPoolIndex (C, Align (4 ));
1650- I->getOperand (2 ).ChangeToImmediate (index);
1651- LLVM_DEBUG (dbgs () << " constant island constant " << *I << " \n " );
1652- I->setDesc (TII->get (Mips::LwRxPcTcp16));
1653- I->removeOperand (1 );
1654- I->removeOperand (1 );
1655- I->addOperand (MachineOperand::CreateCPI (index, 0 ));
1656- I->addOperand (MachineOperand::CreateImm (4 ));
1657- }
1658- break ;
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 ));
16591656 }
1660- default :
1661- break ;
1657+ break ;
1658+ }
1659+ default :
1660+ break ;
16621661 }
16631662 }
16641663 }
0 commit comments