mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-04 11:17:31 +00:00
Set weight of zero length intervals to infinite to prevent them from being
spilled. llvm-svn: 28220
This commit is contained in:
parent
da04c3aab4
commit
7028ff2e25
@ -80,6 +80,15 @@ void LiveIntervals::releaseMemory()
|
||||
}
|
||||
|
||||
|
||||
static bool isZeroLengthInterval(LiveInterval *li) {
|
||||
for (LiveInterval::Ranges::const_iterator
|
||||
i = li->ranges.begin(), e = li->ranges.end(); i != e; ++i)
|
||||
if (i->end - i->start > LiveIntervals::InstrSlots::NUM)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// runOnMachineFunction - Register allocate the whole function
|
||||
///
|
||||
bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
||||
@ -199,6 +208,16 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
||||
}
|
||||
}
|
||||
|
||||
for (iterator I = begin(), E = end(); I != E; ++I) {
|
||||
LiveInterval &li = I->second;
|
||||
if (MRegisterInfo::isVirtualRegister(li.reg))
|
||||
// If the live interval legnth is essentially zero, i.e. in every live
|
||||
// range the use follows def immediately, it doesn't make sense to spill
|
||||
// it and hope it will be easier to allocate for this li.
|
||||
if (isZeroLengthInterval(&li))
|
||||
li.weight = float(HUGE_VAL);
|
||||
}
|
||||
|
||||
DEBUG(dump());
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user