Add a LiveRangeEdit delegate callback before shrinking a live range.
The register allocator needs to adjust its live interval unions when that happens. llvm-svn: 127774
This commit is contained in:
parent
c738c96519
commit
e14b2b226f
|
@ -201,8 +201,11 @@ void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr*> &Dead,
|
|||
break;
|
||||
|
||||
// Shrink just one live interval. Then delete new dead defs.
|
||||
LIS.shrinkToUses(ToShrink.back(), &Dead);
|
||||
LiveInterval *LI = ToShrink.back();
|
||||
ToShrink.pop_back();
|
||||
if (delegate_)
|
||||
delegate_->LRE_WillShrinkVirtReg(LI->reg);
|
||||
LIS.shrinkToUses(LI, &Dead);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ public:
|
|||
/// its deletion from LiveIntervals.
|
||||
virtual bool LRE_CanEraseVirtReg(unsigned) { return true; }
|
||||
|
||||
/// Called before shrinking the live range of a virtual register.
|
||||
virtual void LRE_WillShrinkVirtReg(unsigned) {}
|
||||
|
||||
virtual ~Delegate() {}
|
||||
};
|
||||
|
||||
|
|
|
@ -162,6 +162,7 @@ public:
|
|||
private:
|
||||
void LRE_WillEraseInstruction(MachineInstr*);
|
||||
bool LRE_CanEraseVirtReg(unsigned);
|
||||
void LRE_WillShrinkVirtReg(unsigned);
|
||||
|
||||
bool checkUncachedInterference(LiveInterval&, unsigned);
|
||||
LiveInterval *getSingleInterference(LiveInterval&, unsigned);
|
||||
|
@ -260,6 +261,17 @@ bool RAGreedy::LRE_CanEraseVirtReg(unsigned VirtReg) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void RAGreedy::LRE_WillShrinkVirtReg(unsigned VirtReg) {
|
||||
unsigned PhysReg = VRM->getPhys(VirtReg);
|
||||
if (!PhysReg)
|
||||
return;
|
||||
|
||||
// Register is assigned, put it back on the queue for reassignment.
|
||||
LiveInterval &LI = LIS->getInterval(VirtReg);
|
||||
unassign(LI, PhysReg);
|
||||
enqueue(&LI);
|
||||
}
|
||||
|
||||
void RAGreedy::releaseMemory() {
|
||||
SpillerInstance.reset(0);
|
||||
LRStage.clear();
|
||||
|
|
Loading…
Reference in New Issue