mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Fold open interval ends handling into
LiveIntervals::Interval::expiredAt() and simplify regalloc code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10894 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1893a05b28
commit
3b02cbe752
@ -57,7 +57,7 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool expiredAt(unsigned index) const {
|
bool expiredAt(unsigned index) const {
|
||||||
return end() <= index;
|
return end() <= (index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool liveAt(unsigned index) const;
|
bool liveAt(unsigned index) const;
|
||||||
|
@ -57,7 +57,7 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool expiredAt(unsigned index) const {
|
bool expiredAt(unsigned index) const {
|
||||||
return end() <= index;
|
return end() <= (index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool liveAt(unsigned index) const;
|
bool liveAt(unsigned index) const;
|
||||||
|
@ -57,7 +57,7 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool expiredAt(unsigned index) const {
|
bool expiredAt(unsigned index) const {
|
||||||
return end() <= index;
|
return end() <= (index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool liveAt(unsigned index) const;
|
bool liveAt(unsigned index) const;
|
||||||
|
@ -428,11 +428,8 @@ void RA::processActiveIntervals(IntervalPtrs::value_type cur)
|
|||||||
DEBUG(std::cerr << "\tprocessing active intervals:\n");
|
DEBUG(std::cerr << "\tprocessing active intervals:\n");
|
||||||
for (IntervalPtrs::iterator i = active_.begin(); i != active_.end();) {
|
for (IntervalPtrs::iterator i = active_.begin(); i != active_.end();) {
|
||||||
unsigned reg = (*i)->reg;
|
unsigned reg = (*i)->reg;
|
||||||
// remove expired intervals. we expire earlier because this if
|
// remove expired intervals
|
||||||
// an interval expires this is going to be the last use. in
|
if ((*i)->expiredAt(cur->start())) {
|
||||||
// this case we can reuse the register for a def in the same
|
|
||||||
// instruction
|
|
||||||
if ((*i)->expiredAt(cur->start() + 1)) {
|
|
||||||
DEBUG(std::cerr << "\t\tinterval " << **i << " expired\n");
|
DEBUG(std::cerr << "\t\tinterval " << **i << " expired\n");
|
||||||
if (reg >= MRegisterInfo::FirstVirtualRegister) {
|
if (reg >= MRegisterInfo::FirstVirtualRegister) {
|
||||||
reg = v2pMap_[reg];
|
reg = v2pMap_[reg];
|
||||||
@ -465,11 +462,8 @@ void RA::processInactiveIntervals(IntervalPtrs::value_type cur)
|
|||||||
for (IntervalPtrs::iterator i = inactive_.begin(); i != inactive_.end();) {
|
for (IntervalPtrs::iterator i = inactive_.begin(); i != inactive_.end();) {
|
||||||
unsigned reg = (*i)->reg;
|
unsigned reg = (*i)->reg;
|
||||||
|
|
||||||
// remove expired intervals. we expire earlier because this if
|
// remove expired intervals
|
||||||
// an interval expires this is going to be the last use. in
|
if ((*i)->expiredAt(cur->start())) {
|
||||||
// this case we can reuse the register for a def in the same
|
|
||||||
// instruction
|
|
||||||
if ((*i)->expiredAt(cur->start() + 1)) {
|
|
||||||
DEBUG(std::cerr << "\t\t\tinterval " << **i << " expired\n");
|
DEBUG(std::cerr << "\t\t\tinterval " << **i << " expired\n");
|
||||||
// remove from inactive
|
// remove from inactive
|
||||||
i = inactive_.erase(i);
|
i = inactive_.erase(i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user