[llvm] Reland "CodeGen][NewPM] Port MachineScheduler to NPM. (#125703)" (PR #126684)
Akshat Oke via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 00:43:47 PST 2025
================
@@ -385,39 +436,100 @@ nextIfDebug(MachineBasicBlock::iterator I,
}
/// Instantiate a ScheduleDAGInstrs that will be owned by the caller.
-ScheduleDAGInstrs *MachineScheduler::createMachineScheduler() {
+ScheduleDAGInstrs *MachineSchedulerImpl::createMachineScheduler() {
// Select the scheduler, or set the default.
MachineSchedRegistry::ScheduleDAGCtor Ctor = MachineSchedOpt;
if (Ctor != useDefaultMachineSched)
return Ctor(this);
- const TargetMachine &TM =
- getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
-
// Get the default scheduler set by the target for this function.
- ScheduleDAGInstrs *Scheduler = TM.createMachineScheduler(this);
+ ScheduleDAGInstrs *Scheduler = TM->createMachineScheduler(this);
if (Scheduler)
return Scheduler;
// Default to GenericScheduler.
return createGenericSchedLive(this);
}
+bool MachineSchedulerImpl::run(MachineFunction &Func, const TargetMachine &TM,
+ const RequiredAnalyses &Analyses) {
+ MF = &Func;
+ MLI = &Analyses.MLI;
+ MDT = &Analyses.MDT;
+ this->TM = &TM;
+ AA = &Analyses.AA;
+ LIS = &Analyses.LIS;
+
+ if (VerifyScheduling) {
+ LLVM_DEBUG(LIS->dump());
+ const char *MSchedBanner = "Before machine scheduling.";
+ if (P)
+ MF->verify(P, MSchedBanner, &errs());
+ else
+ MF->verify(*MFAM, MSchedBanner, &errs());
+ }
+ RegClassInfo->runOnMachineFunction(*MF);
----------------
optimisan wrote:
There is a patch to convert it into an analysis: https://github.com/llvm/llvm-project/pull/120690
https://github.com/llvm/llvm-project/pull/126684
More information about the llvm-commits
mailing list