misched: add a hook for custom DAG postprocessing.
[oota-llvm.git] / lib / CodeGen / MachineScheduler.cpp
index 330ec560f88e30bfae0d0b8cc2c9dd0335216fc1..d7ecec4163a4108cef5fdf6aaa5228ec1f00eaa2 100644 (file)
@@ -484,6 +484,8 @@ void ScheduleDAGMI::releaseRoots() {
 void ScheduleDAGMI::schedule() {
   buildDAGWithRegPressure();
 
+  postprocessDAG();
+
   DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
           SUnits[su].dumpAll(this));
 
@@ -522,6 +524,13 @@ void ScheduleDAGMI::buildDAGWithRegPressure() {
   initRegPressure();
 }
 
+/// Apply each ScheduleDAGMutation step in order.
+void ScheduleDAGMI::postprocessDAG() {
+  for (unsigned i = 0, e = Mutations.size(); i < e; ++i) {
+    Mutations[i]->apply(this);
+  }
+}
+
 /// Identify DAG roots and setup scheduler queues.
 void ScheduleDAGMI::initQueues() {
   // Initialize the strategy before modifying the DAG.