misched preparation: modularize schedule printing.
authorAndrew Trick <atrick@apple.com>
Wed, 7 Mar 2012 05:21:40 +0000 (05:21 +0000)
committerAndrew Trick <atrick@apple.com>
Wed, 7 Mar 2012 05:21:40 +0000 (05:21 +0000)
ScheduleDAG will not refer to the scheduled instruction sequence.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152205 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/ScheduleDAG.h
lib/CodeGen/PostRASchedulerList.cpp
lib/CodeGen/ScheduleDAG.cpp
lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h

index 1966724b784304333278ad5bedc07c7f17a62176..832457d524e979040aeba7c60c75950f859ad54e 100644 (file)
@@ -527,8 +527,6 @@ namespace llvm {
     ///
     virtual MachineBasicBlock *EmitSchedule() = 0;
 
-    void dumpSchedule() const;
-
     virtual void dumpNode(const SUnit *SU) const = 0;
 
     /// getGraphNodeLabel - Return a label for an SUnit node in a visualization
index 4c768acb54f1b880b23fe5b14144f2678dd2540e..72ae6febb12bcc9e115c6744fb49a83f661fa065 100644 (file)
@@ -170,6 +170,8 @@ namespace {
     // adjustments may be made to the instruction if necessary. Return
     // true if the operand has been deleted, false if not.
     bool ToggleKillFlag(MachineInstr *MI, MachineOperand &MO);
+
+    void dumpSchedule() const;
   };
 }
 
@@ -202,6 +204,16 @@ SchedulePostRATDList::~SchedulePostRATDList() {
   delete AntiDepBreak;
 }
 
+/// dumpSchedule - dump the scheduled Sequence.
+void SchedulePostRATDList::dumpSchedule() const {
+  for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
+    if (SUnit *SU = Sequence[i])
+      SU->dump(this);
+    else
+      dbgs() << "**** NOOP ****\n";
+  }
+}
+
 bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
   TII = Fn.getTarget().getInstrInfo();
   MachineLoopInfo &MLI = getAnalysis<MachineLoopInfo>();
@@ -343,6 +355,12 @@ void SchedulePostRATDList::Schedule() {
   AvailableQueue.initNodes(SUnits);
   ListScheduleTopDown();
   AvailableQueue.releaseState();
+
+  DEBUG({
+      dbgs() << "*** Final schedule ***\n";
+      dumpSchedule();
+      dbgs() << '\n';
+    });
 }
 
 /// Observe - Update liveness information to account for the current
index de8f5199ebffe2744f3b90d27889cec0016a370e..7fae783f8dbbc7595efbb57e925edcd2e697e4fe 100644 (file)
@@ -52,17 +52,6 @@ const MCInstrDesc *ScheduleDAG::getNodeDesc(const SDNode *Node) const {
   return &TII->get(Node->getMachineOpcode());
 }
 
-/// dump - dump the schedule.
-void ScheduleDAG::dumpSchedule() const {
-  for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
-    if (SUnit *SU = Sequence[i])
-      SU->dump(this);
-    else
-      dbgs() << "**** NOOP ****\n";
-  }
-}
-
-
 /// Run - perform scheduling.
 ///
 void ScheduleDAG::Run(MachineBasicBlock *bb,
@@ -76,12 +65,6 @@ void ScheduleDAG::Run(MachineBasicBlock *bb,
   ExitSU = SUnit();
 
   Schedule();
-
-  DEBUG({
-      dbgs() << "*** Final schedule ***\n";
-      dumpSchedule();
-      dbgs() << '\n';
-    });
 }
 
 /// addPred - This adds the specified edge as a pred of the current node if
index 1a1fab0b31093fbd551aee9081ec6dafb7246861..195f48845306a97800e5860a59f418c44827dc90 100644 (file)
@@ -327,6 +327,12 @@ void ScheduleDAGRRList::Schedule() {
   ListScheduleBottomUp();
 
   AvailableQueue->releaseState();
+
+  DEBUG({
+      dbgs() << "*** Final schedule ***\n";
+      dumpSchedule();
+      dbgs() << '\n';
+    });
 }
 
 //===----------------------------------------------------------------------===//
index 1e5146ed31d77e1db50c31eb1922652e7d6dafdc..caab4c6719a899339470b51f18b46a03b250f7e2 100644 (file)
@@ -621,6 +621,15 @@ void ScheduleDAGSDNodes::dumpNode(const SUnit *SU) const {
   }
 }
 
+void ScheduleDAGSDNodes::dumpSchedule() const {
+  for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
+    if (SUnit *SU = Sequence[i])
+      SU->dump(this);
+    else
+      dbgs() << "**** NOOP ****\n";
+  }
+}
+
 #ifndef NDEBUG
 /// VerifyScheduledSequence - Verify that all SUnits were scheduled and that
 /// their state is consistent with the nodes listed in Sequence.
index 0038a9ec60961ffe92952cc470955ccfbf282d8b..5c05c722255db3b60fdc051966e0c5410aa52f54 100644 (file)
@@ -117,6 +117,8 @@ namespace llvm {
 
     virtual void dumpNode(const SUnit *SU) const;
 
+    void dumpSchedule() const;
+
     virtual std::string getGraphNodeLabel(const SUnit *SU) const;
 
     virtual std::string getDAGName() const;