summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocLinearScan.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-05-30 07:46:27 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-05-30 07:46:27 +0000
commit6924063bf2fdcc455bcb87807ab452ab7fc69773 (patch)
tree5230d66a408761cea76d447376da0824dffe6960 /lib/CodeGen/RegAllocLinearScan.cpp
parent1da7e8e0b3cfc1d3c399da4cdd7dc5c087c9f0d3 (diff)
downloadllvm-6924063bf2fdcc455bcb87807ab452ab7fc69773.tar.gz
llvm-6924063bf2fdcc455bcb87807ab452ab7fc69773.tar.bz2
llvm-6924063bf2fdcc455bcb87807ab452ab7fc69773.tar.xz
Pull Interval class out of LiveIntervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r--lib/CodeGen/RegAllocLinearScan.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index d8dfaf90c3..bab8717180 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -21,6 +21,7 @@
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "Support/Debug.h"
+#include "Support/STLExtras.h"
#include "LiveIntervals.h"
#include "PhysRegTracker.h"
#include "VirtRegMap.h"
@@ -38,7 +39,7 @@ namespace {
const TargetMachine* tm_;
const MRegisterInfo* mri_;
LiveIntervals* li_;
- typedef std::list<LiveIntervals::Interval*> IntervalPtrs;
+ typedef std::list<Interval*> IntervalPtrs;
IntervalPtrs unhandled_, fixed_, active_, inactive_, handled_;
std::auto_ptr<PhysRegTracker> prt_;
@@ -122,7 +123,7 @@ namespace {
// if (MRegisterInfo::isVirtualRegister(i->second) &&
// (i->second == i2->second ||
// mri_->areAliases(i->second, i2->second))) {
-// const LiveIntervals::Interval
+// const Interval
// &in = li_->getInterval(i->second),
// &in2 = li_->getInterval(i2->second);
// if (in.overlaps(in2)) {
@@ -373,12 +374,12 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
if (cur->weight <= minWeight) {
DEBUG(std::cerr << "\t\t\tspilling(c): " << *cur << '\n';);
int slot = vrm_->assignVirt2StackSlot(cur->reg);
- std::vector<LiveIntervals::Interval*> added =
+ std::vector<Interval*> added =
li_->addIntervalsForSpills(*cur, *vrm_, slot);
// merge added with unhandled
- std::vector<LiveIntervals::Interval*>::iterator addedIt = added.begin();
- std::vector<LiveIntervals::Interval*>::iterator addedItEnd = added.end();
+ std::vector<Interval*>::iterator addedIt = added.begin();
+ std::vector<Interval*>::iterator addedItEnd = added.end();
for (IntervalPtrs::iterator i = unhandled_.begin(), e = unhandled_.end();
i != e && addedIt != addedItEnd; ++i) {
if ((*i)->start() > (*addedIt)->start())
@@ -398,7 +399,7 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
// otherwise we spill all intervals aliasing the register with
// minimum weight, rollback to the interval with the earliest
// start point and let the linear scan algorithm run again
- std::vector<LiveIntervals::Interval*> added;
+ std::vector<Interval*> added;
assert(MRegisterInfo::isPhysicalRegister(minReg) &&
"did not choose a register to spill?");
std::vector<bool> toSpill(mri_->getNumRegs(), false);
@@ -417,7 +418,7 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
DEBUG(std::cerr << "\t\t\tspilling(a): " << **i << '\n');
earliestStart = std::min(earliestStart, (*i)->start());
int slot = vrm_->assignVirt2StackSlot((*i)->reg);
- std::vector<LiveIntervals::Interval*> newIs =
+ std::vector<Interval*> newIs =
li_->addIntervalsForSpills(**i, *vrm_, slot);
std::copy(newIs.begin(), newIs.end(), std::back_inserter(added));
spilled.insert(reg);
@@ -432,7 +433,7 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
DEBUG(std::cerr << "\t\t\tspilling(i): " << **i << '\n');
earliestStart = std::min(earliestStart, (*i)->start());
int slot = vrm_->assignVirt2StackSlot((*i)->reg);
- std::vector<LiveIntervals::Interval*> newIs =
+ std::vector<Interval*> newIs =
li_->addIntervalsForSpills(**i, *vrm_, slot);
std::copy(newIs.begin(), newIs.end(), std::back_inserter(added));
spilled.insert(reg);
@@ -495,10 +496,10 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
}
}
- std::sort(added.begin(), added.end(), LiveIntervals::StartPointPtrComp());
+ std::sort(added.begin(), added.end(), less_ptr<Interval>());
// merge added with unhandled
- std::vector<LiveIntervals::Interval*>::iterator addedIt = added.begin();
- std::vector<LiveIntervals::Interval*>::iterator addedItEnd = added.end();
+ std::vector<Interval*>::iterator addedIt = added.begin();
+ std::vector<Interval*>::iterator addedItEnd = added.end();
for (IntervalPtrs::iterator i = unhandled_.begin(), e = unhandled_.end();
i != e && addedIt != addedItEnd; ++i) {
if ((*i)->start() > (*addedIt)->start())