4141//
4242// ScheduleDAGInstrs *<Target>TargetMachine::
4343// createMachineScheduler(MachineSchedContext *C) {
44- // ScheduleDAGMI *DAG = createGenericSchedLive (C);
44+ // ScheduleDAGMI *DAG = createSchedLive (C);
4545// DAG->addMutation(new CustomDAGMutation(...));
4646// return DAG;
4747// }
@@ -1383,14 +1383,6 @@ class LLVM_ABI PostGenericScheduler : public GenericSchedulerBase {
13831383 void pickNodeFromQueue (SchedBoundary &Zone, SchedCandidate &Cand);
13841384};
13851385
1386- // / Create the standard converging machine scheduler. This will be used as the
1387- // / default scheduler if the target does not set a default.
1388- // / Adds default DAG mutations.
1389- LLVM_ABI ScheduleDAGMILive *createGenericSchedLive (MachineSchedContext *C);
1390-
1391- // / Create a generic scheduler with no vreg liveness or DAG mutation passes.
1392- LLVM_ABI ScheduleDAGMI *createGenericSchedPostRA (MachineSchedContext *C);
1393-
13941386// / If ReorderWhileClustering is set to true, no attempt will be made to
13951387// / reduce reordering due to store clustering.
13961388LLVM_ABI std::unique_ptr<ScheduleDAGMutation>
@@ -1409,6 +1401,41 @@ LLVM_ABI std::unique_ptr<ScheduleDAGMutation>
14091401createCopyConstrainDAGMutation (const TargetInstrInfo *TII,
14101402 const TargetRegisterInfo *TRI);
14111403
1404+ // / Create the standard converging machine scheduler. This will be used as the
1405+ // / default scheduler if the target does not set a default.
1406+ // / Adds default DAG mutations.
1407+ template <typename Strategy = GenericScheduler>
1408+ LLVM_ABI ScheduleDAGMILive *createSchedLive (MachineSchedContext *C) {
1409+ ScheduleDAGMILive *DAG =
1410+ new ScheduleDAGMILive (C, std::make_unique<Strategy>(C));
1411+ // Register DAG post-processors.
1412+ //
1413+ // FIXME: extend the mutation API to allow earlier mutations to instantiate
1414+ // data and pass it to later mutations. Have a single mutation that gathers
1415+ // the interesting nodes in one pass.
1416+ DAG->addMutation (createCopyConstrainDAGMutation (DAG->TII , DAG->TRI ));
1417+
1418+ const TargetSubtargetInfo &STI = C->MF ->getSubtarget ();
1419+ // Add MacroFusion mutation if fusions are not empty.
1420+ const auto &MacroFusions = STI.getMacroFusions ();
1421+ if (!MacroFusions.empty ())
1422+ DAG->addMutation (createMacroFusionDAGMutation (MacroFusions));
1423+ return DAG;
1424+ }
1425+
1426+ // / Create a generic scheduler with no vreg liveness or DAG mutation passes.
1427+ template <typename Strategy = PostGenericScheduler>
1428+ LLVM_ABI ScheduleDAGMI *createSchedPostRA (MachineSchedContext *C) {
1429+ ScheduleDAGMI *DAG = new ScheduleDAGMI (C, std::make_unique<Strategy>(C),
1430+ /* RemoveKillFlags=*/ true );
1431+ const TargetSubtargetInfo &STI = C->MF ->getSubtarget ();
1432+ // Add MacroFusion mutation if fusions are not empty.
1433+ const auto &MacroFusions = STI.getMacroFusions ();
1434+ if (!MacroFusions.empty ())
1435+ DAG->addMutation (createMacroFusionDAGMutation (MacroFusions));
1436+ return DAG;
1437+ }
1438+
14121439class MachineSchedulerPass : public PassInfoMixin <MachineSchedulerPass> {
14131440 // FIXME: Remove this member once RegisterClassInfo is queryable as an
14141441 // analysis.
0 commit comments