[llvm-commits] [llvm] r153159 - /llvm/trunk/lib/CodeGen/MachineScheduler.cpp

Andrew Trick atrick at apple.com
Tue Mar 20 21:12:07 PDT 2012


Author: atrick
Date: Tue Mar 20 23:12:07 2012
New Revision: 153159

URL: http://llvm.org/viewvc/llvm-project?rev=153159&view=rev
Log:
misched: cleanup main loop

Modified:
    llvm/trunk/lib/CodeGen/MachineScheduler.cpp

Modified: llvm/trunk/lib/CodeGen/MachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineScheduler.cpp?rev=153159&r1=153158&r2=153159&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineScheduler.cpp Tue Mar 20 23:12:07 2012
@@ -306,6 +306,7 @@
 
 protected:
   void moveInstruction(MachineInstr *MI, MachineBasicBlock::iterator InsertPos);
+  bool checkSchedLimit();
 
   void releaseSucc(SUnit *SU, SDep *SuccEdge);
   void releaseSuccessors(SUnit *SU);
@@ -374,6 +375,17 @@
     RegionBegin = MI;
 }
 
+bool ScheduleDAGMI::checkSchedLimit() {
+#ifndef NDEBUG
+  if (NumInstrsScheduled == MISchedCutoff && MISchedCutoff != ~0U) {
+    CurrentTop = CurrentBottom;
+    return false;
+  }
+  ++NumInstrsScheduled;
+#endif
+  return true;
+}
+
 /// schedule - Called back from MachineScheduler::runOnMachineFunction
 /// after setting up the current scheduling region.
 void ScheduleDAGMI::schedule() {
@@ -406,18 +418,10 @@
   CurrentBottom = RegionEnd;
   bool IsTopNode = false;
   while (SUnit *SU = SchedImpl->pickNode(IsTopNode)) {
-
-#ifndef NDEBUG
-    // Enable break
-    if (NumInstrsScheduled == MISchedCutoff && MISchedCutoff != ~0U) {
-      CurrentTop = CurrentBottom;
-      break;
-    }
-    ++NumInstrsScheduled;
-#endif
-
     DEBUG(dbgs() << "*** " << (IsTopNode ? "Top" : "Bottom")
           << " Scheduling Instruction:\n"; SU->dump(this));
+    if (!checkSchedLimit())
+      break;
 
     // Move the instruction to its new location in the instruction stream.
     MachineInstr *MI = SU->getInstr();





More information about the llvm-commits mailing list