Index: include/llvm/CodeGen/MachineScheduler.h =================================================================== --- include/llvm/CodeGen/MachineScheduler.h +++ include/llvm/CodeGen/MachineScheduler.h @@ -997,6 +997,22 @@ void pickNodeFromQueue(SchedCandidate &Cand); }; +std::unique_ptr +createLoadClusterDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI); + +std::unique_ptr +createStoreClusterDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI); + +std::unique_ptr +createMacroFusionDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI); + +std::unique_ptr +createCopyConstrainDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI); + } // namespace llvm #endif Index: lib/CodeGen/MachineScheduler.cpp =================================================================== --- lib/CodeGen/MachineScheduler.cpp +++ lib/CodeGen/MachineScheduler.cpp @@ -1396,6 +1396,22 @@ }; } // anonymous +namespace llvm { + +std::unique_ptr +createLoadClusterDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI) { + return make_unique(TII, TRI); +} + +std::unique_ptr +createStoreClusterDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI) { + return make_unique(TII, TRI); +} + +} // namespace llvm + void BaseMemOpClusterMutation::clusterNeighboringMemOps( ArrayRef MemOps, ScheduleDAGMI *DAG) { SmallVector MemOpRecords; @@ -1497,6 +1513,16 @@ }; } // anonymous +namespace llvm { + +std::unique_ptr +createMacroFusionDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI) { + return make_unique(*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) { @@ -1573,6 +1599,16 @@ }; } // anonymous +namespace llvm { + +std::unique_ptr +createCopyConstrainDAGMutation(const TargetInstrInfo *TII, + const TargetRegisterInfo *TRI) { + return make_unique(TII, TRI); +} + +} // namespace llvm + /// constrainLocalCopy handles two possibilities: /// 1) Local src: /// I0: = dst @@ -3113,15 +3149,15 @@ // 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(DAG->TII, DAG->TRI)); + DAG->addMutation(createCopyConstrainDAGMutation(DAG->TII, DAG->TRI)); if (EnableMemOpCluster) { if (DAG->TII->enableClusterLoads()) - DAG->addMutation(make_unique(DAG->TII, DAG->TRI)); + DAG->addMutation(createLoadClusterDAGMutation(DAG->TII, DAG->TRI)); if (DAG->TII->enableClusterStores()) - DAG->addMutation(make_unique(DAG->TII, DAG->TRI)); + DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI)); } if (EnableMacroFusion) - DAG->addMutation(make_unique(*DAG->TII, *DAG->TRI)); + DAG->addMutation(createMacroFusionDAGMutation(DAG->TII, DAG->TRI)); return DAG; }