mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
Some cleanups. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62917 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e4e094b52d
commit
32ca8657b8
@ -175,6 +175,8 @@ namespace {
|
||||
void RenumberValno(VNInfo* VN);
|
||||
void ReconstructLiveInterval(LiveInterval* LI);
|
||||
bool removeDeadSpills(SmallPtrSet<LiveInterval*, 8>& split);
|
||||
unsigned getNumberOfSpills(SmallPtrSet<MachineInstr*, 4>& MIs,
|
||||
unsigned Reg, int FrameIndex);
|
||||
VNInfo* PerformPHIConstruction(MachineBasicBlock::iterator use,
|
||||
MachineBasicBlock* MBB,
|
||||
LiveInterval* LI,
|
||||
@ -1381,6 +1383,21 @@ PreAllocSplitting::SplitRegLiveIntervals(const TargetRegisterClass **RCs,
|
||||
return Change;
|
||||
}
|
||||
|
||||
unsigned PreAllocSplitting::getNumberOfSpills(
|
||||
SmallPtrSet<MachineInstr*, 4>& MIs,
|
||||
unsigned Reg, int FrameIndex) {
|
||||
unsigned Spills = 0;
|
||||
for (SmallPtrSet<MachineInstr*, 4>::iterator UI = MIs.begin(), UE = MIs.end();
|
||||
UI != UI; ++UI) {
|
||||
int StoreFrameIndex;
|
||||
unsigned StoreVReg = TII->isStoreToStackSlot(*UI, StoreFrameIndex);
|
||||
if (StoreVReg == Reg && StoreFrameIndex == FrameIndex)
|
||||
Spills++;
|
||||
}
|
||||
|
||||
return Spills;
|
||||
}
|
||||
|
||||
/// removeDeadSpills - After doing splitting, filter through all intervals we've
|
||||
/// split, and see if any of the spills are unnecessary. If so, remove them.
|
||||
bool PreAllocSplitting::removeDeadSpills(SmallPtrSet<LiveInterval*, 8>& split) {
|
||||
@ -1417,20 +1434,12 @@ bool PreAllocSplitting::removeDeadSpills(SmallPtrSet<LiveInterval*, 8>& split) {
|
||||
DefMI->eraseFromParent();
|
||||
NumDeadSpills++;
|
||||
changed = true;
|
||||
} else {
|
||||
bool NonRestore = false;
|
||||
for (SmallPtrSet<MachineInstr*, 4>::iterator UI =
|
||||
VNUseCount[CurrVN].begin(), UE = VNUseCount[CurrVN].end();
|
||||
UI != UI; ++UI) {
|
||||
int StoreFrameIndex;
|
||||
unsigned StoreVReg = TII->isStoreToStackSlot(*UI, StoreFrameIndex);
|
||||
if (StoreVReg != (*LI)->reg || StoreFrameIndex != FrameIndex) {
|
||||
NonRestore = false;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NonRestore) continue;
|
||||
unsigned SpillCount = getNumberOfSpills(VNUseCount[CurrVN],
|
||||
(*LI)->reg, FrameIndex);
|
||||
if (SpillCount != VNUseCount[CurrVN].size()) continue;
|
||||
|
||||
for (SmallPtrSet<MachineInstr*, 4>::iterator UI =
|
||||
VNUseCount[CurrVN].begin(), UE = VNUseCount[CurrVN].end();
|
||||
@ -1446,7 +1455,6 @@ bool PreAllocSplitting::removeDeadSpills(SmallPtrSet<LiveInterval*, 8>& split) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user