[PATCH] D22193: Add macro-fusion hook in MIScheduler and support cluster instructions scheduling in PostRAScheduler
Ehsan Amiri via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 11 08:09:10 PDT 2016
amehsan added inline comments.
================
Comment at: lib/CodeGen/MachineScheduler.cpp:3108-3129
@@ -3107,20 +3107,24 @@
/// default scheduler if the target does not set a default.
static ScheduleDAGInstrs *createGenericSchedLive(MachineSchedContext *C) {
ScheduleDAGMILive *DAG = new ScheduleDAGMILive(C, make_unique<GenericScheduler>(C));
// Register DAG post-processors.
//
// 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));
if (EnableMemOpCluster) {
if (DAG->TII->enableClusterLoads())
DAG->addMutation(make_unique<LoadClusterMutation>(DAG->TII, DAG->TRI));
if (DAG->TII->enableClusterStores())
DAG->addMutation(make_unique<StoreClusterMutation>(DAG->TII, DAG->TRI));
}
- if (EnableMacroFusion)
- DAG->addMutation(make_unique<MacroFusion>(*DAG->TII, *DAG->TRI));
+ if (EnableMacroFusion) {
+ if (ScheduleDAGMutation *Fusion = C->PassConfig->createMacroFusion(DAG))
+ DAG->addMutation(std::unique_ptr<ScheduleDAGMutation>(Fusion));
+ else
+ DAG->addMutation(make_unique<MacroFusion>(*DAG->TII, *DAG->TRI));
+ }
return DAG;
}
----------------
Why not adding Target specific code to create scheduler objects and add any mutations that we need, there? What we want to do here, is Target specific and I think sooner or later we will have other target specific requirements to satisfy when creating scheduler, strategy and mutations. Why do you want to do this here?
================
Comment at: lib/CodeGen/PostRASchedulerList.cpp:465-471
@@ -461,4 +464,9 @@
if (SuccEdge->isWeak()) {
--SuccSU->WeakPredsLeft;
+ // Cluster instructions get higher scheduling priority.
+ // If SuccSU is not blocked by any other predecessors, let scheduler pick
+ // SuccSU as next scheduling instruction.
+ if (SuccEdge->isCluster() && SuccSU->NumPredsLeft == 0)
+ NextClusterSucc = SuccSU;
return;
----------------
I have doubts that we need to make any changes in this file. We want to switch to post-ra MIScheduler. So I don't see much benefit in making changes here.
http://reviews.llvm.org/D22193
More information about the llvm-commits
mailing list