Let RegisterInfo decide whether it can emit cross-class copy or not

llvm-svn: 75955
This commit is contained in:
Anton Korobeynikov 2009-07-16 13:55:26 +00:00
parent 590f99b18b
commit 12996eabbd
1 changed files with 5 additions and 4 deletions

View File

@ -132,10 +132,11 @@ bool LowerSubregsInstructionPass::LowerExtract(MachineInstr *MI) {
}
} else {
// Insert copy
const TargetRegisterClass *TRC = TRI.getPhysicalRegisterRegClass(DstReg);
assert(TRC == TRI.getPhysicalRegisterRegClass(SrcReg) &&
"Extract subreg and Dst must be of same register class");
TII.copyRegToReg(*MBB, MI, DstReg, SrcReg, TRC, TRC);
const TargetRegisterClass *TRCS = TRI.getPhysicalRegisterRegClass(DstReg);
const TargetRegisterClass *TRCD = TRI.getPhysicalRegisterRegClass(SrcReg);
bool Emitted = TII.copyRegToReg(*MBB, MI, DstReg, SrcReg, TRCD, TRCS);
(void)Emitted;
assert(Emitted && "Subreg and Dst must be of compatible register class");
// Transfer the kill/dead flags, if needed.
if (MI->getOperand(0).isDead())
TransferDeadFlag(MI, DstReg, TRI);