summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegisterPressure.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-08-23 17:48:48 +0000
committerAndrew Trick <atrick@apple.com>2013-08-23 17:48:48 +0000
commit01bc21648219fd68502843241f5834e60aa50c61 (patch)
treea94eda28cfc12e59866aa015b5489f41a0c46ba1 /llvm/lib/CodeGen/RegisterPressure.cpp
parent86a7061e5d868f3df58cc53d575504073155062d (diff)
downloadbcm5719-llvm-01bc21648219fd68502843241f5834e60aa50c61.tar.gz
bcm5719-llvm-01bc21648219fd68502843241f5834e60aa50c61.zip
Simplify RegPressure helpers.
llvm-svn: 189122
Diffstat (limited to 'llvm/lib/CodeGen/RegisterPressure.cpp')
-rw-r--r--llvm/lib/CodeGen/RegisterPressure.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/RegisterPressure.cpp b/llvm/lib/CodeGen/RegisterPressure.cpp
index c64b15ffaee..4f326e86cbc 100644
--- a/llvm/lib/CodeGen/RegisterPressure.cpp
+++ b/llvm/lib/CodeGen/RegisterPressure.cpp
@@ -25,16 +25,10 @@ using namespace llvm;
/// Increase pressure for each pressure set provided by TargetRegisterInfo.
static void increaseSetPressure(std::vector<unsigned> &CurrSetPressure,
- std::vector<unsigned> &MaxSetPressure,
PSetIterator PSetI) {
unsigned Weight = PSetI.getWeight();
- for (; PSetI.isValid(); ++PSetI) {
+ for (; PSetI.isValid(); ++PSetI)
CurrSetPressure[*PSetI] += Weight;
- if (&CurrSetPressure != &MaxSetPressure
- && CurrSetPressure[*PSetI] > MaxSetPressure[*PSetI]) {
- MaxSetPressure[*PSetI] = CurrSetPressure[*PSetI];
- }
- }
}
/// Decrease pressure for each pressure set provided by TargetRegisterInfo.
@@ -87,8 +81,14 @@ void RegPressureTracker::dump() const {
/// the high water mark if needed.
void RegPressureTracker::increaseRegPressure(ArrayRef<unsigned> Regs) {
for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
- increaseSetPressure(CurrSetPressure, P.MaxSetPressure,
- MRI->getPressureSets(Regs[i]));
+ PSetIterator PSetI = 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];
if (TargetRegisterInfo::isVirtualRegister(Reg)
&& !RPTracker.hasUntiedDef(Reg)) {
- increaseSetPressure(LiveThruPressure, LiveThruPressure,
- MRI->getPressureSets(Reg));
+ increaseSetPressure(LiveThruPressure, MRI->getPressureSets(Reg));
}
}
}
@@ -366,8 +365,7 @@ void RegPressureTracker::discoverLiveIn(unsigned Reg) {
// At live in discovery, unconditionally increase the high water mark.
P.LiveInRegs.push_back(Reg);
- increaseSetPressure(P.MaxSetPressure, P.MaxSetPressure,
- MRI->getPressureSets(Reg));
+ increaseSetPressure(P.MaxSetPressure, MRI->getPressureSets(Reg));
}
/// 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.
P.LiveOutRegs.push_back(Reg);
- increaseSetPressure(P.MaxSetPressure, P.MaxSetPressure,
- MRI->getPressureSets(Reg));
+ increaseSetPressure(P.MaxSetPressure, MRI->getPressureSets(Reg));
}
/// Recede across the previous instruction.
OpenPOWER on IntegriCloud