41
41
//
42
42
// ScheduleDAGInstrs *<Target>TargetMachine::
43
43
// createMachineScheduler(MachineSchedContext *C) {
44
- // ScheduleDAGMI *DAG = createGenericSchedLive (C);
44
+ // ScheduleDAGMI *DAG = createSchedLive (C);
45
45
// DAG->addMutation(new CustomDAGMutation(...));
46
46
// return DAG;
47
47
// }
@@ -1383,14 +1383,6 @@ class LLVM_ABI PostGenericScheduler : public GenericSchedulerBase {
1383
1383
void pickNodeFromQueue (SchedBoundary &Zone, SchedCandidate &Cand);
1384
1384
};
1385
1385
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
-
1394
1386
// / If ReorderWhileClustering is set to true, no attempt will be made to
1395
1387
// / reduce reordering due to store clustering.
1396
1388
LLVM_ABI std::unique_ptr<ScheduleDAGMutation>
@@ -1409,6 +1401,41 @@ LLVM_ABI std::unique_ptr<ScheduleDAGMutation>
1409
1401
createCopyConstrainDAGMutation (const TargetInstrInfo *TII,
1410
1402
const TargetRegisterInfo *TRI);
1411
1403
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
+
1412
1439
class MachineSchedulerPass : public PassInfoMixin <MachineSchedulerPass> {
1413
1440
// FIXME: Remove this member once RegisterClassInfo is queryable as an
1414
1441
// analysis.
0 commit comments