summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LatencyPriorityQueue.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-12-09 22:54:47 +0000
committerDan Gohman <gohman@apple.com>2008-12-09 22:54:47 +0000
commit54e4c36a7349e94a84773afb56eccd4ca65b49e9 (patch)
tree2fc3528006f5b576a6fb9f03bc2f170b80737687 /lib/CodeGen/LatencyPriorityQueue.cpp
parent5a45bf1b48cd3d23faa3dfc27b8866bb536c4b9e (diff)
downloadllvm-54e4c36a7349e94a84773afb56eccd4ca65b49e9.tar.gz
llvm-54e4c36a7349e94a84773afb56eccd4ca65b49e9.tar.bz2
llvm-54e4c36a7349e94a84773afb56eccd4ca65b49e9.tar.xz
Rewrite the SDep class, and simplify some of the related code.
The Cost field is removed. It was only being used in a very limited way, to indicate when the scheduler should attempt to protect a live register, and it isn't really needed to do that. If we ever want the scheduler to start inserting copies in non-prohibitive situations, we'll have to rethink some things anyway. A Latency field is added. Instead of giving each node a single fixed latency, each edge can have its own latency. This will eventually be used to model various micro-architecture properties more accurately. The PointerIntPair class and an internal union are now used, which reduce the overall size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60806 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LatencyPriorityQueue.cpp')
-rw-r--r--lib/CodeGen/LatencyPriorityQueue.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/CodeGen/LatencyPriorityQueue.cpp b/lib/CodeGen/LatencyPriorityQueue.cpp
index 8a6d1f23af..131da27c33 100644
--- a/lib/CodeGen/LatencyPriorityQueue.cpp
+++ b/lib/CodeGen/LatencyPriorityQueue.cpp
@@ -57,14 +57,13 @@ int LatencyPriorityQueue::CalcLatency(const SUnit &SU) {
unsigned MaxSuccLatency = 0;
for (SUnit::const_succ_iterator I = Cur->Succs.begin(),E = Cur->Succs.end();
I != E; ++I) {
- int SuccLatency = Latencies[I->Dep->NodeNum];
+ int SuccLatency = Latencies[I->getSUnit()->NodeNum];
if (SuccLatency == -1) {
AllDone = false;
- WorkList.push_back(I->Dep);
+ WorkList.push_back(I->getSUnit());
} else {
// This assumes that there's no delay for reusing registers.
- unsigned NewLatency =
- SuccLatency + ((I->isCtrl && I->Reg != 0) ? 1 : CurLatency);
+ unsigned NewLatency = SuccLatency + CurLatency;
MaxSuccLatency = std::max(MaxSuccLatency, NewLatency);
}
}
@@ -99,7 +98,7 @@ void LatencyPriorityQueue::CalculatePriorities() {
Latency = SU->Latency + SuccLat;
for (SUnit::const_pred_iterator I = SU->Preds.begin(),E = SU->Preds.end();
I != E; ++I)
- WorkList.push_back(std::make_pair(I->Dep, Latency));
+ WorkList.push_back(std::make_pair(I->getSUnit(), Latency));
}
}
}
@@ -110,7 +109,7 @@ SUnit *LatencyPriorityQueue::getSingleUnscheduledPred(SUnit *SU) {
SUnit *OnlyAvailablePred = 0;
for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
I != E; ++I) {
- SUnit &Pred = *I->Dep;
+ SUnit &Pred = *I->getSUnit();
if (!Pred.isScheduled) {
// We found an available, but not scheduled, predecessor. If it's the
// only one we have found, keep track of it... otherwise give up.
@@ -129,7 +128,7 @@ void LatencyPriorityQueue::push_impl(SUnit *SU) {
unsigned NumNodesBlocking = 0;
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I)
- if (getSingleUnscheduledPred(I->Dep) == SU)
+ if (getSingleUnscheduledPred(I->getSUnit()) == SU)
++NumNodesBlocking;
NumNodesSolelyBlocking[SU->NodeNum] = NumNodesBlocking;
@@ -144,7 +143,7 @@ void LatencyPriorityQueue::push_impl(SUnit *SU) {
void LatencyPriorityQueue::ScheduledNode(SUnit *SU) {
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I)
- AdjustPriorityOfUnscheduledPreds(I->Dep);
+ AdjustPriorityOfUnscheduledPreds(I->getSUnit());
}
/// AdjustPriorityOfUnscheduledPreds - One of the predecessors of SU was just