summaryrefslogtreecommitdiff
path: root/lib/CodeGen/ScheduleDAG.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-01-24 02:09:55 +0000
committerAndrew Trick <atrick@apple.com>2013-01-24 02:09:55 +0000
commit66658dd9a1ffe00a5f6e0afca7afb16ec6704ed3 (patch)
tree994353b4a50242a0e74489a2e63e86c4a7849795 /lib/CodeGen/ScheduleDAG.cpp
parente35badad221354a53bc07a523120ed82d93e0569 (diff)
downloadllvm-66658dd9a1ffe00a5f6e0afca7afb16ec6704ed3.tar.gz
llvm-66658dd9a1ffe00a5f6e0afca7afb16ec6704ed3.tar.bz2
llvm-66658dd9a1ffe00a5f6e0afca7afb16ec6704ed3.tar.xz
MIsched: Added biasCriticalPath.
Allow schedulers to order DAG edges by critical path. This makes DFS-based heuristics more stable and effective. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ScheduleDAG.cpp')
-rw-r--r--lib/CodeGen/ScheduleDAG.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/ScheduleDAG.cpp b/lib/CodeGen/ScheduleDAG.cpp
index e639c55a04..70ad949571 100644
--- a/lib/CodeGen/ScheduleDAG.cpp
+++ b/lib/CodeGen/ScheduleDAG.cpp
@@ -301,6 +301,21 @@ void SUnit::ComputeHeight() {
} while (!WorkList.empty());
}
+void SUnit::biasCriticalPath() {
+ if (NumPreds < 2)
+ return;
+
+ SUnit::pred_iterator BestI = Preds.begin();
+ unsigned MaxDepth = BestI->getSUnit()->getDepth();
+ for (SUnit::pred_iterator
+ I = llvm::next(BestI), E = Preds.end(); I != E; ++I) {
+ if (I->getKind() == SDep::Data && I->getSUnit()->getDepth() > MaxDepth)
+ BestI = I;
+ }
+ if (BestI != Preds.begin())
+ std::swap(*Preds.begin(), *BestI);
+}
+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
/// SUnit - Scheduling unit. It's an wrapper around either a single SDNode or
/// a group of nodes flagged together.