mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Move common code into an MRI function.
llvm-svn: 147071
This commit is contained in:
parent
f7236d1084
commit
893037ce23
@ -283,7 +283,16 @@ public:
|
|||||||
/// isPhysRegUsed - Return true if the specified register is used in this
|
/// isPhysRegUsed - Return true if the specified register is used in this
|
||||||
/// function. This only works after register allocation.
|
/// function. This only works after register allocation.
|
||||||
bool isPhysRegUsed(unsigned Reg) const { return UsedPhysRegs[Reg]; }
|
bool isPhysRegUsed(unsigned Reg) const { return UsedPhysRegs[Reg]; }
|
||||||
|
|
||||||
|
/// isPhysRegOrOverlapUsed - Return true if Reg or any overlapping register
|
||||||
|
/// is used in this function.
|
||||||
|
bool isPhysRegOrOverlapUsed(unsigned Reg) const {
|
||||||
|
for (const unsigned *AI = TRI->getOverlaps(Reg); *AI; ++AI)
|
||||||
|
if (isPhysRegUsed(*AI))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// setPhysRegUsed - Mark the specified register used in this function.
|
/// setPhysRegUsed - Mark the specified register used in this function.
|
||||||
/// This should only be called during and after register allocation.
|
/// This should only be called during and after register allocation.
|
||||||
void setPhysRegUsed(unsigned Reg) { UsedPhysRegs[Reg] = true; }
|
void setPhysRegUsed(unsigned Reg) { UsedPhysRegs[Reg] = true; }
|
||||||
|
@ -654,11 +654,10 @@ bool ExeDepsFix::runOnMachineFunction(MachineFunction &mf) {
|
|||||||
bool anyregs = false;
|
bool anyregs = false;
|
||||||
for (TargetRegisterClass::const_iterator I = RC->begin(), E = RC->end();
|
for (TargetRegisterClass::const_iterator I = RC->begin(), E = RC->end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
for (const unsigned *AI = TRI->getOverlaps(*I); *AI; ++AI)
|
if (MF->getRegInfo().isPhysRegOrOverlapUsed(*I)) {
|
||||||
if (MF->getRegInfo().isPhysRegUsed(*AI)) {
|
anyregs = true;
|
||||||
anyregs = true;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
if (!anyregs) return false;
|
if (!anyregs) return false;
|
||||||
|
|
||||||
// Initialize the AliasMap on the first use.
|
// Initialize the AliasMap on the first use.
|
||||||
|
@ -224,17 +224,9 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) {
|
|||||||
std::vector<CalleeSavedInfo> CSI;
|
std::vector<CalleeSavedInfo> CSI;
|
||||||
for (unsigned i = 0; CSRegs[i]; ++i) {
|
for (unsigned i = 0; CSRegs[i]; ++i) {
|
||||||
unsigned Reg = CSRegs[i];
|
unsigned Reg = CSRegs[i];
|
||||||
if (Fn.getRegInfo().isPhysRegUsed(Reg)) {
|
if (Fn.getRegInfo().isPhysRegOrOverlapUsed(Reg)) {
|
||||||
// If the reg is modified, save it!
|
// If the reg is modified, save it!
|
||||||
CSI.push_back(CalleeSavedInfo(Reg));
|
CSI.push_back(CalleeSavedInfo(Reg));
|
||||||
} else {
|
|
||||||
for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
|
|
||||||
*AliasSet; ++AliasSet) { // Check alias registers too.
|
|
||||||
if (Fn.getRegInfo().isPhysRegUsed(*AliasSet)) {
|
|
||||||
CSI.push_back(CalleeSavedInfo(Reg));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,18 +898,9 @@ ARMFrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
|||||||
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;
|
||||||
if (MF.getRegInfo().isPhysRegUsed(Reg)) {
|
if (MF.getRegInfo().isPhysRegOrOverlapUsed(Reg)) {
|
||||||
Spilled = true;
|
Spilled = true;
|
||||||
CanEliminateFrame = false;
|
CanEliminateFrame = false;
|
||||||
} else {
|
|
||||||
// Check alias registers too.
|
|
||||||
for (const unsigned *Aliases =
|
|
||||||
RegInfo->getAliasSet(Reg); *Aliases; ++Aliases) {
|
|
||||||
if (MF.getRegInfo().isPhysRegUsed(*Aliases)) {
|
|
||||||
Spilled = true;
|
|
||||||
CanEliminateFrame = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ARM::GPRRegisterClass->contains(Reg))
|
if (!ARM::GPRRegisterClass->contains(Reg))
|
||||||
|
Loading…
Reference in New Issue
Block a user