diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 19:17:14 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 19:17:14 +0000 | 
| commit | db17bf38c59bc172953ed66cfe1b10c03c6bc383 (patch) | |
| tree | 2712281fec99b99c2fcafd5b46439dfdd93261aa /contrib/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp | |
| parent | 686fb94a00297bf9ff49d93b948925552a2ce8e0 (diff) | |
| parent | 7ab83427af0f77b59941ceba41d509d7d097b065 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp')
| -rw-r--r-- | contrib/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp | 57 | 
1 files changed, 25 insertions, 32 deletions
diff --git a/contrib/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp b/contrib/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp index 324108284a9a..4602de979024 100644 --- a/contrib/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp +++ b/contrib/llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp @@ -563,40 +563,33 @@ void ConvergingVLIWScheduler::readyQueueVerboseDump(  }  #endif -/// getSingleUnscheduledPred - If there is exactly one unscheduled predecessor -/// of SU, return it, otherwise return null. -static SUnit *getSingleUnscheduledPred(SUnit *SU) { -  SUnit *OnlyAvailablePred = nullptr; -  for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); -       I != E; ++I) { -    SUnit &Pred = *I->getSUnit(); -    if (!Pred.isScheduled) { -      // We found an available, but not scheduled, predecessor.  If it's the -      // only one we have found, keep track of it... otherwise give up. -      if (OnlyAvailablePred && OnlyAvailablePred != &Pred) -        return nullptr; -      OnlyAvailablePred = &Pred; -    } +/// isSingleUnscheduledPred - If SU2 is the only unscheduled predecessor +/// of SU, return true (we may have duplicates) +static inline bool isSingleUnscheduledPred(SUnit *SU, SUnit *SU2) { +  if (SU->NumPredsLeft == 0) +    return false; + +  for (auto &Pred : SU->Preds) { +    // We found an available, but not scheduled, predecessor. +    if (!Pred.getSUnit()->isScheduled && (Pred.getSUnit() != SU2)) +      return false;    } -  return OnlyAvailablePred; + +  return true;  } -/// getSingleUnscheduledSucc - If there is exactly one unscheduled successor -/// of SU, return it, otherwise return null. -static SUnit *getSingleUnscheduledSucc(SUnit *SU) { -  SUnit *OnlyAvailableSucc = nullptr; -  for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); -       I != E; ++I) { -    SUnit &Succ = *I->getSUnit(); -    if (!Succ.isScheduled) { -      // We found an available, but not scheduled, successor.  If it's the -      // only one we have found, keep track of it... otherwise give up. -      if (OnlyAvailableSucc && OnlyAvailableSucc != &Succ) -        return nullptr; -      OnlyAvailableSucc = &Succ; -    } +/// isSingleUnscheduledSucc - If SU2 is the only unscheduled successor +/// of SU, return true (we may have duplicates) +static inline bool isSingleUnscheduledSucc(SUnit *SU, SUnit *SU2) { +  if (SU->NumSuccsLeft == 0) +    return false; + +  for (auto &Succ : SU->Succs) { +    // We found an available, but not scheduled, successor. +    if (!Succ.getSUnit()->isScheduled && (Succ.getSUnit() != SU2)) +      return false;    } -  return OnlyAvailableSucc; +  return true;  }  // Constants used to denote relative importance of @@ -673,12 +666,12 @@ int ConvergingVLIWScheduler::SchedulingCost(ReadyQueue &Q, SUnit *SU,      // Count the number of nodes that      // this node is the sole unscheduled node for.      for (const SDep &SI : SU->Succs) -      if (getSingleUnscheduledPred(SI.getSUnit()) == SU) +      if (isSingleUnscheduledPred(SI.getSUnit(), SU))          ++NumNodesBlocking;    } else {      // How many unscheduled predecessors block this node?      for (const SDep &PI : SU->Preds) -      if (getSingleUnscheduledSucc(PI.getSUnit()) == SU) +      if (isSingleUnscheduledSucc(PI.getSUnit(), SU))          ++NumNodesBlocking;    }    ResCount += (NumNodesBlocking * ScaleTwo);  | 
