1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 06:22:56 +02:00

CopyToReg source operand can be a physical register.

llvm-svn: 35213
This commit is contained in:
Lauro Ramos Venancio 2007-03-20 16:46:44 +00:00
parent 1f0efa2270
commit 9659c8befc

View File

@ -475,9 +475,25 @@ void ScheduleDAG::EmitNode(SDNode *Node,
else
InReg = getVR(Node->getOperand(2), VRBaseMap);
unsigned DestReg = cast<RegisterSDNode>(Node->getOperand(1))->getReg();
if (InReg != DestReg) // Coalesced away the copy?
MRI->copyRegToReg(*BB, BB->end(), DestReg, InReg,
RegMap->getRegClass(InReg));
if (InReg != DestReg) {// Coalesced away the copy?
const TargetRegisterClass *TRC = 0;
// Get the target register class
if (MRegisterInfo::isVirtualRegister(InReg)) {
TRC = RegMap->getRegClass(InReg);
} else {
// Pick the register class of the right type that contains this
// physreg.
for (MRegisterInfo::regclass_iterator I = MRI->regclass_begin(),
E = MRI->regclass_end(); I != E; ++I)
if ((*I)->hasType(Node->getOperand(2).getValueType()) &&
(*I)->contains(InReg)) {
TRC = *I;
break;
}
assert(TRC && "Couldn't find register class for reg copy!");
}
MRI->copyRegToReg(*BB, BB->end(), DestReg, InReg, TRC);
}
break;
}
case ISD::CopyFromReg: {