aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-05 20:21:55 +0000
committerChris Lattner <sabre@nondot.org>2006-03-05 20:21:55 +0000
commit41f5ea06659026f149915009217f7caeb463cc53 (patch)
tree7f56ffd3b64a3d663ca67aeb4a197a933b1547e5
parent5b0fe7d91dde915ebc4d78d01be4ddd3f0bb57f4 (diff)
downloadexternal_llvm-41f5ea06659026f149915009217f7caeb463cc53.zip
external_llvm-41f5ea06659026f149915009217f7caeb463cc53.tar.gz
external_llvm-41f5ea06659026f149915009217f7caeb463cc53.tar.bz2
Move the available queue to being inside the ListSchedule method, since it
bounds its lifetime. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26550 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
index 3669863..553455a 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
@@ -164,8 +164,6 @@ class ScheduleDAGList : public ScheduleDAG {
private:
// SDNode to SUnit mapping (many to one).
std::map<SDNode*, SUnit*> SUnitMap;
- // Available queue.
- std::priority_queue<SUnit*, std::vector<SUnit*>, ls_rr_sort> Available;
// The schedule.
std::vector<SUnit*> Sequence;
// Current scheduling cycle.
@@ -173,6 +171,9 @@ private:
// First and last SUnit created.
SUnit *HeadSUnit, *TailSUnit;
+ typedef std::priority_queue<SUnit*, std::vector<SUnit*>, ls_rr_sort>
+ AvailableQueueTy;
+
public:
ScheduleDAGList(SelectionDAG &dag, MachineBasicBlock *bb,
const TargetMachine &tm)
@@ -194,8 +195,8 @@ public:
private:
SUnit *NewSUnit(SDNode *N);
- void ReleasePred(SUnit *PredSU, bool isChain = false);
- void ScheduleNode(SUnit *SU);
+ void ReleasePred(AvailableQueueTy &Avail,SUnit *PredSU, bool isChain = false);
+ void ScheduleNode(AvailableQueueTy &Avail, SUnit *SU);
int CalcNodePriority(SUnit *SU);
void CalculatePriorities();
void ListSchedule();
@@ -220,7 +221,8 @@ SUnit *ScheduleDAGList::NewSUnit(SDNode *N) {
/// ReleasePred - Decrement the NumSuccsLeft count of a predecessor. Add it to
/// the Available queue is the count reaches zero. Also update its cycle bound.
-void ScheduleDAGList::ReleasePred(SUnit *PredSU, bool isChain) {
+void ScheduleDAGList::ReleasePred(AvailableQueueTy &Available,
+ SUnit *PredSU, bool isChain) {
SDNode *PredNode = PredSU->Node;
// FIXME: the distance between two nodes is not always == the predecessor's
@@ -251,7 +253,7 @@ void ScheduleDAGList::ReleasePred(SUnit *PredSU, bool isChain) {
/// ScheduleNode - Add the node to the schedule. Decrement the pending count of
/// its predecessors. If a predecessor pending count is zero, add it to the
/// Available queue.
-void ScheduleDAGList::ScheduleNode(SUnit *SU) {
+void ScheduleDAGList::ScheduleNode(AvailableQueueTy &Available, SUnit *SU) {
DEBUG(std::cerr << "*** Scheduling: ");
DEBUG(SU->dump(&DAG, false));
@@ -261,13 +263,13 @@ void ScheduleDAGList::ScheduleNode(SUnit *SU) {
// Bottom up: release predecessors
for (std::set<SUnit*>::iterator I1 = SU->Preds.begin(),
E1 = SU->Preds.end(); I1 != E1; ++I1) {
- ReleasePred(*I1);
+ ReleasePred(Available, *I1);
SU->NumPredsLeft--;
SU->Priority1--;
}
for (std::set<SUnit*>::iterator I2 = SU->ChainPreds.begin(),
E2 = SU->ChainPreds.end(); I2 != E2; ++I2)
- ReleasePred(*I2, true);
+ ReleasePred(Available, *I2, true);
CurrCycle++;
}
@@ -280,7 +282,10 @@ static inline bool isReady(SUnit *SU, unsigned CurrCycle) {
/// ListSchedule - The main loop of list scheduling.
void ScheduleDAGList::ListSchedule() {
- // Add root to Available queue
+ // Available queue.
+ AvailableQueueTy Available;
+
+ // Add root to Available queue.
SUnit *Root = SUnitMap[DAG.getRoot().Val];
Available.push(Root);
@@ -300,7 +305,7 @@ void ScheduleDAGList::ListSchedule() {
for (unsigned i = 0, e = NotReady.size(); i != e; ++i)
Available.push(NotReady[i]);
- ScheduleNode(CurrNode);
+ ScheduleNode(Available, CurrNode);
}
// Add entry node last