mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
increase the accuracy of register pressure computation in the presence of dead definitions by using live intervals, if available, to identify dead definitions and proceed accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194286 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -498,10 +498,20 @@ bool RegPressureTracker::recede(SmallVectorImpl<unsigned> *LiveUses,
|
||||
// TODO: consider earlyclobbers?
|
||||
for (unsigned i = 0, e = RegOpers.Defs.size(); i < e; ++i) {
|
||||
unsigned Reg = RegOpers.Defs[i];
|
||||
if (LiveRegs.erase(Reg))
|
||||
decreaseRegPressure(Reg);
|
||||
else
|
||||
discoverLiveOut(Reg);
|
||||
bool DeadDef = false;
|
||||
if (RequireIntervals) {
|
||||
const LiveRange *LR = getLiveRange(Reg);
|
||||
if (LR) {
|
||||
LiveQueryResult LRQ = LR->Query(SlotIdx);
|
||||
DeadDef = LRQ.isDeadDef();
|
||||
}
|
||||
}
|
||||
if (!DeadDef) {
|
||||
if (LiveRegs.erase(Reg))
|
||||
decreaseRegPressure(Reg);
|
||||
else
|
||||
discoverLiveOut(Reg);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate liveness for uses.
|
||||
@@ -702,8 +712,19 @@ void RegPressureTracker::bumpUpwardPressure(const MachineInstr *MI) {
|
||||
// Kill liveness at live defs.
|
||||
for (unsigned i = 0, e = RegOpers.Defs.size(); i < e; ++i) {
|
||||
unsigned Reg = RegOpers.Defs[i];
|
||||
if (!containsReg(RegOpers.Uses, Reg))
|
||||
decreaseRegPressure(Reg);
|
||||
bool DeadDef = false;
|
||||
if (RequireIntervals) {
|
||||
const LiveRange *LR = getLiveRange(Reg);
|
||||
if (LR) {
|
||||
SlotIndex SlotIdx = LIS->getInstructionIndex(MI);
|
||||
LiveQueryResult LRQ = LR->Query(SlotIdx);
|
||||
DeadDef = LRQ.isDeadDef();
|
||||
}
|
||||
}
|
||||
if (!DeadDef) {
|
||||
if (!containsReg(RegOpers.Uses, Reg))
|
||||
decreaseRegPressure(Reg);
|
||||
}
|
||||
}
|
||||
// Generate liveness for uses.
|
||||
for (unsigned i = 0, e = RegOpers.Uses.size(); i < e; ++i) {
|
||||
|
Reference in New Issue
Block a user