mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Let shrinkToUses optionally return a list of now dead machine instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -159,7 +159,9 @@ namespace llvm {
|
|||||||
/// range to just the remaining uses. This method does not compute reaching
|
/// range to just the remaining uses. This method does not compute reaching
|
||||||
/// defs for new uses, and it doesn't remove dead defs.
|
/// defs for new uses, and it doesn't remove dead defs.
|
||||||
/// Dead PHIDef values are marked as unused.
|
/// Dead PHIDef values are marked as unused.
|
||||||
void shrinkToUses(LiveInterval *li);
|
/// New dead machine instructions are added to the dead vector.
|
||||||
|
void shrinkToUses(LiveInterval *li,
|
||||||
|
SmallVectorImpl<MachineInstr*> *dead = 0);
|
||||||
|
|
||||||
// Interval removal
|
// Interval removal
|
||||||
|
|
||||||
|
@@ -746,7 +746,8 @@ LiveInterval* LiveIntervals::dupInterval(LiveInterval *li) {
|
|||||||
/// shrinkToUses - After removing some uses of a register, shrink its live
|
/// shrinkToUses - After removing some uses of a register, shrink its live
|
||||||
/// range to just the remaining uses. This method does not compute reaching
|
/// range to just the remaining uses. This method does not compute reaching
|
||||||
/// defs for new uses, and it doesn't remove dead defs.
|
/// defs for new uses, and it doesn't remove dead defs.
|
||||||
void LiveIntervals::shrinkToUses(LiveInterval *li) {
|
void LiveIntervals::shrinkToUses(LiveInterval *li,
|
||||||
|
SmallVectorImpl<MachineInstr*> *dead) {
|
||||||
DEBUG(dbgs() << "Shrink: " << *li << '\n');
|
DEBUG(dbgs() << "Shrink: " << *li << '\n');
|
||||||
assert(TargetRegisterInfo::isVirtualRegister(li->reg)
|
assert(TargetRegisterInfo::isVirtualRegister(li->reg)
|
||||||
&& "Can't only shrink physical registers");
|
&& "Can't only shrink physical registers");
|
||||||
@@ -852,6 +853,10 @@ void LiveIntervals::shrinkToUses(LiveInterval *li) {
|
|||||||
MachineInstr *MI = getInstructionFromIndex(VNI->def);
|
MachineInstr *MI = getInstructionFromIndex(VNI->def);
|
||||||
assert(MI && "No instruction defining live value");
|
assert(MI && "No instruction defining live value");
|
||||||
MI->addRegisterDead(li->reg, tri_);
|
MI->addRegisterDead(li->reg, tri_);
|
||||||
|
if (dead && MI->allDefsAreDead()) {
|
||||||
|
DEBUG(dbgs() << "All defs dead: " << *MI);
|
||||||
|
dead->push_back(MI);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user