Change push_all to a non-virtual function and implement it in the

base class, since all the implementations are the same.

llvm-svn: 104659
This commit is contained in:
Dan Gohman 2010-05-26 01:10:55 +00:00
parent ba28c900a2
commit 59cddd1327
4 changed files with 8 additions and 16 deletions

View File

@ -75,15 +75,7 @@ public:
bool empty() const { return Queue.empty(); }
virtual void push(SUnit *U) {
push_impl(U);
}
void push_impl(SUnit *U);
void push_all(const std::vector<SUnit *> &Nodes) {
for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
push_impl(Nodes[i]);
}
virtual void push(SUnit *U);
SUnit *pop() {
if (empty()) return NULL;

View File

@ -427,7 +427,12 @@ namespace llvm {
virtual bool empty() const = 0;
virtual void push(SUnit *U) = 0;
virtual void push_all(const std::vector<SUnit *> &Nodes) = 0;
void push_all(const std::vector<SUnit *> &Nodes) {
for (std::vector<SUnit *>::const_iterator I = Nodes.begin(),
E = Nodes.end(); I != E; ++I)
push(*I);
}
virtual SUnit *pop() = 0;
virtual void remove(SUnit *SU) = 0;

View File

@ -68,7 +68,7 @@ SUnit *LatencyPriorityQueue::getSingleUnscheduledPred(SUnit *SU) {
return OnlyAvailablePred;
}
void LatencyPriorityQueue::push_impl(SUnit *SU) {
void LatencyPriorityQueue::push(SUnit *SU) {
// Look at all of the successors of this node. Count the number of nodes that
// this node is the sole unscheduled node for.
unsigned NumNodesBlocking = 0;

View File

@ -1115,11 +1115,6 @@ namespace {
Queue.push(U);
}
void push_all(const std::vector<SUnit *> &Nodes) {
for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
push(Nodes[i]);
}
SUnit *pop() {
if (empty()) return NULL;
SUnit *V = Queue.top();