summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-05-30 18:05:39 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-05-30 18:05:39 +0000
commit6b8e5a93183ab08811b7b71887d8c7d774666210 (patch)
treef2ac9cc3561b20a7be2c45d30330f35e07105b3a /lib/CodeGen/SelectionDAG
parent19564e3d83c9c3cdf908005c91bad13d26b5cedf (diff)
downloadllvm-6b8e5a93183ab08811b7b71887d8c7d774666210.tar.gz
llvm-6b8e5a93183ab08811b7b71887d8c7d774666210.tar.bz2
llvm-6b8e5a93183ab08811b7b71887d8c7d774666210.tar.xz
Make sure the register pressure reduction schedulers work for non-uniform
latency targets, e.g. PPC32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28561 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
index 09c0af905e..9028248861 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -63,8 +63,8 @@ public:
private:
void ReleasePred(SUnit *PredSU, bool isChain, unsigned CurCycle);
void ReleaseSucc(SUnit *SuccSU, bool isChain, unsigned CurCycle);
- void ScheduleNodeBottomUp(SUnit *SU, unsigned& CurCycle);
- void ScheduleNodeTopDown(SUnit *SU, unsigned& CurCycle);
+ void ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle);
+ void ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle);
void ListScheduleTopDown();
void ListScheduleBottomUp();
void CommuteNodesToReducePressure();
@@ -78,8 +78,6 @@ void ScheduleDAGRRList::Schedule() {
// Build scheduling units.
BuildSchedUnits();
- DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
- SUnits[su].dumpAll(&DAG));
CalculateDepths();
CalculateHeights();
@@ -217,7 +215,7 @@ void ScheduleDAGRRList::ReleasePred(SUnit *PredSU, bool isChain,
/// ScheduleNodeBottomUp - 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 ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned& CurCycle) {
+void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
DEBUG(std::cerr << "*** Scheduling [" << CurCycle << "]: ");
DEBUG(SU->dump(&DAG));
SU->Cycle = CurCycle;
@@ -230,7 +228,6 @@ void ScheduleDAGRRList::ScheduleNodeBottomUp(SUnit *SU, unsigned& CurCycle) {
E = SU->Preds.end(); I != E; ++I)
ReleasePred(I->first, I->second, CurCycle);
SU->isScheduled = true;
- CurCycle++;
}
/// isReady - True if node's lower cycle bound is less or equal to the current
@@ -252,7 +249,7 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
SUnit *CurNode = NULL;
while (!AvailableQueue->empty()) {
SUnit *CurNode = AvailableQueue->pop();
- while (!isReady(CurNode, CurCycle)) {
+ while (CurNode && !isReady(CurNode, CurCycle)) {
NotReady.push_back(CurNode);
CurNode = AvailableQueue->pop();
}
@@ -261,7 +258,9 @@ void ScheduleDAGRRList::ListScheduleBottomUp() {
AvailableQueue->push_all(NotReady);
NotReady.clear();
- ScheduleNodeBottomUp(CurNode, CurCycle);
+ if (CurNode != NULL)
+ ScheduleNodeBottomUp(CurNode, CurCycle);
+ CurCycle++;
}
// Add entry node last
@@ -328,7 +327,7 @@ void ScheduleDAGRRList::ReleaseSucc(SUnit *SuccSU, bool isChain,
/// ScheduleNodeTopDown - Add the node to the schedule. Decrement the pending
/// count of its successors. If a successor pending count is zero, add it to
/// the Available queue.
-void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned& CurCycle) {
+void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned CurCycle) {
DEBUG(std::cerr << "*** Scheduling [" << CurCycle << "]: ");
DEBUG(SU->dump(&DAG));
SU->Cycle = CurCycle;
@@ -341,7 +340,6 @@ void ScheduleDAGRRList::ScheduleNodeTopDown(SUnit *SU, unsigned& CurCycle) {
E = SU->Succs.end(); I != E; ++I)
ReleaseSucc(I->first, I->second, CurCycle);
SU->isScheduled = true;
- CurCycle++;
}
void ScheduleDAGRRList::ListScheduleTopDown() {
@@ -359,6 +357,7 @@ void ScheduleDAGRRList::ListScheduleTopDown() {
// Emit the entry node first.
ScheduleNodeTopDown(Entry, CurCycle);
+ CurCycle++;
// While Available queue is not empty, grab the node with the highest
// priority. If it is not ready put it back. Schedule the node.
@@ -366,7 +365,7 @@ void ScheduleDAGRRList::ListScheduleTopDown() {
SUnit *CurNode = NULL;
while (!AvailableQueue->empty()) {
SUnit *CurNode = AvailableQueue->pop();
- while (!isReady(CurNode, CurCycle)) {
+ while (CurNode && !isReady(CurNode, CurCycle)) {
NotReady.push_back(CurNode);
CurNode = AvailableQueue->pop();
}
@@ -375,7 +374,9 @@ void ScheduleDAGRRList::ListScheduleTopDown() {
AvailableQueue->push_all(NotReady);
NotReady.clear();
- ScheduleNodeTopDown(CurNode, CurCycle);
+ if (CurNode != NULL)
+ ScheduleNodeTopDown(CurNode, CurCycle);
+ CurCycle++;
}
@@ -453,6 +454,7 @@ namespace {
}
SUnit *pop() {
+ if (empty()) return NULL;
SUnit *V = Queue.top();
Queue.pop();
return V;