diff options
author | Dan Gohman <gohman@apple.com> | 2008-06-23 23:40:09 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-06-23 23:40:09 +0000 |
commit | aabdded3b4e8b87e586c6fed7d0f1d6906eb3351 (patch) | |
tree | c04b7bd203dc6d89d3072ab9b21de1a0ff2b2095 | |
parent | 72e04099c6f3d365b36b48834c8cd2f87efc00c2 (diff) |
Use the new PriorityQueue in ScheduleDAGList too, which also
needs arbitrary-element removal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52654 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp index ab6e92db46..40c26c290c 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp @@ -28,9 +28,9 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" +#include "llvm/ADT/PriorityQueue.h" #include "llvm/ADT/Statistic.h" #include <climits> -#include <queue> using namespace llvm; STATISTIC(NumNoops , "Number of noops inserted"); @@ -315,7 +315,7 @@ namespace { /// mobility. std::vector<unsigned> NumNodesSolelyBlocking; - std::priority_queue<SUnit*, std::vector<SUnit*>, latency_sort> Queue; + PriorityQueue<SUnit*, std::vector<SUnit*>, latency_sort> Queue; public: LatencyPriorityQueue() : Queue(latency_sort(this)) { } @@ -373,25 +373,9 @@ public: return V; } - /// remove - This is a really inefficient way to remove a node from a - /// priority queue. We should roll our own heap to make this better or - /// something. void remove(SUnit *SU) { - std::vector<SUnit*> Temp; - assert(!Queue.empty() && "Not in queue!"); - while (Queue.top() != SU) { - Temp.push_back(Queue.top()); - Queue.pop(); - assert(!Queue.empty() && "Not in queue!"); - } - - // Remove the node from the PQ. - Queue.pop(); - - // Add all the other nodes back. - for (unsigned i = 0, e = Temp.size(); i != e; ++i) - Queue.push(Temp[i]); + Queue.erase_one(SU); } // ScheduledNode - As nodes are scheduled, we look to see if there are any |