diff options
author | Dan Gohman <gohman@apple.com> | 2008-12-09 00:26:46 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-12-09 00:26:46 +0000 |
commit | 37c496979c40e3249f39d82eaf9968448fa924a1 (patch) | |
tree | f630756faa2d60eb8552a73c88c8930ec311ec06 /llvm/lib | |
parent | 08134c984bb746f42a086d23e6e2447e2b56ba58 (diff) | |
download | bcm5719-llvm-37c496979c40e3249f39d82eaf9968448fa924a1.tar.gz bcm5719-llvm-37c496979c40e3249f39d82eaf9968448fa924a1.zip |
Don't charge full latency for an anti-dependence, in this simplistic
pipeline model.
llvm-svn: 60733
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/LatencyPriorityQueue.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LatencyPriorityQueue.cpp b/llvm/lib/CodeGen/LatencyPriorityQueue.cpp index 70b6574996b..8a6d1f23af1 100644 --- a/llvm/lib/CodeGen/LatencyPriorityQueue.cpp +++ b/llvm/lib/CodeGen/LatencyPriorityQueue.cpp @@ -52,8 +52,9 @@ int LatencyPriorityQueue::CalcLatency(const SUnit &SU) { WorkList.push_back(&SU); while (!WorkList.empty()) { const SUnit *Cur = WorkList.back(); + unsigned CurLatency = Cur->Latency; bool AllDone = true; - int MaxSuccLatency = 0; + 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]; @@ -61,11 +62,14 @@ int LatencyPriorityQueue::CalcLatency(const SUnit &SU) { AllDone = false; WorkList.push_back(I->Dep); } else { - MaxSuccLatency = std::max(MaxSuccLatency, SuccLatency); + // This assumes that there's no delay for reusing registers. + unsigned NewLatency = + SuccLatency + ((I->isCtrl && I->Reg != 0) ? 1 : CurLatency); + MaxSuccLatency = std::max(MaxSuccLatency, NewLatency); } } if (AllDone) { - Latencies[Cur->NodeNum] = MaxSuccLatency + Cur->Latency; + Latencies[Cur->NodeNum] = MaxSuccLatency; WorkList.pop_back(); } } |