mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Make SpillIs an optional pointer. Avoid creating a bunch of temporary SmallVectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127388 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
581d535af9
commit
38f6bd0fc8
@ -274,7 +274,7 @@ namespace llvm {
|
|||||||
/// (if any is created) by reference. This is temporary.
|
/// (if any is created) by reference. This is temporary.
|
||||||
std::vector<LiveInterval*>
|
std::vector<LiveInterval*>
|
||||||
addIntervalsForSpills(const LiveInterval& i,
|
addIntervalsForSpills(const LiveInterval& i,
|
||||||
const SmallVectorImpl<LiveInterval*> &SpillIs,
|
const SmallVectorImpl<LiveInterval*> *SpillIs,
|
||||||
const MachineLoopInfo *loopInfo, VirtRegMap& vrm);
|
const MachineLoopInfo *loopInfo, VirtRegMap& vrm);
|
||||||
|
|
||||||
/// spillPhysRegAroundRegDefsUses - Spill the specified physical register
|
/// spillPhysRegAroundRegDefsUses - Spill the specified physical register
|
||||||
@ -287,7 +287,7 @@ namespace llvm {
|
|||||||
/// val# of the specified interval is re-materializable. Also returns true
|
/// val# of the specified interval is re-materializable. Also returns true
|
||||||
/// by reference if all of the defs are load instructions.
|
/// by reference if all of the defs are load instructions.
|
||||||
bool isReMaterializable(const LiveInterval &li,
|
bool isReMaterializable(const LiveInterval &li,
|
||||||
const SmallVectorImpl<LiveInterval*> &SpillIs,
|
const SmallVectorImpl<LiveInterval*> *SpillIs,
|
||||||
bool &isLoad);
|
bool &isLoad);
|
||||||
|
|
||||||
/// isReMaterializable - Returns true if the definition MI of the specified
|
/// isReMaterializable - Returns true if the definition MI of the specified
|
||||||
@ -374,7 +374,7 @@ namespace llvm {
|
|||||||
/// by reference if the def is a load.
|
/// by reference if the def is a load.
|
||||||
bool isReMaterializable(const LiveInterval &li, const VNInfo *ValNo,
|
bool isReMaterializable(const LiveInterval &li, const VNInfo *ValNo,
|
||||||
MachineInstr *MI,
|
MachineInstr *MI,
|
||||||
const SmallVectorImpl<LiveInterval*> &SpillIs,
|
const SmallVectorImpl<LiveInterval*> *SpillIs,
|
||||||
bool &isLoad);
|
bool &isLoad);
|
||||||
|
|
||||||
/// tryFoldMemoryOperand - Attempts to fold either a spill / restore from
|
/// tryFoldMemoryOperand - Attempts to fold either a spill / restore from
|
||||||
|
@ -166,8 +166,7 @@ void VirtRegAuxInfo::CalculateWeightAndHint(LiveInterval &li) {
|
|||||||
// FIXME: this gets much more complicated once we support non-trivial
|
// FIXME: this gets much more complicated once we support non-trivial
|
||||||
// re-materialization.
|
// re-materialization.
|
||||||
bool isLoad = false;
|
bool isLoad = false;
|
||||||
SmallVector<LiveInterval*, 4> spillIs;
|
if (lis_.isReMaterializable(li, 0, isLoad)) {
|
||||||
if (lis_.isReMaterializable(li, spillIs, isLoad)) {
|
|
||||||
if (isLoad)
|
if (isLoad)
|
||||||
totalWeight *= 0.9F;
|
totalWeight *= 0.9F;
|
||||||
else
|
else
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
|
|
||||||
void spill(LiveInterval *li,
|
void spill(LiveInterval *li,
|
||||||
SmallVectorImpl<LiveInterval*> &newIntervals,
|
SmallVectorImpl<LiveInterval*> &newIntervals,
|
||||||
const SmallVectorImpl<LiveInterval*> &spillIs);
|
const SmallVectorImpl<LiveInterval*> *spillIs);
|
||||||
|
|
||||||
void spill(LiveRangeEdit &);
|
void spill(LiveRangeEdit &);
|
||||||
|
|
||||||
@ -332,8 +332,8 @@ void InlineSpiller::insertSpill(LiveInterval &NewLI,
|
|||||||
|
|
||||||
void InlineSpiller::spill(LiveInterval *li,
|
void InlineSpiller::spill(LiveInterval *li,
|
||||||
SmallVectorImpl<LiveInterval*> &newIntervals,
|
SmallVectorImpl<LiveInterval*> &newIntervals,
|
||||||
const SmallVectorImpl<LiveInterval*> &spillIs) {
|
const SmallVectorImpl<LiveInterval*> *spillIs) {
|
||||||
LiveRangeEdit edit(*li, newIntervals, 0, &spillIs);
|
LiveRangeEdit edit(*li, newIntervals, 0, spillIs);
|
||||||
spill(edit);
|
spill(edit);
|
||||||
if (VerifySpills)
|
if (VerifySpills)
|
||||||
mf_.verify(&pass_, "After inline spill");
|
mf_.verify(&pass_, "After inline spill");
|
||||||
|
@ -956,7 +956,7 @@ bool LiveIntervals::isValNoAvailableAt(const LiveInterval &li, MachineInstr *MI,
|
|||||||
bool
|
bool
|
||||||
LiveIntervals::isReMaterializable(const LiveInterval &li,
|
LiveIntervals::isReMaterializable(const LiveInterval &li,
|
||||||
const VNInfo *ValNo, MachineInstr *MI,
|
const VNInfo *ValNo, MachineInstr *MI,
|
||||||
const SmallVectorImpl<LiveInterval*> &SpillIs,
|
const SmallVectorImpl<LiveInterval*> *SpillIs,
|
||||||
bool &isLoad) {
|
bool &isLoad) {
|
||||||
if (DisableReMat)
|
if (DisableReMat)
|
||||||
return false;
|
return false;
|
||||||
@ -983,9 +983,10 @@ LiveIntervals::isReMaterializable(const LiveInterval &li,
|
|||||||
|
|
||||||
// If a register operand of the re-materialized instruction is going to
|
// If a register operand of the re-materialized instruction is going to
|
||||||
// be spilled next, then it's not legal to re-materialize this instruction.
|
// be spilled next, then it's not legal to re-materialize this instruction.
|
||||||
for (unsigned i = 0, e = SpillIs.size(); i != e; ++i)
|
if (SpillIs)
|
||||||
if (ImpUse == SpillIs[i]->reg)
|
for (unsigned i = 0, e = SpillIs->size(); i != e; ++i)
|
||||||
return false;
|
if (ImpUse == (*SpillIs)[i]->reg)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -994,16 +995,15 @@ LiveIntervals::isReMaterializable(const LiveInterval &li,
|
|||||||
/// val# of the specified interval is re-materializable.
|
/// val# of the specified interval is re-materializable.
|
||||||
bool LiveIntervals::isReMaterializable(const LiveInterval &li,
|
bool LiveIntervals::isReMaterializable(const LiveInterval &li,
|
||||||
const VNInfo *ValNo, MachineInstr *MI) {
|
const VNInfo *ValNo, MachineInstr *MI) {
|
||||||
SmallVector<LiveInterval*, 4> Dummy1;
|
|
||||||
bool Dummy2;
|
bool Dummy2;
|
||||||
return isReMaterializable(li, ValNo, MI, Dummy1, Dummy2);
|
return isReMaterializable(li, ValNo, MI, 0, Dummy2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isReMaterializable - Returns true if every definition of MI of every
|
/// isReMaterializable - Returns true if every definition of MI of every
|
||||||
/// val# of the specified interval is re-materializable.
|
/// val# of the specified interval is re-materializable.
|
||||||
bool
|
bool
|
||||||
LiveIntervals::isReMaterializable(const LiveInterval &li,
|
LiveIntervals::isReMaterializable(const LiveInterval &li,
|
||||||
const SmallVectorImpl<LiveInterval*> &SpillIs,
|
const SmallVectorImpl<LiveInterval*> *SpillIs,
|
||||||
bool &isLoad) {
|
bool &isLoad) {
|
||||||
isLoad = false;
|
isLoad = false;
|
||||||
for (LiveInterval::const_vni_iterator i = li.vni_begin(), e = li.vni_end();
|
for (LiveInterval::const_vni_iterator i = li.vni_begin(), e = li.vni_end();
|
||||||
@ -1716,7 +1716,7 @@ static void normalizeSpillWeights(std::vector<LiveInterval*> &NewLIs) {
|
|||||||
|
|
||||||
std::vector<LiveInterval*> LiveIntervals::
|
std::vector<LiveInterval*> LiveIntervals::
|
||||||
addIntervalsForSpills(const LiveInterval &li,
|
addIntervalsForSpills(const LiveInterval &li,
|
||||||
const SmallVectorImpl<LiveInterval*> &SpillIs,
|
const SmallVectorImpl<LiveInterval*> *SpillIs,
|
||||||
const MachineLoopInfo *loopInfo, VirtRegMap &vrm) {
|
const MachineLoopInfo *loopInfo, VirtRegMap &vrm) {
|
||||||
assert(li.isSpillable() && "attempt to spill already spilled interval!");
|
assert(li.isSpillable() && "attempt to spill already spilled interval!");
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ void RegAllocBase::spillReg(LiveInterval& VirtReg, unsigned PhysReg,
|
|||||||
unassign(SpilledVReg, PhysReg);
|
unassign(SpilledVReg, PhysReg);
|
||||||
|
|
||||||
// Spill the extracted interval.
|
// Spill the extracted interval.
|
||||||
spiller().spill(&SpilledVReg, SplitVRegs, PendingSpills);
|
spiller().spill(&SpilledVReg, SplitVRegs, &PendingSpills);
|
||||||
}
|
}
|
||||||
// After extracting segments, the query's results are invalid. But keep the
|
// After extracting segments, the query's results are invalid. But keep the
|
||||||
// contents valid until we're done accessing pendingSpills.
|
// contents valid until we're done accessing pendingSpills.
|
||||||
@ -469,9 +469,7 @@ unsigned RABasic::selectOrSplit(LiveInterval &VirtReg,
|
|||||||
}
|
}
|
||||||
// No other spill candidates were found, so spill the current VirtReg.
|
// No other spill candidates were found, so spill the current VirtReg.
|
||||||
DEBUG(dbgs() << "spilling: " << VirtReg << '\n');
|
DEBUG(dbgs() << "spilling: " << VirtReg << '\n');
|
||||||
SmallVector<LiveInterval*, 1> pendingSpills;
|
spiller().spill(&VirtReg, SplitVRegs, 0);
|
||||||
|
|
||||||
spiller().spill(&VirtReg, SplitVRegs, pendingSpills);
|
|
||||||
|
|
||||||
// The live virtual register requesting allocation was spilled, so tell
|
// The live virtual register requesting allocation was spilled, so tell
|
||||||
// the caller not to allocate anything during this round.
|
// the caller not to allocate anything during this round.
|
||||||
|
@ -1253,8 +1253,7 @@ unsigned RAGreedy::selectOrSplit(LiveInterval &VirtReg,
|
|||||||
|
|
||||||
// Finally spill VirtReg itself.
|
// Finally spill VirtReg itself.
|
||||||
NamedRegionTimer T("Spiller", TimerGroupName, TimePassesIsEnabled);
|
NamedRegionTimer T("Spiller", TimerGroupName, TimePassesIsEnabled);
|
||||||
SmallVector<LiveInterval*, 1> pendingSpills;
|
spiller().spill(&VirtReg, NewVRegs, 0);
|
||||||
spiller().spill(&VirtReg, NewVRegs, pendingSpills);
|
|
||||||
|
|
||||||
// The live virtual register requesting allocation was spilled, so tell
|
// The live virtual register requesting allocation was spilled, so tell
|
||||||
// the caller not to allocate anything during this round.
|
// the caller not to allocate anything during this round.
|
||||||
|
@ -1229,8 +1229,8 @@ void RALinScan::assignRegOrStackSlotAtInterval(LiveInterval* cur) {
|
|||||||
// linearscan.
|
// linearscan.
|
||||||
if (cur->weight != HUGE_VALF && cur->weight <= minWeight) {
|
if (cur->weight != HUGE_VALF && cur->weight <= minWeight) {
|
||||||
DEBUG(dbgs() << "\t\t\tspilling(c): " << *cur << '\n');
|
DEBUG(dbgs() << "\t\t\tspilling(c): " << *cur << '\n');
|
||||||
SmallVector<LiveInterval*, 8> spillIs, added;
|
SmallVector<LiveInterval*, 8> added;
|
||||||
spiller_->spill(cur, added, spillIs);
|
spiller_->spill(cur, added, 0);
|
||||||
|
|
||||||
std::sort(added.begin(), added.end(), LISorter());
|
std::sort(added.begin(), added.end(), LISorter());
|
||||||
if (added.empty())
|
if (added.empty())
|
||||||
@ -1306,7 +1306,7 @@ void RALinScan::assignRegOrStackSlotAtInterval(LiveInterval* cur) {
|
|||||||
DEBUG(dbgs() << "\t\t\tspilling(a): " << *sli << '\n');
|
DEBUG(dbgs() << "\t\t\tspilling(a): " << *sli << '\n');
|
||||||
if (sli->beginIndex() < earliestStart)
|
if (sli->beginIndex() < earliestStart)
|
||||||
earliestStart = sli->beginIndex();
|
earliestStart = sli->beginIndex();
|
||||||
spiller_->spill(sli, added, spillIs);
|
spiller_->spill(sli, added, &spillIs);
|
||||||
spilled.insert(sli->reg);
|
spilled.insert(sli->reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,10 +534,9 @@ bool RegAllocPBQP::mapPBQPToRegAlloc(const PBQPRAProblem &problem,
|
|||||||
vregsToAlloc.erase(vreg);
|
vregsToAlloc.erase(vreg);
|
||||||
const LiveInterval* spillInterval = &lis->getInterval(vreg);
|
const LiveInterval* spillInterval = &lis->getInterval(vreg);
|
||||||
double oldWeight = spillInterval->weight;
|
double oldWeight = spillInterval->weight;
|
||||||
SmallVector<LiveInterval*, 8> spillIs;
|
|
||||||
rmf->rememberUseDefs(spillInterval);
|
rmf->rememberUseDefs(spillInterval);
|
||||||
std::vector<LiveInterval*> newSpills =
|
std::vector<LiveInterval*> newSpills =
|
||||||
lis->addIntervalsForSpills(*spillInterval, spillIs, loopInfo, *vrm);
|
lis->addIntervalsForSpills(*spillInterval, 0, loopInfo, *vrm);
|
||||||
addStackInterval(spillInterval, mri);
|
addStackInterval(spillInterval, mri);
|
||||||
rmf->rememberSpills(spillInterval, newSpills);
|
rmf->rememberSpills(spillInterval, newSpills);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ public:
|
|||||||
|
|
||||||
void spill(LiveInterval *li,
|
void spill(LiveInterval *li,
|
||||||
SmallVectorImpl<LiveInterval*> &newIntervals,
|
SmallVectorImpl<LiveInterval*> &newIntervals,
|
||||||
const SmallVectorImpl<LiveInterval*> &) {
|
const SmallVectorImpl<LiveInterval*>*) {
|
||||||
// Ignore spillIs - we don't use it.
|
// Ignore spillIs - we don't use it.
|
||||||
trivialSpillEverywhere(li, newIntervals);
|
trivialSpillEverywhere(li, newIntervals);
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ public:
|
|||||||
/// Falls back on LiveIntervals::addIntervalsForSpills.
|
/// Falls back on LiveIntervals::addIntervalsForSpills.
|
||||||
void spill(LiveInterval *li,
|
void spill(LiveInterval *li,
|
||||||
SmallVectorImpl<LiveInterval*> &newIntervals,
|
SmallVectorImpl<LiveInterval*> &newIntervals,
|
||||||
const SmallVectorImpl<LiveInterval*> &spillIs) {
|
const SmallVectorImpl<LiveInterval*> *spillIs) {
|
||||||
std::vector<LiveInterval*> added =
|
std::vector<LiveInterval*> added =
|
||||||
lis->addIntervalsForSpills(*li, spillIs, loopInfo, *vrm);
|
lis->addIntervalsForSpills(*li, spillIs, loopInfo, *vrm);
|
||||||
newIntervals.insert(newIntervals.end(), added.begin(), added.end());
|
newIntervals.insert(newIntervals.end(), added.begin(), added.end());
|
||||||
|
@ -36,7 +36,7 @@ namespace llvm {
|
|||||||
/// @param newIntervals The newly created intervals will be appended here.
|
/// @param newIntervals The newly created intervals will be appended here.
|
||||||
virtual void spill(LiveInterval *li,
|
virtual void spill(LiveInterval *li,
|
||||||
SmallVectorImpl<LiveInterval*> &newIntervals,
|
SmallVectorImpl<LiveInterval*> &newIntervals,
|
||||||
const SmallVectorImpl<LiveInterval*> &spillIs) = 0;
|
const SmallVectorImpl<LiveInterval*> *spillIs) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user