Make the set of fixed (preallocated) intervals be a fixed superset of

unhandled + handled. So unhandled is now including all fixed intervals
and fixed intervals never changes when processing a function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12462 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alkis Evlogimenos 2004-03-17 00:48:59 +00:00
parent 50eafbc828
commit eee91172fb

View File

@ -135,9 +135,9 @@ namespace {
void RA::releaseMemory() void RA::releaseMemory()
{ {
unhandled_.clear(); unhandled_.clear();
fixed_.clear();
active_.clear(); active_.clear();
inactive_.clear(); inactive_.clear();
fixed_.clear();
handled_.clear(); handled_.clear();
} }
@ -171,25 +171,10 @@ void RA::linearScan()
DEBUG(printIntervals("active", active_.begin(), active_.end())); DEBUG(printIntervals("active", active_.begin(), active_.end()));
DEBUG(printIntervals("inactive", inactive_.begin(), inactive_.end())); DEBUG(printIntervals("inactive", inactive_.begin(), inactive_.end()));
while (!unhandled_.empty() || !fixed_.empty()) { while (!unhandled_.empty()) {
// pick the interval with the earliest start point // pick the interval with the earliest start point
IntervalPtrs::value_type cur; IntervalPtrs::value_type cur = unhandled_.front();
if (fixed_.empty()) {
cur = unhandled_.front();
unhandled_.pop_front(); unhandled_.pop_front();
}
else if (unhandled_.empty()) {
cur = fixed_.front();
fixed_.pop_front();
}
else if (unhandled_.front()->start() < fixed_.front()->start()) {
cur = unhandled_.front();
unhandled_.pop_front();
}
else {
cur = fixed_.front();
fixed_.pop_front();
}
DEBUG(std::cerr << "\n*** CURRENT ***: " << *cur << '\n'); DEBUG(std::cerr << "\n*** CURRENT ***: " << *cur << '\n');
@ -234,10 +219,9 @@ void RA::initIntervalSets(LiveIntervals::Intervals& li)
for (LiveIntervals::Intervals::iterator i = li.begin(), e = li.end(); for (LiveIntervals::Intervals::iterator i = li.begin(), e = li.end();
i != e; ++i) { i != e; ++i) {
unhandled_.push_back(&*i);
if (MRegisterInfo::isPhysicalRegister(i->reg)) if (MRegisterInfo::isPhysicalRegister(i->reg))
fixed_.push_back(&*i); fixed_.push_back(&*i);
else
unhandled_.push_back(&*i);
} }
} }
@ -444,7 +428,7 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
DEBUG(std::cerr << "\t\trolling back to: " << earliestStart << '\n'); DEBUG(std::cerr << "\t\trolling back to: " << earliestStart << '\n');
// scan handled in reverse order and undo each one, restoring the // scan handled in reverse order and undo each one, restoring the
// state of unhandled and fixed // state of unhandled
while (!handled_.empty()) { while (!handled_.empty()) {
IntervalPtrs::value_type i = handled_.back(); IntervalPtrs::value_type i = handled_.back();
// if this interval starts before t we are done // if this interval starts before t we are done
@ -456,8 +440,8 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
if ((it = find(active_.begin(), active_.end(), i)) != active_.end()) { if ((it = find(active_.begin(), active_.end(), i)) != active_.end()) {
active_.erase(it); active_.erase(it);
if (MRegisterInfo::isPhysicalRegister(i->reg)) { if (MRegisterInfo::isPhysicalRegister(i->reg)) {
fixed_.push_front(i);
prt_->delRegUse(i->reg); prt_->delRegUse(i->reg);
unhandled_.push_front(i);
} }
else { else {
prt_->delRegUse(vrm_->getPhys(i->reg)); prt_->delRegUse(vrm_->getPhys(i->reg));
@ -479,7 +463,7 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
else if ((it = find(inactive_.begin(), inactive_.end(), i)) != inactive_.end()) { else if ((it = find(inactive_.begin(), inactive_.end(), i)) != inactive_.end()) {
inactive_.erase(it); inactive_.erase(it);
if (MRegisterInfo::isPhysicalRegister(i->reg)) if (MRegisterInfo::isPhysicalRegister(i->reg))
fixed_.push_front(i); unhandled_.push_front(i);
else { else {
vrm_->clearVirt(i->reg); vrm_->clearVirt(i->reg);
if (i->spilled()) { if (i->spilled()) {
@ -496,14 +480,11 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
} }
} }
else { else {
if (MRegisterInfo::isPhysicalRegister(i->reg)) if (MRegisterInfo::isVirtualRegister(i->reg))
fixed_.push_front(i);
else {
vrm_->clearVirt(i->reg); vrm_->clearVirt(i->reg);
unhandled_.push_front(i); unhandled_.push_front(i);
} }
} }
}
// scan the rest and undo each interval that expired after t and // scan the rest and undo each interval that expired after t and
// insert it in active (the next iteration of the algorithm will // insert it in active (the next iteration of the algorithm will