mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
Remember to track spill slot uses in VirtRegMap when inserting loads and stores.
LocalRewriter::runOnMachineFunction uses this information to mark dead spill slots. This means that InlineSpiller now also works for functions that spill. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107302 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -95,6 +95,7 @@ void InlineSpiller::spill(LiveInterval *li,
|
|||||||
tii_.loadRegFromStackSlot(*MI->getParent(), MII, NewVReg, SS, RC, &tri_);
|
tii_.loadRegFromStackSlot(*MI->getParent(), MII, NewVReg, SS, RC, &tri_);
|
||||||
--MII; // Point to load instruction.
|
--MII; // Point to load instruction.
|
||||||
SlotIndex LoadIdx = lis_.InsertMachineInstrInMaps(MII).getDefIndex();
|
SlotIndex LoadIdx = lis_.InsertMachineInstrInMaps(MII).getDefIndex();
|
||||||
|
vrm_.addSpillSlotUse(SS, MII);
|
||||||
DEBUG(dbgs() << "\treload: " << LoadIdx << '\t' << *MII);
|
DEBUG(dbgs() << "\treload: " << LoadIdx << '\t' << *MII);
|
||||||
VNInfo *LoadVNI = NewLI.getNextValue(LoadIdx, 0, true,
|
VNInfo *LoadVNI = NewLI.getNextValue(LoadIdx, 0, true,
|
||||||
lis_.getVNInfoAllocator());
|
lis_.getVNInfoAllocator());
|
||||||
@@ -124,6 +125,7 @@ void InlineSpiller::spill(LiveInterval *li,
|
|||||||
&tri_);
|
&tri_);
|
||||||
--MII; // Point to store instruction.
|
--MII; // Point to store instruction.
|
||||||
SlotIndex StoreIdx = lis_.InsertMachineInstrInMaps(MII).getDefIndex();
|
SlotIndex StoreIdx = lis_.InsertMachineInstrInMaps(MII).getDefIndex();
|
||||||
|
vrm_.addSpillSlotUse(SS, MII);
|
||||||
DEBUG(dbgs() << "\tspilled: " << StoreIdx << '\t' << *MII);
|
DEBUG(dbgs() << "\tspilled: " << StoreIdx << '\t' << *MII);
|
||||||
VNInfo *StoreVNI = NewLI.getNextValue(Idx, 0, true,
|
VNInfo *StoreVNI = NewLI.getNextValue(Idx, 0, true,
|
||||||
lis_.getVNInfoAllocator());
|
lis_.getVNInfoAllocator());
|
||||||
|
@@ -137,6 +137,7 @@ protected:
|
|||||||
MachineInstr *loadInstr(prior(miItr));
|
MachineInstr *loadInstr(prior(miItr));
|
||||||
SlotIndex loadIndex =
|
SlotIndex loadIndex =
|
||||||
lis->InsertMachineInstrInMaps(loadInstr).getDefIndex();
|
lis->InsertMachineInstrInMaps(loadInstr).getDefIndex();
|
||||||
|
vrm->addSpilSlotUse(ss, loadInstr);
|
||||||
SlotIndex endIndex = loadIndex.getNextIndex();
|
SlotIndex endIndex = loadIndex.getNextIndex();
|
||||||
VNInfo *loadVNI =
|
VNInfo *loadVNI =
|
||||||
newLI->getNextValue(loadIndex, 0, true, lis->getVNInfoAllocator());
|
newLI->getNextValue(loadIndex, 0, true, lis->getVNInfoAllocator());
|
||||||
@@ -150,6 +151,7 @@ protected:
|
|||||||
MachineInstr *storeInstr(llvm::next(miItr));
|
MachineInstr *storeInstr(llvm::next(miItr));
|
||||||
SlotIndex storeIndex =
|
SlotIndex storeIndex =
|
||||||
lis->InsertMachineInstrInMaps(storeInstr).getDefIndex();
|
lis->InsertMachineInstrInMaps(storeInstr).getDefIndex();
|
||||||
|
vrm->addSpilSlotUse(ss, storeInstr);
|
||||||
SlotIndex beginIndex = storeIndex.getPrevIndex();
|
SlotIndex beginIndex = storeIndex.getPrevIndex();
|
||||||
VNInfo *storeVNI =
|
VNInfo *storeVNI =
|
||||||
newLI->getNextValue(beginIndex, 0, true, lis->getVNInfoAllocator());
|
newLI->getNextValue(beginIndex, 0, true, lis->getVNInfoAllocator());
|
||||||
|
Reference in New Issue
Block a user