1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Replace ARM's getCalleeSavedRegClasses with a simpler solution

llvm-svn: 105335
This commit is contained in:
Rafael Espindola 2010-06-02 17:54:50 +00:00
parent 90ca622864
commit aa18562c5c
2 changed files with 40 additions and 94 deletions

View File

@ -170,56 +170,6 @@ ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
return STI.isTargetDarwin() ? DarwinCalleeSavedRegs : CalleeSavedRegs; return STI.isTargetDarwin() ? DarwinCalleeSavedRegs : CalleeSavedRegs;
} }
const TargetRegisterClass* const *
ARMBaseRegisterInfo::getCalleeSavedRegClasses(const MachineFunction *MF) const {
static const TargetRegisterClass * const CalleeSavedRegClasses[] = {
&ARM::GPRRegClass, &ARM::GPRRegClass, &ARM::GPRRegClass,
&ARM::GPRRegClass, &ARM::GPRRegClass, &ARM::GPRRegClass,
&ARM::GPRRegClass, &ARM::GPRRegClass, &ARM::GPRRegClass,
&ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass,
&ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass,
0
};
static const TargetRegisterClass * const ThumbCalleeSavedRegClasses[] = {
&ARM::GPRRegClass, &ARM::GPRRegClass, &ARM::GPRRegClass,
&ARM::GPRRegClass, &ARM::GPRRegClass, &ARM::tGPRRegClass,
&ARM::tGPRRegClass,&ARM::tGPRRegClass,&ARM::tGPRRegClass,
&ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass,
&ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass,
0
};
static const TargetRegisterClass * const DarwinCalleeSavedRegClasses[] = {
&ARM::GPRRegClass, &ARM::GPRRegClass, &ARM::GPRRegClass,
&ARM::GPRRegClass, &ARM::GPRRegClass, &ARM::GPRRegClass,
&ARM::GPRRegClass, &ARM::GPRRegClass,
&ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass,
&ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass,
0
};
static const TargetRegisterClass * const DarwinThumbCalleeSavedRegClasses[] ={
&ARM::GPRRegClass, &ARM::tGPRRegClass, &ARM::tGPRRegClass,
&ARM::tGPRRegClass, &ARM::tGPRRegClass, &ARM::GPRRegClass,
&ARM::GPRRegClass, &ARM::GPRRegClass,
&ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass,
&ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass, &ARM::DPRRegClass,
0
};
if (STI.isThumb1Only()) {
return STI.isTargetDarwin()
? DarwinThumbCalleeSavedRegClasses : ThumbCalleeSavedRegClasses;
}
return STI.isTargetDarwin()
? DarwinCalleeSavedRegClasses : CalleeSavedRegClasses;
}
BitVector ARMBaseRegisterInfo:: BitVector ARMBaseRegisterInfo::
getReservedRegs(const MachineFunction &MF) const { getReservedRegs(const MachineFunction &MF) const {
// FIXME: avoid re-calculating this everytime. // FIXME: avoid re-calculating this everytime.
@ -780,7 +730,6 @@ ARMBaseRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
// Don't spill FP if the frame can be eliminated. This is determined // Don't spill FP if the frame can be eliminated. This is determined
// by scanning the callee-save registers to see if any is used. // by scanning the callee-save registers to see if any is used.
const unsigned *CSRegs = getCalleeSavedRegs(); const unsigned *CSRegs = getCalleeSavedRegs();
const TargetRegisterClass* const *CSRegClasses = getCalleeSavedRegClasses();
for (unsigned i = 0; CSRegs[i]; ++i) { for (unsigned i = 0; CSRegs[i]; ++i) {
unsigned Reg = CSRegs[i]; unsigned Reg = CSRegs[i];
bool Spilled = false; bool Spilled = false;
@ -798,50 +747,50 @@ ARMBaseRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
} }
} }
if (CSRegClasses[i] == ARM::GPRRegisterClass || if (!ARM::GPRRegisterClass->contains(Reg))
CSRegClasses[i] == ARM::tGPRRegisterClass) { continue;
if (Spilled) {
NumGPRSpills++;
if (!STI.isTargetDarwin()) { if (Spilled) {
if (Reg == ARM::LR) NumGPRSpills++;
LRSpilled = true;
CS1Spilled = true;
continue;
}
// Keep track if LR and any of R4, R5, R6, and R7 is spilled. if (!STI.isTargetDarwin()) {
switch (Reg) { if (Reg == ARM::LR)
case ARM::LR:
LRSpilled = true; LRSpilled = true;
// Fallthrough CS1Spilled = true;
case ARM::R4: continue;
case ARM::R5: }
case ARM::R6:
case ARM::R7:
CS1Spilled = true;
break;
default:
break;
}
} else {
if (!STI.isTargetDarwin()) {
UnspilledCS1GPRs.push_back(Reg);
continue;
}
switch (Reg) { // Keep track if LR and any of R4, R5, R6, and R7 is spilled.
case ARM::R4: switch (Reg) {
case ARM::R5: case ARM::LR:
case ARM::R6: LRSpilled = true;
case ARM::R7: // Fallthrough
case ARM::LR: case ARM::R4:
UnspilledCS1GPRs.push_back(Reg); case ARM::R5:
break; case ARM::R6:
default: case ARM::R7:
UnspilledCS2GPRs.push_back(Reg); CS1Spilled = true;
break; break;
} default:
break;
}
} else {
if (!STI.isTargetDarwin()) {
UnspilledCS1GPRs.push_back(Reg);
continue;
}
switch (Reg) {
case ARM::R4:
case ARM::R5:
case ARM::R6:
case ARM::R7:
case ARM::LR:
UnspilledCS1GPRs.push_back(Reg);
break;
default:
UnspilledCS2GPRs.push_back(Reg);
break;
} }
} }
} }

View File

@ -69,9 +69,6 @@ public:
/// Code Generation virtual methods... /// Code Generation virtual methods...
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const; const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
const TargetRegisterClass* const*
getCalleeSavedRegClasses(const MachineFunction *MF = 0) const;
BitVector getReservedRegs(const MachineFunction &MF) const; BitVector getReservedRegs(const MachineFunction &MF) const;
/// getMatchingSuperRegClass - Return a subclass of the specified register /// getMatchingSuperRegClass - Return a subclass of the specified register