mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
Add some asserts that the list of intervals returned by addIntervalsForSpills
is sorted. This is not the case currently, which is causing no end of problems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14990 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -386,18 +386,42 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
|
|||||||
int slot = vrm_->assignVirt2StackSlot(cur->reg);
|
int slot = vrm_->assignVirt2StackSlot(cur->reg);
|
||||||
std::vector<LiveInterval*> added =
|
std::vector<LiveInterval*> added =
|
||||||
li_->addIntervalsForSpills(*cur, *vrm_, slot);
|
li_->addIntervalsForSpills(*cur, *vrm_, slot);
|
||||||
|
if (added.empty())
|
||||||
|
return; // Early exit if all spills were folded.
|
||||||
|
#ifndef NDEBUG
|
||||||
|
int OldStart = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
// merge added with unhandled
|
// Merge added with unhandled. Note that we know that
|
||||||
|
// addIntervalsForSpills returns intervals sorted by their starting
|
||||||
|
// point.
|
||||||
std::vector<LiveInterval*>::iterator addedIt = added.begin();
|
std::vector<LiveInterval*>::iterator addedIt = added.begin();
|
||||||
std::vector<LiveInterval*>::iterator addedItEnd = added.end();
|
std::vector<LiveInterval*>::iterator addedItEnd = added.end();
|
||||||
for (IntervalPtrs::iterator i = unhandled_.begin(), e = unhandled_.end();
|
for (IntervalPtrs::iterator i = unhandled_.begin(), e =unhandled_.end();
|
||||||
i != e && addedIt != addedItEnd; ++i) {
|
i != e && addedIt != addedItEnd; ++i) {
|
||||||
if ((*i)->start() > (*addedIt)->start())
|
while ((*i)->start() > (*addedIt)->start() &&
|
||||||
|
addedIt != addedItEnd) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
// This code only works if addIntervalsForSpills retursn a
|
||||||
|
// sorted interval list. Assert this is the case now.
|
||||||
|
assert(OldStart <= (int)(*addedIt)->start() &&
|
||||||
|
"addIntervalsForSpills didn't return sorted interval list!");
|
||||||
|
OldStart = (*addedIt)->start();
|
||||||
|
#endif
|
||||||
i = unhandled_.insert(i, *(addedIt++));
|
i = unhandled_.insert(i, *(addedIt++));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (addedIt != addedItEnd)
|
|
||||||
unhandled_.push_back(*(addedIt++));
|
|
||||||
|
|
||||||
|
while (addedIt != addedItEnd) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
// This code only works if addIntervalsForSpills retursn a
|
||||||
|
// sorted interval list. Assert this is the case now.
|
||||||
|
assert(OldStart <= (int)(*addedIt)->start() &&
|
||||||
|
"addIntervalsForSpills didn't return sorted interval list!");
|
||||||
|
OldStart = (*addedIt)->start();
|
||||||
|
#endif
|
||||||
|
unhandled_.push_back(*(addedIt++));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user