forked from OSchip/llvm-project
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
0f515f898e
commit
d3b8629a53
|
@ -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…
Reference in New Issue