mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
Change implementation of LiveIntervals::overlap(). This results in a
30-50% decrease in running time of the linear scan register allocator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10707 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f6608ddf44
commit
80b378cf7c
@ -386,17 +386,29 @@ bool LiveIntervals::Interval::liveAt(unsigned index) const
|
|||||||
|
|
||||||
bool LiveIntervals::Interval::overlaps(const Interval& other) const
|
bool LiveIntervals::Interval::overlaps(const Interval& other) const
|
||||||
{
|
{
|
||||||
std::vector<bool> bitMap(end(), false);
|
Ranges::const_iterator i = ranges.begin();
|
||||||
for (Ranges::const_iterator r = ranges.begin(); r != ranges.end(); ++r) {
|
Ranges::const_iterator j = other.ranges.begin();
|
||||||
for (unsigned i = r->first; i < r->second; ++i)
|
|
||||||
bitMap[i] = true;
|
while (i != ranges.end() && j != other.ranges.end()) {
|
||||||
}
|
if (i->first < j->first) {
|
||||||
for (Ranges::const_iterator r = other.ranges.begin();
|
if (i->second > j->first) {
|
||||||
r != other.ranges.end(); ++r) {
|
|
||||||
for (unsigned i = r->first;
|
|
||||||
i < r->second && i < bitMap.size(); ++i)
|
|
||||||
if (bitMap[i])
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (j->first < i->first) {
|
||||||
|
if (j->second > i->first) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user