diff options
author | Clement Courbet <courbet@google.com> | 2019-03-29 08:33:05 +0000 |
---|---|---|
committer | Clement Courbet <courbet@google.com> | 2019-03-29 08:33:05 +0000 |
commit | b70355f0b49c29b4b2f8a87693c51cc73abd17c0 (patch) | |
tree | 41845bdb2351ebf0df7494bda213cc40f78cd12e /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | 5ed0a8bf1393ebbd13bf985dc30818b215e3288e (diff) | |
download | llvm-b70355f0b49c29b4b2f8a87693c51cc73abd17c0.zip llvm-b70355f0b49c29b4b2f8a87693c51cc73abd17c0.tar.gz llvm-b70355f0b49c29b4b2f8a87693c51cc73abd17c0.tar.bz2 |
[ScheduleDAG] Move `Topo` and `addEdge` to base class.
Some DAG mutations can only be applied to `ScheduleDAGMI`, and have to
internally cast a `ScheduleDAGInstrs` to `ScheduleDAGMI`.
There is nothing actually specific to `ScheduleDAGMI` in `Topo`.
llvm-svn: 357239
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index 88f0630..dc2e1f9 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -608,23 +608,6 @@ LLVM_DUMP_METHOD void ReadyQueue::dump() const { // Provide a vtable anchor. ScheduleDAGMI::~ScheduleDAGMI() = default; -bool ScheduleDAGMI::canAddEdge(SUnit *SuccSU, SUnit *PredSU) { - return SuccSU == &ExitSU || !Topo.IsReachable(PredSU, SuccSU); -} - -bool ScheduleDAGMI::addEdge(SUnit *SuccSU, const SDep &PredDep) { - if (SuccSU != &ExitSU) { - // Do not use WillCreateCycle, it assumes SD scheduling. - // If Pred is reachable from Succ, then the edge creates a cycle. - if (Topo.IsReachable(PredDep.getSUnit(), SuccSU)) - return false; - Topo.AddPred(SuccSU, PredDep.getSUnit()); - } - SuccSU->addPred(PredDep, /*Required=*/!PredDep.isArtificial()); - // Return true regardless of whether a new edge needed to be inserted. - return true; -} - /// ReleaseSucc - Decrement the NumPredsLeft count of a successor. When /// NumPredsLeft reaches zero, release the successor node. /// @@ -765,8 +748,6 @@ void ScheduleDAGMI::schedule() { // Build the DAG. buildSchedGraph(AA); - Topo.InitDAGTopologicalSorting(); - postprocessDAG(); SmallVector<SUnit*, 8> TopRoots, BotRoots; @@ -1215,8 +1196,6 @@ void ScheduleDAGMILive::schedule() { LLVM_DEBUG(SchedImpl->dumpPolicy()); buildDAGWithRegPressure(); - Topo.InitDAGTopologicalSorting(); - postprocessDAG(); SmallVector<SUnit*, 8> TopRoots, BotRoots; @@ -1536,7 +1515,7 @@ public: void apply(ScheduleDAGInstrs *DAGInstrs) override; protected: - void clusterNeighboringMemOps(ArrayRef<SUnit *> MemOps, ScheduleDAGMI *DAG); + void clusterNeighboringMemOps(ArrayRef<SUnit *> MemOps, ScheduleDAGInstrs *DAG); }; class StoreClusterMutation : public BaseMemOpClusterMutation { @@ -1573,7 +1552,7 @@ createStoreClusterDAGMutation(const TargetInstrInfo *TII, } // end namespace llvm void BaseMemOpClusterMutation::clusterNeighboringMemOps( - ArrayRef<SUnit *> MemOps, ScheduleDAGMI *DAG) { + ArrayRef<SUnit *> MemOps, ScheduleDAGInstrs *DAG) { SmallVector<MemOpInfo, 32> MemOpRecords; for (SUnit *SU : MemOps) { MachineOperand *BaseOp; @@ -1613,9 +1592,7 @@ void BaseMemOpClusterMutation::clusterNeighboringMemOps( } /// Callback from DAG postProcessing to create cluster edges for loads. -void BaseMemOpClusterMutation::apply(ScheduleDAGInstrs *DAGInstrs) { - ScheduleDAGMI *DAG = static_cast<ScheduleDAGMI*>(DAGInstrs); - +void BaseMemOpClusterMutation::apply(ScheduleDAGInstrs *DAG) { // Map DAG NodeNum to store chain ID. DenseMap<unsigned, unsigned> StoreChainIDs; // Map each store chain to a set of dependent MemOps. |