forked from OSchip/llvm-project
Use the new PriorityQueue in ScheduleDAGList too, which also
needs arbitrary-element removal. llvm-svn: 52654
This commit is contained in:
parent
0cfc16100b
commit
0d8a61eb60
|
@ -28,9 +28,9 @@
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
|
#include "llvm/ADT/PriorityQueue.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <queue>
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
STATISTIC(NumNoops , "Number of noops inserted");
|
STATISTIC(NumNoops , "Number of noops inserted");
|
||||||
|
@ -315,7 +315,7 @@ namespace {
|
||||||
/// mobility.
|
/// mobility.
|
||||||
std::vector<unsigned> NumNodesSolelyBlocking;
|
std::vector<unsigned> NumNodesSolelyBlocking;
|
||||||
|
|
||||||
std::priority_queue<SUnit*, std::vector<SUnit*>, latency_sort> Queue;
|
PriorityQueue<SUnit*, std::vector<SUnit*>, latency_sort> Queue;
|
||||||
public:
|
public:
|
||||||
LatencyPriorityQueue() : Queue(latency_sort(this)) {
|
LatencyPriorityQueue() : Queue(latency_sort(this)) {
|
||||||
}
|
}
|
||||||
|
@ -373,25 +373,9 @@ public:
|
||||||
return V;
|
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) {
|
void remove(SUnit *SU) {
|
||||||
std::vector<SUnit*> Temp;
|
|
||||||
|
|
||||||
assert(!Queue.empty() && "Not in queue!");
|
assert(!Queue.empty() && "Not in queue!");
|
||||||
while (Queue.top() != SU) {
|
Queue.erase_one(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]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScheduledNode - As nodes are scheduled, we look to see if there are any
|
// ScheduledNode - As nodes are scheduled, we look to see if there are any
|
||||||
|
|
Loading…
Reference in New Issue