mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Simplify RegPressure helpers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -25,16 +25,10 @@ using namespace llvm;
|
|||||||
|
|
||||||
/// Increase pressure for each pressure set provided by TargetRegisterInfo.
|
/// Increase pressure for each pressure set provided by TargetRegisterInfo.
|
||||||
static void increaseSetPressure(std::vector<unsigned> &CurrSetPressure,
|
static void increaseSetPressure(std::vector<unsigned> &CurrSetPressure,
|
||||||
std::vector<unsigned> &MaxSetPressure,
|
|
||||||
PSetIterator PSetI) {
|
PSetIterator PSetI) {
|
||||||
unsigned Weight = PSetI.getWeight();
|
unsigned Weight = PSetI.getWeight();
|
||||||
for (; PSetI.isValid(); ++PSetI) {
|
for (; PSetI.isValid(); ++PSetI)
|
||||||
CurrSetPressure[*PSetI] += Weight;
|
CurrSetPressure[*PSetI] += Weight;
|
||||||
if (&CurrSetPressure != &MaxSetPressure
|
|
||||||
&& CurrSetPressure[*PSetI] > MaxSetPressure[*PSetI]) {
|
|
||||||
MaxSetPressure[*PSetI] = CurrSetPressure[*PSetI];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decrease pressure for each pressure set provided by TargetRegisterInfo.
|
/// Decrease pressure for each pressure set provided by TargetRegisterInfo.
|
||||||
@ -87,8 +81,14 @@ void RegPressureTracker::dump() const {
|
|||||||
/// the high water mark if needed.
|
/// the high water mark if needed.
|
||||||
void RegPressureTracker::increaseRegPressure(ArrayRef<unsigned> Regs) {
|
void RegPressureTracker::increaseRegPressure(ArrayRef<unsigned> Regs) {
|
||||||
for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
|
||||||
increaseSetPressure(CurrSetPressure, P.MaxSetPressure,
|
PSetIterator PSetI = MRI->getPressureSets(Regs[i]);
|
||||||
MRI->getPressureSets(Regs[i]));
|
unsigned Weight = PSetI.getWeight();
|
||||||
|
for (; PSetI.isValid(); ++PSetI) {
|
||||||
|
CurrSetPressure[*PSetI] += Weight;
|
||||||
|
if (CurrSetPressure[*PSetI] > P.MaxSetPressure[*PSetI]) {
|
||||||
|
P.MaxSetPressure[*PSetI] = CurrSetPressure[*PSetI];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,8 +281,7 @@ void RegPressureTracker::initLiveThru(const RegPressureTracker &RPTracker) {
|
|||||||
unsigned Reg = P.LiveOutRegs[i];
|
unsigned Reg = P.LiveOutRegs[i];
|
||||||
if (TargetRegisterInfo::isVirtualRegister(Reg)
|
if (TargetRegisterInfo::isVirtualRegister(Reg)
|
||||||
&& !RPTracker.hasUntiedDef(Reg)) {
|
&& !RPTracker.hasUntiedDef(Reg)) {
|
||||||
increaseSetPressure(LiveThruPressure, LiveThruPressure,
|
increaseSetPressure(LiveThruPressure, MRI->getPressureSets(Reg));
|
||||||
MRI->getPressureSets(Reg));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,8 +365,7 @@ void RegPressureTracker::discoverLiveIn(unsigned Reg) {
|
|||||||
|
|
||||||
// At live in discovery, unconditionally increase the high water mark.
|
// At live in discovery, unconditionally increase the high water mark.
|
||||||
P.LiveInRegs.push_back(Reg);
|
P.LiveInRegs.push_back(Reg);
|
||||||
increaseSetPressure(P.MaxSetPressure, P.MaxSetPressure,
|
increaseSetPressure(P.MaxSetPressure, MRI->getPressureSets(Reg));
|
||||||
MRI->getPressureSets(Reg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add Reg to the live out set and increase max pressure.
|
/// Add Reg to the live out set and increase max pressure.
|
||||||
@ -378,8 +376,7 @@ void RegPressureTracker::discoverLiveOut(unsigned Reg) {
|
|||||||
|
|
||||||
// At live out discovery, unconditionally increase the high water mark.
|
// At live out discovery, unconditionally increase the high water mark.
|
||||||
P.LiveOutRegs.push_back(Reg);
|
P.LiveOutRegs.push_back(Reg);
|
||||||
increaseSetPressure(P.MaxSetPressure, P.MaxSetPressure,
|
increaseSetPressure(P.MaxSetPressure, MRI->getPressureSets(Reg));
|
||||||
MRI->getPressureSets(Reg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Recede across the previous instruction.
|
/// Recede across the previous instruction.
|
||||||
|
Reference in New Issue
Block a user