misched: handle on-the-fly regpressure queries better for 2-addr

instructions without relying on liveintervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167526 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick 2012-11-07 07:05:05 +00:00
parent 168c190c58
commit 881a05b46c
2 changed files with 15 additions and 9 deletions

View File

@ -43,7 +43,7 @@ struct RegisterPressure {
/// class. This is only useful to account for spilling or rematerialization.
void decrease(const TargetRegisterClass *RC, const TargetRegisterInfo *TRI);
void dump(const TargetRegisterInfo *TRI);
void dump(const TargetRegisterInfo *TRI) const;
};
/// RegisterPressure computed within a region of instructions delimited by
@ -197,6 +197,7 @@ public:
/// This result is complete if either advance() or recede() has returned true,
/// or if closeRegion() was explicitly invoked.
RegisterPressure &getPressure() { return P; }
const RegisterPressure &getPressure() const { return P; }
/// Get the register set pressure at the current position, which may be less
/// than the pressure across the traversed region.

View File

@ -64,7 +64,7 @@ void RegisterPressure::decrease(const TargetRegisterClass *RC,
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void RegisterPressure::dump(const TargetRegisterInfo *TRI) {
void RegisterPressure::dump(const TargetRegisterInfo *TRI) const {
dbgs() << "Live In: ";
for (unsigned i = 0, e = LiveInRegs.size(); i < e; ++i)
dbgs() << PrintReg(LiveInRegs[i], TRI) << " ";
@ -322,10 +322,8 @@ struct RegisterOperands {
if (findReg(MO.getReg(), isVReg, DeadDefs, TRI) == DeadDefs.end())
DeadDefs.push_back(MO.getReg());
}
else {
if (findReg(MO.getReg(), isVReg, Defs, TRI) == Defs.end())
Defs.push_back(MO.getReg());
}
else if (findReg(MO.getReg(), isVReg, Defs, TRI) == Defs.end())
Defs.push_back(MO.getReg());
}
}
};
@ -676,9 +674,16 @@ void RegPressureTracker::bumpUpwardPressure(const MachineInstr *MI) {
decreaseVirtRegPressure(VirtRegOpers.DeadDefs);
// Kill liveness at live defs.
decreasePhysRegPressure(PhysRegOpers.Defs);
decreaseVirtRegPressure(VirtRegOpers.Defs);
for (unsigned i = 0, e = PhysRegOpers.Defs.size(); i < e; ++i) {
unsigned Reg = PhysRegOpers.Defs[i];
if (!findReg(Reg, false, PhysRegOpers.Uses, TRI))
decreasePhysRegPressure(PhysRegOpers.Defs);
}
for (unsigned i = 0, e = VirtRegOpers.Defs.size(); i < e; ++i) {
unsigned Reg = VirtRegOpers.Defs[i];
if (!findReg(Reg, true, VirtRegOpers.Uses, TRI))
decreaseVirtRegPressure(VirtRegOpers.Defs);
}
// Generate liveness for uses.
for (unsigned i = 0, e = PhysRegOpers.Uses.size(); i < e; ++i) {
unsigned Reg = PhysRegOpers.Uses[i];