mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Abstract merging of ranges away from number of slots per instruction.
Also make it less aggressive as the current implementation breaks in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11696 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0ad9170327
commit
7200c6b82a
@ -126,7 +126,10 @@ namespace llvm {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned getBaseIndex(unsigned index) {
|
static unsigned getBaseIndex(unsigned index) {
|
||||||
return index - (index % 4);
|
return index - (index % InstrSlots::NUM);
|
||||||
|
}
|
||||||
|
static unsigned getBoundaryIndex(unsigned index) {
|
||||||
|
return getBaseIndex(index + InstrSlots::NUM - 1);
|
||||||
}
|
}
|
||||||
static unsigned getLoadIndex(unsigned index) {
|
static unsigned getLoadIndex(unsigned index) {
|
||||||
return getBaseIndex(index) + InstrSlots::LOAD;
|
return getBaseIndex(index) + InstrSlots::LOAD;
|
||||||
|
@ -126,7 +126,10 @@ namespace llvm {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned getBaseIndex(unsigned index) {
|
static unsigned getBaseIndex(unsigned index) {
|
||||||
return index - (index % 4);
|
return index - (index % InstrSlots::NUM);
|
||||||
|
}
|
||||||
|
static unsigned getBoundaryIndex(unsigned index) {
|
||||||
|
return getBaseIndex(index + InstrSlots::NUM - 1);
|
||||||
}
|
}
|
||||||
static unsigned getLoadIndex(unsigned index) {
|
static unsigned getLoadIndex(unsigned index) {
|
||||||
return getBaseIndex(index) + InstrSlots::LOAD;
|
return getBaseIndex(index) + InstrSlots::LOAD;
|
||||||
|
@ -227,6 +227,7 @@ void LiveIntervals::updateSpilledInterval(Interval& li, int slot)
|
|||||||
// the new spill weight is now infinity as it cannot be spilled again
|
// the new spill weight is now infinity as it cannot be spilled again
|
||||||
li.weight = std::numeric_limits<float>::infinity();
|
li.weight = std::numeric_limits<float>::infinity();
|
||||||
DEBUG(std::cerr << '\n');
|
DEBUG(std::cerr << '\n');
|
||||||
|
DEBUG(std::cerr << "\t\t\t\tupdated interval: " << li << '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiveIntervals::printRegName(unsigned reg) const
|
void LiveIntervals::printRegName(unsigned reg) const
|
||||||
@ -652,8 +653,10 @@ void LiveIntervals::Interval::join(const LiveIntervals::Interval& other)
|
|||||||
LiveIntervals::Interval::Ranges::iterator
|
LiveIntervals::Interval::Ranges::iterator
|
||||||
LiveIntervals::Interval::mergeRangesForward(Ranges::iterator it)
|
LiveIntervals::Interval::mergeRangesForward(Ranges::iterator it)
|
||||||
{
|
{
|
||||||
for (Ranges::iterator n = next(it);
|
Ranges::iterator n;
|
||||||
n != ranges.end() && ((it->second & 1) + it->second) >= n->first; ) {
|
while ((n = next(it)) != ranges.end()) {
|
||||||
|
if (n->first > it->second)
|
||||||
|
break;
|
||||||
it->second = std::max(it->second, n->second);
|
it->second = std::max(it->second, n->second);
|
||||||
n = ranges.erase(n);
|
n = ranges.erase(n);
|
||||||
}
|
}
|
||||||
@ -665,7 +668,8 @@ LiveIntervals::Interval::mergeRangesBackward(Ranges::iterator it)
|
|||||||
{
|
{
|
||||||
while (it != ranges.begin()) {
|
while (it != ranges.begin()) {
|
||||||
Ranges::iterator p = prior(it);
|
Ranges::iterator p = prior(it);
|
||||||
if (it->first > ((p->second & 1) + p->second)) break;
|
if (it->first > p->second)
|
||||||
|
break;
|
||||||
|
|
||||||
it->first = std::min(it->first, p->first);
|
it->first = std::min(it->first, p->first);
|
||||||
it->second = std::max(it->second, p->second);
|
it->second = std::max(it->second, p->second);
|
||||||
|
@ -126,7 +126,10 @@ namespace llvm {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned getBaseIndex(unsigned index) {
|
static unsigned getBaseIndex(unsigned index) {
|
||||||
return index - (index % 4);
|
return index - (index % InstrSlots::NUM);
|
||||||
|
}
|
||||||
|
static unsigned getBoundaryIndex(unsigned index) {
|
||||||
|
return getBaseIndex(index + InstrSlots::NUM - 1);
|
||||||
}
|
}
|
||||||
static unsigned getLoadIndex(unsigned index) {
|
static unsigned getLoadIndex(unsigned index) {
|
||||||
return getBaseIndex(index) + InstrSlots::LOAD;
|
return getBaseIndex(index) + InstrSlots::LOAD;
|
||||||
|
Loading…
Reference in New Issue
Block a user