mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Change an argument to a LiveInterval instead of a register number to save some redundant lookups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127964 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -124,7 +124,7 @@ private:
|
|||||||
void analyzeSiblingValues();
|
void analyzeSiblingValues();
|
||||||
|
|
||||||
bool hoistSpill(LiveInterval &SpillLI, MachineInstr *CopyMI);
|
bool hoistSpill(LiveInterval &SpillLI, MachineInstr *CopyMI);
|
||||||
void eliminateRedundantSpills(unsigned Reg, VNInfo *VNI);
|
void eliminateRedundantSpills(LiveInterval &LI, VNInfo *VNI);
|
||||||
|
|
||||||
bool reMaterializeFor(MachineBasicBlock::iterator MI);
|
bool reMaterializeFor(MachineBasicBlock::iterator MI);
|
||||||
void reMaterializeAll();
|
void reMaterializeAll();
|
||||||
@@ -444,7 +444,7 @@ bool InlineSpiller::hoistSpill(LiveInterval &SpillLI, MachineInstr *CopyMI) {
|
|||||||
|
|
||||||
// We are going to spill SVI.SpillVNI immediately after its def, so clear out
|
// We are going to spill SVI.SpillVNI immediately after its def, so clear out
|
||||||
// any later spills of the same value.
|
// any later spills of the same value.
|
||||||
eliminateRedundantSpills(SVI.SpillReg, SVI.SpillVNI);
|
eliminateRedundantSpills(LIS.getInterval(SVI.SpillReg), SVI.SpillVNI);
|
||||||
|
|
||||||
MachineBasicBlock *MBB = LIS.getMBBFromIndex(SVI.SpillVNI->def);
|
MachineBasicBlock *MBB = LIS.getMBBFromIndex(SVI.SpillVNI->def);
|
||||||
MachineBasicBlock::iterator MII;
|
MachineBasicBlock::iterator MII;
|
||||||
@@ -463,15 +463,17 @@ bool InlineSpiller::hoistSpill(LiveInterval &SpillLI, MachineInstr *CopyMI) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// eliminateRedundantSpills - Reg:VNI is known to be on the stack. Remove any
|
/// eliminateRedundantSpills - SLI:VNI is known to be on the stack. Remove any
|
||||||
/// redundant spills of this value in Reg and sibling copies.
|
/// redundant spills of this value in SLI.reg and sibling copies.
|
||||||
void InlineSpiller::eliminateRedundantSpills(unsigned Reg, VNInfo *VNI) {
|
void InlineSpiller::eliminateRedundantSpills(LiveInterval &SLI, VNInfo *VNI) {
|
||||||
SmallVector<std::pair<unsigned, VNInfo*>, 8> WorkList;
|
SmallVector<std::pair<LiveInterval*, VNInfo*>, 8> WorkList;
|
||||||
WorkList.push_back(std::make_pair(Reg, VNI));
|
WorkList.push_back(std::make_pair(&SLI, VNI));
|
||||||
LiveInterval &StackInt = LSS.getInterval(StackSlot);
|
LiveInterval &StackInt = LSS.getInterval(StackSlot);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
tie(Reg, VNI) = WorkList.pop_back_val();
|
LiveInterval *LI;
|
||||||
|
tie(LI, VNI) = WorkList.pop_back_val();
|
||||||
|
unsigned Reg = LI->reg;
|
||||||
DEBUG(dbgs() << "Checking redundant spills for " << PrintReg(Reg) << ':'
|
DEBUG(dbgs() << "Checking redundant spills for " << PrintReg(Reg) << ':'
|
||||||
<< VNI->id << '@' << VNI->def << '\n');
|
<< VNI->id << '@' << VNI->def << '\n');
|
||||||
|
|
||||||
@@ -480,8 +482,7 @@ void InlineSpiller::eliminateRedundantSpills(unsigned Reg, VNInfo *VNI) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Add all of VNI's live range to StackInt.
|
// Add all of VNI's live range to StackInt.
|
||||||
LiveInterval &LI = LIS.getInterval(Reg);
|
StackInt.MergeValueInAsValue(*LI, VNI, StackInt.getValNumInfo(0));
|
||||||
StackInt.MergeValueInAsValue(LI, VNI, StackInt.getValNumInfo(0));
|
|
||||||
DEBUG(dbgs() << "Merged to stack int: " << StackInt << '\n');
|
DEBUG(dbgs() << "Merged to stack int: " << StackInt << '\n');
|
||||||
|
|
||||||
// Find all spills and copies of VNI.
|
// Find all spills and copies of VNI.
|
||||||
@@ -490,7 +491,7 @@ void InlineSpiller::eliminateRedundantSpills(unsigned Reg, VNInfo *VNI) {
|
|||||||
if (!MI->isCopy() && !MI->getDesc().mayStore())
|
if (!MI->isCopy() && !MI->getDesc().mayStore())
|
||||||
continue;
|
continue;
|
||||||
SlotIndex Idx = LIS.getInstructionIndex(MI);
|
SlotIndex Idx = LIS.getInstructionIndex(MI);
|
||||||
if (LI.getVNInfoAt(Idx) != VNI)
|
if (LI->getVNInfoAt(Idx) != VNI)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Follow sibling copies down the dominator tree.
|
// Follow sibling copies down the dominator tree.
|
||||||
@@ -500,7 +501,7 @@ void InlineSpiller::eliminateRedundantSpills(unsigned Reg, VNInfo *VNI) {
|
|||||||
VNInfo *DstVNI = DstLI.getVNInfoAt(Idx.getDefIndex());
|
VNInfo *DstVNI = DstLI.getVNInfoAt(Idx.getDefIndex());
|
||||||
assert(DstVNI && "Missing defined value");
|
assert(DstVNI && "Missing defined value");
|
||||||
assert(DstVNI->def == Idx.getDefIndex() && "Wrong copy def slot");
|
assert(DstVNI->def == Idx.getDefIndex() && "Wrong copy def slot");
|
||||||
WorkList.push_back(std::make_pair(DstReg, DstVNI));
|
WorkList.push_back(std::make_pair(&DstLI, DstVNI));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -841,7 +842,6 @@ void InlineSpiller::spill(LiveRangeEdit &edit) {
|
|||||||
Edit = &edit;
|
Edit = &edit;
|
||||||
assert(!TargetRegisterInfo::isStackSlot(edit.getReg())
|
assert(!TargetRegisterInfo::isStackSlot(edit.getReg())
|
||||||
&& "Trying to spill a stack slot.");
|
&& "Trying to spill a stack slot.");
|
||||||
|
|
||||||
// Share a stack slot among all descendants of Original.
|
// Share a stack slot among all descendants of Original.
|
||||||
Original = VRM.getOriginal(edit.getReg());
|
Original = VRM.getOriginal(edit.getReg());
|
||||||
StackSlot = VRM.getStackSlot(Original);
|
StackSlot = VRM.getStackSlot(Original);
|
||||||
|
Reference in New Issue
Block a user