RegisterPressure: Move LiveInRegs/LiveOutRegs from RegisterPressure to PressureTracker
[oota-llvm.git] / lib / CodeGen / MachineScheduler.cpp
index 7cff5d12238fb37768c7c430dbbf120a2461222f..3eaefa8691e133b8f4829781c22dbcbcb86307ca 100644 (file)
@@ -49,6 +49,11 @@ DumpCriticalPathLength("misched-dcpl", cl::Hidden,
 static cl::opt<bool> ViewMISchedDAGs("view-misched-dags", cl::Hidden,
   cl::desc("Pop up a window to show MISched dags after they are processed"));
 
+/// In some situations a few uninteresting nodes depend on nearly all other
+/// nodes in the graph, provide a cutoff to hide them.
+static cl::opt<unsigned> ViewMISchedCutoff("view-misched-cutoff", cl::Hidden,
+  cl::desc("Hide nodes with more predecessor/successor than cutoff"));
+
 static cl::opt<unsigned> MISchedCutoff("misched-cutoff", cl::Hidden,
   cl::desc("Stop scheduling after N instructions"), cl::init(~0U));
 
@@ -873,8 +878,8 @@ void ScheduleDAGMILive::initRegPressure() {
   DEBUG(RPTracker.dump());
 
   // Initialize the live ins and live outs.
-  TopRPTracker.addLiveRegs(RPTracker.getPressure().LiveInRegs);
-  BotRPTracker.addLiveRegs(RPTracker.getPressure().LiveOutRegs);
+  TopRPTracker.addLiveRegs(RPTracker.getLiveIn());
+  BotRPTracker.addLiveRegs(RPTracker.getLiveOut());
 
   // Close one end of the tracker so we can call
   // getMaxUpward/DownwardPressureDelta before advancing across any
@@ -891,7 +896,7 @@ void ScheduleDAGMILive::initRegPressure() {
 
   // For each live out vreg reduce the pressure change associated with other
   // uses of the same vreg below the live-out reaching def.
-  updatePressureDiffs(RPTracker.getPressure().LiveOutRegs);
+  updatePressureDiffs(RPTracker.getLiveOut());
 
   // Account for liveness generated by the region boundary.
   if (LiveRegionEnd != RegionEnd) {
@@ -1130,7 +1135,7 @@ unsigned ScheduleDAGMILive::computeCyclicCriticalPath() {
 
   unsigned MaxCyclicLatency = 0;
   // Visit each live out vreg def to find def/use pairs that cross iterations.
-  ArrayRef<unsigned> LiveOuts = RPTracker.getPressure().LiveOutRegs;
+  ArrayRef<unsigned> LiveOuts = RPTracker.getLiveOut();
   for (ArrayRef<unsigned>::iterator RI = LiveOuts.begin(), RE = LiveOuts.end();
        RI != RE; ++RI) {
     unsigned Reg = *RI;
@@ -3278,7 +3283,10 @@ struct DOTGraphTraits<ScheduleDAGMI*> : public DefaultDOTGraphTraits {
   }
 
   static bool isNodeHidden(const SUnit *Node) {
-    return (Node->Preds.size() > 10 || Node->Succs.size() > 10);
+    if (ViewMISchedCutoff == 0)
+      return false;
+    return (Node->Preds.size() > ViewMISchedCutoff
+         || Node->Succs.size() > ViewMISchedCutoff);
   }
 
   static bool hasNodeAddressLabel(const SUnit *Node,