The ppc-early-ret pass use the addReg() to add operand to the new instruction.
106 BuildMI( 107 **PI, J, J->getDebugLoc(), 108 TII->get(J->getOpcode() == PPC::BC ? PPC::BCLR : PPC::BCLRn)) 109 .addReg(J->getOperand(0).getReg()) 110 .copyImplicitOps(*I);
For example:
BC undef renamable $cr5lt, %bb.4 BLR implicit $lr, implicit $rm
Above case will be converted to:
BCLR $cr5lt, implicit $lr, implicit $rm
It;s obvious that the BCLR $cr5lt, implicit $lr, implicit $rm should be BCLR undef renamable $cr5lt, implicit $lr, implicit $rm.