mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
MIsched: Added biasCriticalPath.
Allow schedulers to order DAG edges by critical path. This makes DFS-based heuristics more stable and effective. llvm-svn: 173317
This commit is contained in:
parent
c731b2e79a
commit
35ccc52ff0
@ -455,6 +455,10 @@ namespace llvm {
|
||||
return NumSuccsLeft == 0;
|
||||
}
|
||||
|
||||
/// \brief Order this node's predecessor edges such that the critical path
|
||||
/// edge occurs first.
|
||||
void biasCriticalPath();
|
||||
|
||||
void dump(const ScheduleDAG *G) const;
|
||||
void dumpAll(const ScheduleDAG *G) const;
|
||||
void print(raw_ostream &O, const ScheduleDAG *G) const;
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user