mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Don't use nextIndex to check for live out of instruction.
Insert copy after defining instruction. Fix LiveIntervalMap::extendTo to properly handle live segments starting before the current basic block. Make sure the open live range is extended to the inserted copy's use slot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115665 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9c3aa4d4cd
commit
fc60d7729b
@ -521,7 +521,7 @@ VNInfo *LiveIntervalMap::extendTo(MachineBasicBlock *MBB, SlotIndex Idx) {
|
|||||||
if (I == li_->begin())
|
if (I == li_->begin())
|
||||||
return 0;
|
return 0;
|
||||||
--I;
|
--I;
|
||||||
if (I->start < lis_.getMBBStartIdx(MBB))
|
if (I->end <= lis_.getMBBStartIdx(MBB))
|
||||||
return 0;
|
return 0;
|
||||||
if (I->end <= Idx)
|
if (I->end <= Idx)
|
||||||
I->end = Idx.getNextSlot();
|
I->end = Idx.getNextSlot();
|
||||||
@ -703,23 +703,20 @@ void SplitEditor::leaveIntvAfter(SlotIndex Idx) {
|
|||||||
assert(openli_.getLI() && "openIntv not called before leaveIntvAfter");
|
assert(openli_.getLI() && "openIntv not called before leaveIntvAfter");
|
||||||
|
|
||||||
// The interval must be live beyond the instruction at Idx.
|
// The interval must be live beyond the instruction at Idx.
|
||||||
SlotIndex EndIdx = Idx.getNextIndex().getBaseIndex();
|
VNInfo *ParentVNI = curli_->getVNInfoAt(Idx.getBoundaryIndex());
|
||||||
VNInfo *ParentVNI = curli_->getVNInfoAt(EndIdx);
|
|
||||||
if (!ParentVNI) {
|
if (!ParentVNI) {
|
||||||
DEBUG(dbgs() << " leaveIntvAfter " << Idx << ": not live\n");
|
DEBUG(dbgs() << " leaveIntvAfter " << Idx << ": not live\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineInstr *MI = lis_.getInstructionFromIndex(Idx);
|
MachineBasicBlock::iterator MII = lis_.getInstructionFromIndex(Idx);
|
||||||
assert(MI && "leaveIntvAfter called with invalid index");
|
MachineBasicBlock *MBB = MII->getParent();
|
||||||
|
VNInfo *VNI = dupli_.defByCopyFrom(openli_.getLI()->reg, ParentVNI, *MBB,
|
||||||
VNInfo *VNI = dupli_.defByCopyFrom(openli_.getLI()->reg, ParentVNI,
|
llvm::next(MII));
|
||||||
*MI->getParent(), MI);
|
|
||||||
|
|
||||||
// Finally we must make sure that openli is properly extended from Idx to the
|
// Finally we must make sure that openli is properly extended from Idx to the
|
||||||
// new copy.
|
// new copy.
|
||||||
openli_.mapValue(ParentVNI, VNI->def.getUseIndex());
|
openli_.addSimpleRange(Idx.getBoundaryIndex(), VNI->def, ParentVNI);
|
||||||
|
|
||||||
DEBUG(dbgs() << " leaveIntvAfter " << Idx << ": " << *openli_.getLI()
|
DEBUG(dbgs() << " leaveIntvAfter " << Idx << ": " << *openli_.getLI()
|
||||||
<< '\n');
|
<< '\n');
|
||||||
}
|
}
|
||||||
@ -744,8 +741,7 @@ void SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) {
|
|||||||
|
|
||||||
// Finally we must make sure that openli is properly extended from Start to
|
// Finally we must make sure that openli is properly extended from Start to
|
||||||
// the new copy.
|
// the new copy.
|
||||||
openli_.mapValue(ParentVNI, VNI->def.getUseIndex());
|
openli_.addSimpleRange(Start, VNI->def, ParentVNI);
|
||||||
|
|
||||||
DEBUG(dbgs() << " leaveIntvAtTop at " << Start << ": " << *openli_.getLI()
|
DEBUG(dbgs() << " leaveIntvAtTop at " << Start << ": " << *openli_.getLI()
|
||||||
<< '\n');
|
<< '\n');
|
||||||
}
|
}
|
||||||
|
@ -161,11 +161,6 @@ class LiveIntervalMap {
|
|||||||
// values not present (unknown/unmapped).
|
// values not present (unknown/unmapped).
|
||||||
ValueMap valueMap_;
|
ValueMap valueMap_;
|
||||||
|
|
||||||
// extendTo - Find the last li_ value defined in MBB at or before Idx. The
|
|
||||||
// parentli is assumed to be live at Idx. Extend the live range to include
|
|
||||||
// Idx. Return the found VNInfo, or NULL.
|
|
||||||
VNInfo *extendTo(MachineBasicBlock *MBB, SlotIndex Idx);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LiveIntervalMap(LiveIntervals &lis,
|
LiveIntervalMap(LiveIntervals &lis,
|
||||||
const LiveInterval &parentli)
|
const LiveInterval &parentli)
|
||||||
@ -194,6 +189,11 @@ public:
|
|||||||
/// mapped value.
|
/// mapped value.
|
||||||
VNInfo *mapValue(const VNInfo *ParentVNI, SlotIndex Idx, bool *simple = 0);
|
VNInfo *mapValue(const VNInfo *ParentVNI, SlotIndex Idx, bool *simple = 0);
|
||||||
|
|
||||||
|
// extendTo - Find the last li_ value defined in MBB at or before Idx. The
|
||||||
|
// parentli is assumed to be live at Idx. Extend the live range to include
|
||||||
|
// Idx. Return the found VNInfo, or NULL.
|
||||||
|
VNInfo *extendTo(MachineBasicBlock *MBB, SlotIndex Idx);
|
||||||
|
|
||||||
/// isMapped - Return true is ParentVNI is a known mapped value. It may be a
|
/// isMapped - Return true is ParentVNI is a known mapped value. It may be a
|
||||||
/// simple 1-1 mapping or a complex mapping to later defs.
|
/// simple 1-1 mapping or a complex mapping to later defs.
|
||||||
bool isMapped(const VNInfo *ParentVNI) const {
|
bool isMapped(const VNInfo *ParentVNI) const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user