diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2016-08-19 19:59:18 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2016-08-19 19:59:18 +0000 |
commit | 68726a5359270d877a8cddc61e38d179f79dc070 (patch) | |
tree | e329b1c2eb9ffc9d276b17645eb6e8e21d63e5a2 /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | 021151d6c1cf01e32a28fc00431dbbbfe63660c9 (diff) | |
download | llvm-68726a5359270d877a8cddc61e38d179f79dc070.zip llvm-68726a5359270d877a8cddc61e38d179f79dc070.tar.gz llvm-68726a5359270d877a8cddc61e38d179f79dc070.tar.bz2 |
MachineScheduler: Add constructor functions for the DAGMutations
Summary: This way they can be re-used by target-specific schedulers.
Reviewers: atrick, MatzeB, kparzysz
Subscribers: kparzysz, llvm-commits, MatzeB
Differential Revision: https://reviews.llvm.org/D23678
llvm-svn: 279305
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index e91fa05..fae22eb 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -1392,6 +1392,22 @@ public: }; } // anonymous +namespace llvm { + +std::unique_ptr<ScheduleDAGMutation> +createLoadClusterDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI) { + return make_unique<LoadClusterMutation>(TII, TRI); +} + +std::unique_ptr<ScheduleDAGMutation> +createStoreClusterDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI) { + return make_unique<StoreClusterMutation>(TII, TRI); +} + +} // namespace llvm + void BaseMemOpClusterMutation::clusterNeighboringMemOps( ArrayRef<SUnit *> MemOps, ScheduleDAGMI *DAG) { SmallVector<MemOpInfo, 32> MemOpRecords; @@ -1493,6 +1509,16 @@ public: }; } // anonymous +namespace llvm { + +std::unique_ptr<ScheduleDAGMutation> +createMacroFusionDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI) { + return make_unique<MacroFusion>(*TII, *TRI); +} + +} // namespace llvm + /// Returns true if \p MI reads a register written by \p Other. static bool HasDataDep(const TargetRegisterInfo &TRI, const MachineInstr &MI, const MachineInstr &Other) { @@ -1569,6 +1595,16 @@ protected: }; } // anonymous +namespace llvm { + +std::unique_ptr<ScheduleDAGMutation> +createCopyConstrainDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI) { + return make_unique<CopyConstrain>(TII, TRI); +} + +} // namespace llvm + /// constrainLocalCopy handles two possibilities: /// 1) Local src: /// I0: = dst @@ -3109,15 +3145,15 @@ static ScheduleDAGInstrs *createGenericSchedLive(MachineSchedContext *C) { // FIXME: extend the mutation API to allow earlier mutations to instantiate // data and pass it to later mutations. Have a single mutation that gathers // the interesting nodes in one pass. - DAG->addMutation(make_unique<CopyConstrain>(DAG->TII, DAG->TRI)); + DAG->addMutation(createCopyConstrainDAGMutation(DAG->TII, DAG->TRI)); if (EnableMemOpCluster) { if (DAG->TII->enableClusterLoads()) - DAG->addMutation(make_unique<LoadClusterMutation>(DAG->TII, DAG->TRI)); + DAG->addMutation(createLoadClusterDAGMutation(DAG->TII, DAG->TRI)); if (DAG->TII->enableClusterStores()) - DAG->addMutation(make_unique<StoreClusterMutation>(DAG->TII, DAG->TRI)); + DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI)); } if (EnableMacroFusion) - DAG->addMutation(make_unique<MacroFusion>(*DAG->TII, *DAG->TRI)); + DAG->addMutation(createMacroFusionDAGMutation(DAG->TII, DAG->TRI)); return DAG; } |