Join cross class copies using getCommonSubClass()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70513 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2009-04-30 21:24:03 +00:00
parent ba67d87fe4
commit 3a155f0e34

View File

@ -1482,27 +1482,15 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) {
}
Limit = allocatableRCRegs_[DstRC].count();
} else if (!SrcIsPhys && !DstIsPhys) {
unsigned SrcSize = SrcRC->getSize();
unsigned DstSize = DstRC->getSize();
if (SrcSize < DstSize)
// For example X86::MOVSD2PDrr copies from FR64 to VR128.
NewRC = DstRC;
else if (DstSize > SrcSize) {
NewRC = SrcRC;
std::swap(LargeReg, SmallReg);
} else {
unsigned SrcNumRegs = SrcRC->getNumRegs();
unsigned DstNumRegs = DstRC->getNumRegs();
if (DstNumRegs < SrcNumRegs)
// Sub-register class?
NewRC = DstRC;
else if (SrcNumRegs < DstNumRegs) {
NewRC = SrcRC;
std::swap(LargeReg, SmallReg);
} else
// No idea what's the right register class to use.
return false;
NewRC = getCommonSubClass(SrcRC, DstRC);
if (!NewRC) {
DOUT << "\tDisjoint regclasses: "
<< SrcRC->getName() << ", "
<< DstRC->getName() << ".\n";
return false; // Not coalescable.
}
if (DstRC->getSize() > SrcRC->getSize())
std::swap(LargeReg, SmallReg);
}
// If we are joining two virtual registers and the resulting register