diff options
author | Andrew Trick <atrick@apple.com> | 2013-01-24 02:09:55 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-01-24 02:09:55 +0000 |
commit | 66658dd9a1ffe00a5f6e0afca7afb16ec6704ed3 (patch) | |
tree | 994353b4a50242a0e74489a2e63e86c4a7849795 /lib/CodeGen | |
parent | e35badad221354a53bc07a523120ed82d93e0569 (diff) | |
download | external_llvm-66658dd9a1ffe00a5f6e0afca7afb16ec6704ed3.zip external_llvm-66658dd9a1ffe00a5f6e0afca7afb16ec6704ed3.tar.gz external_llvm-66658dd9a1ffe00a5f6e0afca7afb16ec6704ed3.tar.bz2 |
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')
-rw-r--r-- | lib/CodeGen/ScheduleDAG.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/ScheduleDAG.cpp b/lib/CodeGen/ScheduleDAG.cpp index e639c55..70ad949 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. |