Add initial support for back-scheduling address computations,
[oota-llvm.git] / lib / CodeGen / LatencyPriorityQueue.cpp
index 7ad9ac9b51cfd5881f2d3b0533d3d11f9650294e..2e7b89c494f6fee6112735dcb960f8ea77cbac69 100644 (file)
 using namespace llvm;
 
 bool latency_sort::operator()(const SUnit *LHS, const SUnit *RHS) const {
+  // The isScheduleHigh flag allows nodes with wraparound dependencies that
+  // cannot easily be modeled as edges with latencies to be scheduled as
+  // soon as possible in a top-down schedule.
+  if (LHS->isScheduleHigh && !RHS->isScheduleHigh)
+    return false;
+  if (!LHS->isScheduleHigh && RHS->isScheduleHigh)
+    return true;
+
   unsigned LHSNum = LHS->NodeNum;
   unsigned RHSNum = RHS->NodeNum;