[PATCH] D22193: Add macro-fusion hook in MIScheduler and support cluster instructions scheduling in PostRAScheduler

Chuang-Yu Cheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 18:30:06 PDT 2016


cycheng 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;
 }
 
----------------
amehsan wrote:
> 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?
> 
> 
Because EnableMacroFusion is true by default, so we will call MacroFusion::apply by default, also it looks like a general feature across different targets, so I think we should also be able to hook customized MacroFusion for different targets.


http://reviews.llvm.org/D22193





More information about the llvm-commits mailing list