Use SUnit's CycleBound field instead of duplicating it in

a side-car datastructure


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59458 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2008-11-17 19:45:19 +00:00
parent 3d631c2d5d
commit 2dcca9d53e

View File

@ -55,9 +55,8 @@ private:
/// PendingQueue - This contains all of the instructions whose operands have /// PendingQueue - This contains all of the instructions whose operands have
/// been issued, but their results are not ready yet (due to the latency of /// been issued, but their results are not ready yet (due to the latency of
/// the operation). Once the operands becomes available, the instruction is /// the operation). Once the operands becomes available, the instruction is
/// added to the AvailableQueue. This keeps track of each SUnit and the /// added to the AvailableQueue.
/// number of cycles left to execute before the operation is available. std::vector<SUnit*> PendingQueue;
std::vector<std::pair<unsigned, SUnit*> > PendingQueue;
/// HazardRec - The hazard recognizer to use. /// HazardRec - The hazard recognizer to use.
HazardRecognizer *HazardRec; HazardRecognizer *HazardRec;
@ -134,7 +133,9 @@ void ScheduleDAGList::ReleaseSucc(SUnit *SuccSU, bool isChain) {
AvailableCycle = std::max(AvailableCycle, PredDoneCycle); AvailableCycle = std::max(AvailableCycle, PredDoneCycle);
} }
PendingQueue.push_back(std::make_pair(AvailableCycle, SuccSU)); assert(SuccSU->CycleBound == 0 && "CycleBound already assigned!");
SuccSU->CycleBound = AvailableCycle;
PendingQueue.push_back(SuccSU);
} }
} }
@ -176,14 +177,14 @@ void ScheduleDAGList::ListScheduleTopDown() {
// Check to see if any of the pending instructions are ready to issue. If // Check to see if any of the pending instructions are ready to issue. If
// so, add them to the available queue. // so, add them to the available queue.
for (unsigned i = 0, e = PendingQueue.size(); i != e; ++i) { for (unsigned i = 0, e = PendingQueue.size(); i != e; ++i) {
if (PendingQueue[i].first == CurCycle) { if (PendingQueue[i]->CycleBound == CurCycle) {
AvailableQueue->push(PendingQueue[i].second); AvailableQueue->push(PendingQueue[i]);
PendingQueue[i].second->isAvailable = true; PendingQueue[i]->isAvailable = true;
PendingQueue[i] = PendingQueue.back(); PendingQueue[i] = PendingQueue.back();
PendingQueue.pop_back(); PendingQueue.pop_back();
--i; --e; --i; --e;
} else { } else {
assert(PendingQueue[i].first > CurCycle && "Negative latency?"); assert(PendingQueue[i]->CycleBound > CurCycle && "Negative latency?");
} }
} }