aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-10 04:32:49 +0000
committerChris Lattner <sabre@nondot.org>2006-03-10 04:32:49 +0000
commitf83a47d905f4c6a4d1099bc5e1963c84af5300ee (patch)
tree9ba7320087d778352efc76122450eb64c9c6fdf7
parentd144a24d3d1cbf72b02fd9ad4336de7e4c7ea9e4 (diff)
downloadexternal_llvm-f83a47d905f4c6a4d1099bc5e1963c84af5300ee.zip
external_llvm-f83a47d905f4c6a4d1099bc5e1963c84af5300ee.tar.gz
external_llvm-f83a47d905f4c6a4d1099bc5e1963c84af5300ee.tar.bz2
add an aggregate method for reinserting scheduled nodes, add a callback for
priority impls that want to be notified when a node is scheduled git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26678 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
index 202bfa3..fd05980 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
@@ -141,7 +141,14 @@ public:
virtual bool empty() const = 0;
virtual void push(SUnit *U) = 0;
+
+ virtual void push_all(const std::vector<SUnit *> &Nodes) = 0;
virtual SUnit *pop() = 0;
+
+ /// ScheduledNode - As each node is scheduled, this method is invoked. This
+ /// allows the priority function to adjust the priority of node that have
+ /// already been emitted.
+ virtual void ScheduledNode(SUnit *Node) {}
};
}
@@ -340,11 +347,10 @@ void ScheduleDAGList::ListScheduleBottomUp() {
}
// Add the nodes that aren't ready back onto the available list.
- while (!NotReady.empty()) {
- PriorityQueue->push(NotReady.back());
- NotReady.pop_back();
- }
+ PriorityQueue->push_all(NotReady);
+ NotReady.clear();
+ PriorityQueue->ScheduledNode(CurrNode);
ScheduleNodeBottomUp(CurrNode);
}
@@ -421,13 +427,12 @@ void ScheduleDAGList::ListScheduleTopDown() {
} while (!PriorityQueue->empty());
// Add the nodes that aren't ready back onto the available list.
- while (!NotReady.empty()) {
- PriorityQueue->push(NotReady.back());
- NotReady.pop_back();
- }
+ PriorityQueue->push_all(NotReady);
+ NotReady.clear();
// If we found a node to schedule, do it now.
if (FoundNode) {
+ PriorityQueue->ScheduledNode(FoundNode);
ScheduleNodeTopDown(FoundNode);
HazardRec->EmitInstruction(FoundNode->Node);
} else if (!HasNoopHazards) {
@@ -700,6 +705,11 @@ namespace {
void push(SUnit *U) {
Queue.push(U);
}
+ void push_all(const std::vector<SUnit *> &Nodes) {
+ for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
+ Queue.push(Nodes[i]);
+ }
+
SUnit *pop() {
SUnit *V = Queue.top();
Queue.pop();
@@ -843,6 +853,11 @@ public:
void push(SUnit *U) {
Queue.push(U);
}
+ void push_all(const std::vector<SUnit *> &Nodes) {
+ for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
+ Queue.push(Nodes[i]);
+ }
+
SUnit *pop() {
SUnit *V = Queue.top();
Queue.pop();