Esempio n. 1
0
void LatencyPriorityQueue::dump(ScheduleDAG *DAG) const {
    LatencyPriorityQueue q = *this;
    while (!q.empty()) {
        SUnit *su = q.pop();
        dbgs() << "Height " << su->getHeight() << ": ";
        su->dump(DAG);
    }
}
void PatmosLatencyQueue::dump()
{
  dbgs() << "PendingQueue:";
  for (unsigned i = 0; i < PendingQueue.size(); i++) {
    SUnit *SU = PendingQueue[i];
    if (i > 0) dbgs() << ",";
    dbgs() << " SU(" << SU->NodeNum << "): Height " << SU->getHeight()
           << " Depth " << SU->getDepth()
           << " Tree: " << Cmp.DFSResult->getSubtreeID(SU) << " @"
           << Cmp.DFSResult->getSubtreeLevel(Cmp.DFSResult->getSubtreeID(SU));
    if (SU->isScheduleLow) dbgs() << " low ";
  }
  dbgs() << "\nAvailableQueue:";
  for (unsigned i = 0; i < AvailableQueue.size(); i++) {
    SUnit *SU = AvailableQueue[i];
    if (i > 0) dbgs() << ",";
    dbgs() << " SU(" << SU->NodeNum << ") Height " << SU->getHeight()
           << " Depth " << SU->getDepth()
           << " ILP: " << Cmp.DFSResult->getILP(SU);
    if (SU->isScheduleLow) dbgs() << " low ";
  }
  dbgs() << "\n";
}
/// Go back one cycle and update availability queue.
void PatmosLatencyQueue::recedeCycle(unsigned CurrCycle)
{
  unsigned avail = 0;
  for (unsigned i = 0; i < PendingQueue.size() - avail; i++) {
    SUnit *SU = PendingQueue[i];

    if (SU->getHeight() <= CurrCycle) {
      // remove the instruction from pending
      avail++;
      PendingQueue[i] = *(PendingQueue.end() - avail);
      // revisit the moved instruction
      i--;

      // Make the instruction available
      AvailableQueue.push_back(SU);
      std::inplace_merge(AvailableQueue.begin(), AvailableQueue.end() - 1,
                         AvailableQueue.end(), Cmp);
    }
  }

  PendingQueue.resize(PendingQueue.size() - avail);
}