Add ARM getMatchingSuperRegClass to handle S / D / Q cross regclass coalescing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85049 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2009-10-25 07:53:28 +00:00
parent ed3ad212ec
commit 4f54c1293a
2 changed files with 34 additions and 0 deletions

View File

@ -253,6 +253,33 @@ bool ARMBaseRegisterInfo::isReservedReg(const MachineFunction &MF,
return false;
}
const TargetRegisterClass *
ARMBaseRegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
const TargetRegisterClass *B,
unsigned SubIdx) const {
switch (SubIdx) {
default: return 0;
case 1:
case 2:
case 3:
case 4:
// S sub-registers.
if (A->getSize() == 8) {
if (A == &ARM::DPR_8RegClass)
return A;
return &ARM::DPR_VFP2RegClass;
}
assert(A->getSize() == 16 && "Expecting a Q register class!");
return &ARM::QPR_VFP2RegClass;
case 5:
case 6:
// D sub-registers.
return A;
}
return 0;
}
const TargetRegisterClass *
ARMBaseRegisterInfo::getPointerRegClass(unsigned Kind) const {
return ARM::GPRRegisterClass;

View File

@ -74,6 +74,13 @@ public:
BitVector getReservedRegs(const MachineFunction &MF) const;
/// getMatchingSuperRegClass - Return a subclass of the specified register
/// class A so that each register in it has a sub-register of the
/// specified sub-register index which is in the specified register class B.
virtual const TargetRegisterClass *
getMatchingSuperRegClass(const TargetRegisterClass *A,
const TargetRegisterClass *B, unsigned Idx) const;
const TargetRegisterClass *getPointerRegClass(unsigned Kind = 0) const;
std::pair<TargetRegisterClass::iterator,TargetRegisterClass::iterator>