mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
Add LiveIntervals::addKillFlags() to recompute kill flags after register allocation.
This is a lot easier than trying to get kill flags right during live range splitting and rematerialization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125113 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
124e423cce
commit
8a61da8a68
@ -320,6 +320,10 @@ namespace llvm {
|
|||||||
MachineBasicBlock::iterator getLastSplitPoint(const LiveInterval &li,
|
MachineBasicBlock::iterator getLastSplitPoint(const LiveInterval &li,
|
||||||
MachineBasicBlock *mbb);
|
MachineBasicBlock *mbb);
|
||||||
|
|
||||||
|
/// addKillFlags - Add kill flags to any instruction that kills a virtual
|
||||||
|
/// register.
|
||||||
|
void addKillFlags();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// computeIntervals - Compute live intervals.
|
/// computeIntervals - Compute live intervals.
|
||||||
void computeIntervals();
|
void computeIntervals();
|
||||||
|
@ -890,6 +890,29 @@ LiveIntervals::getLastSplitPoint(const LiveInterval &li,
|
|||||||
return mbb->getFirstTerminator();
|
return mbb->getFirstTerminator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LiveIntervals::addKillFlags() {
|
||||||
|
for (iterator I = begin(), E = end(); I != E; ++I) {
|
||||||
|
unsigned Reg = I->first;
|
||||||
|
if (TargetRegisterInfo::isPhysicalRegister(Reg))
|
||||||
|
continue;
|
||||||
|
if (mri_->reg_nodbg_empty(Reg))
|
||||||
|
continue;
|
||||||
|
LiveInterval *LI = I->second;
|
||||||
|
|
||||||
|
// Every instruction that kills Reg corresponds to a live range end point.
|
||||||
|
for (LiveInterval::iterator RI = LI->begin(), RE = LI->end(); RI != RE;
|
||||||
|
++RI) {
|
||||||
|
// A LOAD index indicates an MBB edge.
|
||||||
|
if (RI->end.isLoad())
|
||||||
|
continue;
|
||||||
|
MachineInstr *MI = getInstructionFromIndex(RI->end);
|
||||||
|
if (!MI)
|
||||||
|
continue;
|
||||||
|
MI->addRegisterKilled(Reg, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// getReMatImplicitUse - If the remat definition MI has one (for now, we only
|
/// getReMatImplicitUse - If the remat definition MI has one (for now, we only
|
||||||
/// allow one) virtual register operand, then its uses are implicitly using
|
/// allow one) virtual register operand, then its uses are implicitly using
|
||||||
/// the register. Returns the virtual register.
|
/// the register. Returns the virtual register.
|
||||||
|
@ -1087,6 +1087,7 @@ bool RAGreedy::runOnMachineFunction(MachineFunction &mf) {
|
|||||||
|
|
||||||
allocatePhysRegs();
|
allocatePhysRegs();
|
||||||
addMBBLiveIns(MF);
|
addMBBLiveIns(MF);
|
||||||
|
LIS->addKillFlags();
|
||||||
|
|
||||||
// Run rewriter
|
// Run rewriter
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user