blob: 5637d923df16c0222af65b6da14ec00f25d0d51f [file] [log] [blame]
Evan Chengab495562006-01-25 09:14:32 +00001//===---- ScheduleDAGList.cpp - Implement a list scheduler for isel DAG ---===//
Evan Cheng31272342006-01-23 08:26:10 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Evan Cheng and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Chris Lattner01aa7522006-03-06 17:58:04 +000010// This implements bottom-up and top-down list schedulers, using standard
11// algorithms. The basic approach uses a priority queue of available nodes to
12// schedule. One at a time, nodes are taken from the priority queue (thus in
13// priority order), checked for legality to schedule, and emitted if legal.
14//
15// Nodes may not be legal to schedule either due to structural hazards (e.g.
16// pipeline or resource constraints) or because an input to the instruction has
17// not completed execution.
Evan Cheng31272342006-01-23 08:26:10 +000018//
19//===----------------------------------------------------------------------===//
20
21#define DEBUG_TYPE "sched"
22#include "llvm/CodeGen/ScheduleDAG.h"
Evan Cheng31272342006-01-23 08:26:10 +000023#include "llvm/Target/TargetMachine.h"
24#include "llvm/Target/TargetInstrInfo.h"
Evan Chengab495562006-01-25 09:14:32 +000025#include "llvm/Support/Debug.h"
Chris Lattnerfa5e1c92006-03-05 23:13:56 +000026#include "llvm/ADT/Statistic.h"
Evan Chengab495562006-01-25 09:14:32 +000027#include <climits>
28#include <iostream>
Evan Cheng31272342006-01-23 08:26:10 +000029#include <queue>
Evan Cheng4e3904f2006-03-02 21:38:29 +000030#include <set>
31#include <vector>
Evan Cheng31272342006-01-23 08:26:10 +000032using namespace llvm;
33
Evan Chengab495562006-01-25 09:14:32 +000034namespace {
Chris Lattnerfa5e1c92006-03-05 23:13:56 +000035 Statistic<> NumNoops ("scheduler", "Number of noops inserted");
36 Statistic<> NumStalls("scheduler", "Number of pipeline stalls");
Evan Cheng31272342006-01-23 08:26:10 +000037
Chris Lattner12c6d892006-03-08 04:41:06 +000038 /// SUnit - Scheduling unit. It's an wrapper around either a single SDNode or
39 /// a group of nodes flagged together.
Chris Lattneraf5e26c2006-03-08 04:37:58 +000040 struct SUnit {
41 SDNode *Node; // Representative node.
42 std::vector<SDNode*> FlaggedNodes; // All nodes flagged to Node.
43 std::set<SUnit*> Preds; // All real predecessors.
44 std::set<SUnit*> ChainPreds; // All chain predecessors.
45 std::set<SUnit*> Succs; // All real successors.
46 std::set<SUnit*> ChainSuccs; // All chain successors.
Chris Lattner12c6d892006-03-08 04:41:06 +000047 short NumPredsLeft; // # of preds not scheduled.
48 short NumSuccsLeft; // # of succs not scheduled.
49 short NumChainPredsLeft; // # of chain preds not scheduled.
50 short NumChainSuccsLeft; // # of chain succs not scheduled.
Chris Lattner12c6d892006-03-08 04:41:06 +000051 bool isTwoAddress : 1; // Is a two-address instruction.
52 bool isDefNUseOperand : 1; // Is a def&use operand.
53 unsigned short Latency; // Node latency.
Chris Lattneraf5e26c2006-03-08 04:37:58 +000054 unsigned CycleBound; // Upper/lower cycle to be scheduled at.
Chris Lattnerfd22d422006-03-08 05:18:27 +000055 unsigned NodeNum; // Entry # of node in the node vector.
Chris Lattneraf5e26c2006-03-08 04:37:58 +000056
Chris Lattnerfd22d422006-03-08 05:18:27 +000057 SUnit(SDNode *node, unsigned nodenum)
Chris Lattneraf5e26c2006-03-08 04:37:58 +000058 : Node(node), NumPredsLeft(0), NumSuccsLeft(0),
Evan Cheng4e3904f2006-03-02 21:38:29 +000059 NumChainPredsLeft(0), NumChainSuccsLeft(0),
Evan Cheng5e9a6952006-03-03 06:23:43 +000060 isTwoAddress(false), isDefNUseOperand(false),
Chris Lattnerfd22d422006-03-08 05:18:27 +000061 Latency(0), CycleBound(0), NodeNum(nodenum) {}
Chris Lattneraf5e26c2006-03-08 04:37:58 +000062
63 void dump(const SelectionDAG *G, bool All=true) const;
64 };
65}
Evan Chengab495562006-01-25 09:14:32 +000066
67void SUnit::dump(const SelectionDAG *G, bool All) const {
Evan Chengc4c339c2006-01-26 00:30:29 +000068 std::cerr << "SU: ";
Evan Chengab495562006-01-25 09:14:32 +000069 Node->dump(G);
70 std::cerr << "\n";
Evan Chengab495562006-01-25 09:14:32 +000071 if (FlaggedNodes.size() != 0) {
Evan Chengab495562006-01-25 09:14:32 +000072 for (unsigned i = 0, e = FlaggedNodes.size(); i != e; i++) {
Evan Chengc4c339c2006-01-26 00:30:29 +000073 std::cerr << " ";
Evan Chengab495562006-01-25 09:14:32 +000074 FlaggedNodes[i]->dump(G);
75 std::cerr << "\n";
76 }
77 }
78
79 if (All) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +000080 std::cerr << " # preds left : " << NumPredsLeft << "\n";
81 std::cerr << " # succs left : " << NumSuccsLeft << "\n";
82 std::cerr << " # chain preds left : " << NumChainPredsLeft << "\n";
83 std::cerr << " # chain succs left : " << NumChainSuccsLeft << "\n";
84 std::cerr << " Latency : " << Latency << "\n";
Evan Chengc4c339c2006-01-26 00:30:29 +000085
Evan Chengab495562006-01-25 09:14:32 +000086 if (Preds.size() != 0) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +000087 std::cerr << " Predecessors:\n";
Jeff Cohen55c11732006-03-03 03:25:07 +000088 for (std::set<SUnit*>::const_iterator I = Preds.begin(),
Evan Cheng4e3904f2006-03-02 21:38:29 +000089 E = Preds.end(); I != E; ++I) {
Evan Chengab495562006-01-25 09:14:32 +000090 std::cerr << " ";
Evan Cheng4e3904f2006-03-02 21:38:29 +000091 (*I)->dump(G, false);
Evan Chengab495562006-01-25 09:14:32 +000092 }
93 }
94 if (ChainPreds.size() != 0) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +000095 std::cerr << " Chained Preds:\n";
Jeff Cohen55c11732006-03-03 03:25:07 +000096 for (std::set<SUnit*>::const_iterator I = ChainPreds.begin(),
Evan Cheng4e3904f2006-03-02 21:38:29 +000097 E = ChainPreds.end(); I != E; ++I) {
Evan Chengab495562006-01-25 09:14:32 +000098 std::cerr << " ";
Evan Cheng4e3904f2006-03-02 21:38:29 +000099 (*I)->dump(G, false);
Evan Chengab495562006-01-25 09:14:32 +0000100 }
101 }
102 if (Succs.size() != 0) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000103 std::cerr << " Successors:\n";
Jeff Cohen55c11732006-03-03 03:25:07 +0000104 for (std::set<SUnit*>::const_iterator I = Succs.begin(),
Evan Cheng4e3904f2006-03-02 21:38:29 +0000105 E = Succs.end(); I != E; ++I) {
Evan Chengab495562006-01-25 09:14:32 +0000106 std::cerr << " ";
Evan Cheng4e3904f2006-03-02 21:38:29 +0000107 (*I)->dump(G, false);
Evan Chengab495562006-01-25 09:14:32 +0000108 }
109 }
110 if (ChainSuccs.size() != 0) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000111 std::cerr << " Chained succs:\n";
Jeff Cohen55c11732006-03-03 03:25:07 +0000112 for (std::set<SUnit*>::const_iterator I = ChainSuccs.begin(),
Evan Cheng4e3904f2006-03-02 21:38:29 +0000113 E = ChainSuccs.end(); I != E; ++I) {
Evan Chengab495562006-01-25 09:14:32 +0000114 std::cerr << " ";
Evan Cheng4e3904f2006-03-02 21:38:29 +0000115 (*I)->dump(G, false);
Evan Chengab495562006-01-25 09:14:32 +0000116 }
117 }
118 }
119}
120
Chris Lattner9df64752006-03-09 06:35:14 +0000121//===----------------------------------------------------------------------===//
Chris Lattner9e95acc2006-03-09 06:37:29 +0000122/// SchedulingPriorityQueue - This interface is used to plug different
123/// priorities computation algorithms into the list scheduler. It implements the
124/// interface of a standard priority queue, where nodes are inserted in
125/// arbitrary order and returned in priority order. The computation of the
126/// priority and the representation of the queue are totally up to the
127/// implementation to decide.
128///
129namespace {
Chris Lattner9df64752006-03-09 06:35:14 +0000130class SchedulingPriorityQueue {
131public:
132 virtual ~SchedulingPriorityQueue() {}
Chris Lattnerfd22d422006-03-08 05:18:27 +0000133
Chris Lattner9df64752006-03-09 06:35:14 +0000134 virtual void initNodes(const std::vector<SUnit> &SUnits) = 0;
135 virtual void releaseState() = 0;
Chris Lattnerfd22d422006-03-08 05:18:27 +0000136
Chris Lattner9df64752006-03-09 06:35:14 +0000137 virtual bool empty() const = 0;
138 virtual void push(SUnit *U) = 0;
139 virtual SUnit *pop() = 0;
140};
Chris Lattner9e95acc2006-03-09 06:37:29 +0000141}
Chris Lattnerfd22d422006-03-08 05:18:27 +0000142
143
Chris Lattnere50c0922006-03-05 22:45:01 +0000144
Chris Lattneraf5e26c2006-03-08 04:37:58 +0000145namespace {
Chris Lattner9e95acc2006-03-09 06:37:29 +0000146//===----------------------------------------------------------------------===//
147/// ScheduleDAGList - The actual list scheduler implementation. This supports
148/// both top-down and bottom-up scheduling.
149///
Evan Cheng31272342006-01-23 08:26:10 +0000150class ScheduleDAGList : public ScheduleDAG {
151private:
Evan Chengab495562006-01-25 09:14:32 +0000152 // SDNode to SUnit mapping (many to one).
153 std::map<SDNode*, SUnit*> SUnitMap;
Chris Lattner00b52ea2006-03-05 23:59:20 +0000154 // The schedule. Null SUnit*'s represent noop instructions.
Evan Chengab495562006-01-25 09:14:32 +0000155 std::vector<SUnit*> Sequence;
156 // Current scheduling cycle.
157 unsigned CurrCycle;
Chris Lattner42e20262006-03-08 04:54:34 +0000158
159 // The scheduling units.
160 std::vector<SUnit> SUnits;
Evan Cheng31272342006-01-23 08:26:10 +0000161
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000162 /// isBottomUp - This is true if the scheduling problem is bottom-up, false if
163 /// it is top-down.
164 bool isBottomUp;
165
Chris Lattner9df64752006-03-09 06:35:14 +0000166 /// PriorityQueue - The priority queue to use.
167 SchedulingPriorityQueue *PriorityQueue;
168
Chris Lattnere50c0922006-03-05 22:45:01 +0000169 /// HazardRec - The hazard recognizer to use.
Chris Lattner543832d2006-03-08 04:25:59 +0000170 HazardRecognizer *HazardRec;
Chris Lattnere50c0922006-03-05 22:45:01 +0000171
Evan Cheng31272342006-01-23 08:26:10 +0000172public:
173 ScheduleDAGList(SelectionDAG &dag, MachineBasicBlock *bb,
Chris Lattnere50c0922006-03-05 22:45:01 +0000174 const TargetMachine &tm, bool isbottomup,
Chris Lattner9df64752006-03-09 06:35:14 +0000175 SchedulingPriorityQueue *priorityqueue,
Chris Lattner543832d2006-03-08 04:25:59 +0000176 HazardRecognizer *HR)
Evan Chengc4c339c2006-01-26 00:30:29 +0000177 : ScheduleDAG(listSchedulingBURR, dag, bb, tm),
Chris Lattner9df64752006-03-09 06:35:14 +0000178 CurrCycle(0), isBottomUp(isbottomup),
179 PriorityQueue(priorityqueue), HazardRec(HR) {
Chris Lattnere50c0922006-03-05 22:45:01 +0000180 }
Evan Chengab495562006-01-25 09:14:32 +0000181
182 ~ScheduleDAGList() {
Chris Lattner543832d2006-03-08 04:25:59 +0000183 delete HazardRec;
Chris Lattner9df64752006-03-09 06:35:14 +0000184 delete PriorityQueue;
Evan Chengab495562006-01-25 09:14:32 +0000185 }
Evan Cheng31272342006-01-23 08:26:10 +0000186
187 void Schedule();
Evan Cheng31272342006-01-23 08:26:10 +0000188
Evan Chengab495562006-01-25 09:14:32 +0000189 void dump() const;
190
191private:
Evan Chengc4c339c2006-01-26 00:30:29 +0000192 SUnit *NewSUnit(SDNode *N);
Chris Lattner399bee22006-03-09 06:48:37 +0000193 void ReleasePred(SUnit *PredSU, bool isChain = false);
194 void ReleaseSucc(SUnit *SuccSU, bool isChain = false);
195 void ScheduleNodeBottomUp(SUnit *SU);
196 void ScheduleNodeTopDown(SUnit *SU);
197 void ListScheduleTopDown();
198 void ListScheduleBottomUp();
Evan Chengab495562006-01-25 09:14:32 +0000199 void BuildSchedUnits();
200 void EmitSchedule();
201};
Chris Lattneraf5e26c2006-03-08 04:37:58 +0000202} // end anonymous namespace
Evan Chengab495562006-01-25 09:14:32 +0000203
Chris Lattner47639db2006-03-06 00:22:00 +0000204HazardRecognizer::~HazardRecognizer() {}
205
Evan Chengc4c339c2006-01-26 00:30:29 +0000206
207/// NewSUnit - Creates a new SUnit and return a ptr to it.
208SUnit *ScheduleDAGList::NewSUnit(SDNode *N) {
Chris Lattnerfd22d422006-03-08 05:18:27 +0000209 SUnits.push_back(SUnit(N, SUnits.size()));
Chris Lattner42e20262006-03-08 04:54:34 +0000210 return &SUnits.back();
Evan Chengc4c339c2006-01-26 00:30:29 +0000211}
212
213/// ReleasePred - Decrement the NumSuccsLeft count of a predecessor. Add it to
214/// the Available queue is the count reaches zero. Also update its cycle bound.
Chris Lattner399bee22006-03-09 06:48:37 +0000215void ScheduleDAGList::ReleasePred(SUnit *PredSU, bool isChain) {
Evan Cheng4e3904f2006-03-02 21:38:29 +0000216 // FIXME: the distance between two nodes is not always == the predecessor's
217 // latency. For example, the reader can very well read the register written
218 // by the predecessor later than the issue cycle. It also depends on the
219 // interrupt model (drain vs. freeze).
Chris Lattner12c6d892006-03-08 04:41:06 +0000220 PredSU->CycleBound = std::max(PredSU->CycleBound,CurrCycle + PredSU->Latency);
Evan Cheng4e3904f2006-03-02 21:38:29 +0000221
Evan Chengc5c06582006-03-06 06:08:54 +0000222 if (!isChain)
Evan Cheng4e3904f2006-03-02 21:38:29 +0000223 PredSU->NumSuccsLeft--;
Evan Chengc5c06582006-03-06 06:08:54 +0000224 else
Evan Cheng4e3904f2006-03-02 21:38:29 +0000225 PredSU->NumChainSuccsLeft--;
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000226
Evan Chengab495562006-01-25 09:14:32 +0000227#ifndef NDEBUG
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000228 if (PredSU->NumSuccsLeft < 0 || PredSU->NumChainSuccsLeft < 0) {
Evan Chengab495562006-01-25 09:14:32 +0000229 std::cerr << "*** List scheduling failed! ***\n";
230 PredSU->dump(&DAG);
231 std::cerr << " has been released too many times!\n";
232 assert(0);
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000233 }
Evan Chengab495562006-01-25 09:14:32 +0000234#endif
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000235
236 if ((PredSU->NumSuccsLeft + PredSU->NumChainSuccsLeft) == 0) {
237 // EntryToken has to go last! Special case it here.
238 if (PredSU->Node->getOpcode() != ISD::EntryToken)
Chris Lattner399bee22006-03-09 06:48:37 +0000239 PriorityQueue->push(PredSU);
Evan Chengab495562006-01-25 09:14:32 +0000240 }
Evan Chengab495562006-01-25 09:14:32 +0000241}
242
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000243/// ReleaseSucc - Decrement the NumPredsLeft count of a successor. Add it to
244/// the Available queue is the count reaches zero. Also update its cycle bound.
Chris Lattner399bee22006-03-09 06:48:37 +0000245void ScheduleDAGList::ReleaseSucc(SUnit *SuccSU, bool isChain) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000246 // FIXME: the distance between two nodes is not always == the predecessor's
247 // latency. For example, the reader can very well read the register written
248 // by the predecessor later than the issue cycle. It also depends on the
249 // interrupt model (drain vs. freeze).
Chris Lattner12c6d892006-03-08 04:41:06 +0000250 SuccSU->CycleBound = std::max(SuccSU->CycleBound,CurrCycle + SuccSU->Latency);
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000251
Evan Chengc5c06582006-03-06 06:08:54 +0000252 if (!isChain)
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000253 SuccSU->NumPredsLeft--;
Evan Chengc5c06582006-03-06 06:08:54 +0000254 else
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000255 SuccSU->NumChainPredsLeft--;
256
257#ifndef NDEBUG
258 if (SuccSU->NumPredsLeft < 0 || SuccSU->NumChainPredsLeft < 0) {
259 std::cerr << "*** List scheduling failed! ***\n";
260 SuccSU->dump(&DAG);
261 std::cerr << " has been released too many times!\n";
262 abort();
263 }
264#endif
265
266 if ((SuccSU->NumPredsLeft + SuccSU->NumChainPredsLeft) == 0)
Chris Lattner399bee22006-03-09 06:48:37 +0000267 PriorityQueue->push(SuccSU);
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000268}
269
270/// ScheduleNodeBottomUp - Add the node to the schedule. Decrement the pending
271/// count of its predecessors. If a predecessor pending count is zero, add it to
272/// the Available queue.
Chris Lattner399bee22006-03-09 06:48:37 +0000273void ScheduleDAGList::ScheduleNodeBottomUp(SUnit *SU) {
Evan Cheng5e9a6952006-03-03 06:23:43 +0000274 DEBUG(std::cerr << "*** Scheduling: ");
275 DEBUG(SU->dump(&DAG, false));
276
Evan Chengab495562006-01-25 09:14:32 +0000277 Sequence.push_back(SU);
Evan Chengab495562006-01-25 09:14:32 +0000278
279 // Bottom up: release predecessors
Evan Cheng4e3904f2006-03-02 21:38:29 +0000280 for (std::set<SUnit*>::iterator I1 = SU->Preds.begin(),
281 E1 = SU->Preds.end(); I1 != E1; ++I1) {
Chris Lattner399bee22006-03-09 06:48:37 +0000282 ReleasePred(*I1);
Evan Cheng4e3904f2006-03-02 21:38:29 +0000283 SU->NumPredsLeft--;
Evan Cheng4e3904f2006-03-02 21:38:29 +0000284 }
285 for (std::set<SUnit*>::iterator I2 = SU->ChainPreds.begin(),
286 E2 = SU->ChainPreds.end(); I2 != E2; ++I2)
Chris Lattner399bee22006-03-09 06:48:37 +0000287 ReleasePred(*I2, true);
Evan Chengab495562006-01-25 09:14:32 +0000288
289 CurrCycle++;
290}
291
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000292/// ScheduleNodeTopDown - Add the node to the schedule. Decrement the pending
293/// count of its successors. If a successor pending count is zero, add it to
294/// the Available queue.
Chris Lattner399bee22006-03-09 06:48:37 +0000295void ScheduleDAGList::ScheduleNodeTopDown(SUnit *SU) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000296 DEBUG(std::cerr << "*** Scheduling: ");
297 DEBUG(SU->dump(&DAG, false));
298
299 Sequence.push_back(SU);
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000300
301 // Bottom up: release successors.
302 for (std::set<SUnit*>::iterator I1 = SU->Succs.begin(),
303 E1 = SU->Succs.end(); I1 != E1; ++I1) {
Chris Lattner399bee22006-03-09 06:48:37 +0000304 ReleaseSucc(*I1);
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000305 SU->NumSuccsLeft--;
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000306 }
307 for (std::set<SUnit*>::iterator I2 = SU->ChainSuccs.begin(),
308 E2 = SU->ChainSuccs.end(); I2 != E2; ++I2)
Chris Lattner399bee22006-03-09 06:48:37 +0000309 ReleaseSucc(*I2, true);
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000310
311 CurrCycle++;
312}
313
Evan Chengab495562006-01-25 09:14:32 +0000314/// isReady - True if node's lower cycle bound is less or equal to the current
315/// scheduling cycle. Always true if all nodes have uniform latency 1.
316static inline bool isReady(SUnit *SU, unsigned CurrCycle) {
317 return SU->CycleBound <= CurrCycle;
318}
319
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000320/// ListScheduleBottomUp - The main loop of list scheduling for bottom-up
321/// schedulers.
Chris Lattner399bee22006-03-09 06:48:37 +0000322void ScheduleDAGList::ListScheduleBottomUp() {
Chris Lattner7a36d972006-03-05 20:21:55 +0000323 // Add root to Available queue.
Chris Lattner399bee22006-03-09 06:48:37 +0000324 PriorityQueue->push(SUnitMap[DAG.getRoot().Val]);
Evan Chengab495562006-01-25 09:14:32 +0000325
326 // While Available queue is not empty, grab the node with the highest
327 // priority. If it is not ready put it back. Schedule the node.
328 std::vector<SUnit*> NotReady;
Chris Lattner399bee22006-03-09 06:48:37 +0000329 while (!PriorityQueue->empty()) {
330 SUnit *CurrNode = PriorityQueue->pop();
Evan Chengab495562006-01-25 09:14:32 +0000331
Evan Chengab495562006-01-25 09:14:32 +0000332 while (!isReady(CurrNode, CurrCycle)) {
333 NotReady.push_back(CurrNode);
Chris Lattner399bee22006-03-09 06:48:37 +0000334 CurrNode = PriorityQueue->pop();
Evan Chengab495562006-01-25 09:14:32 +0000335 }
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000336
337 // Add the nodes that aren't ready back onto the available list.
338 while (!NotReady.empty()) {
Chris Lattner399bee22006-03-09 06:48:37 +0000339 PriorityQueue->push(NotReady.back());
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000340 NotReady.pop_back();
341 }
Evan Chengab495562006-01-25 09:14:32 +0000342
Chris Lattner399bee22006-03-09 06:48:37 +0000343 ScheduleNodeBottomUp(CurrNode);
Evan Chengab495562006-01-25 09:14:32 +0000344 }
345
346 // Add entry node last
347 if (DAG.getEntryNode().Val != DAG.getRoot().Val) {
348 SUnit *Entry = SUnitMap[DAG.getEntryNode().Val];
Evan Chengab495562006-01-25 09:14:32 +0000349 Sequence.push_back(Entry);
350 }
351
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000352 // Reverse the order if it is bottom up.
353 std::reverse(Sequence.begin(), Sequence.end());
354
355
Evan Chengab495562006-01-25 09:14:32 +0000356#ifndef NDEBUG
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000357 // Verify that all SUnits were scheduled.
Evan Chengc4c339c2006-01-26 00:30:29 +0000358 bool AnyNotSched = false;
Chris Lattner42e20262006-03-08 04:54:34 +0000359 for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
360 if (SUnits[i].NumSuccsLeft != 0 || SUnits[i].NumChainSuccsLeft != 0) {
Evan Chengc4c339c2006-01-26 00:30:29 +0000361 if (!AnyNotSched)
362 std::cerr << "*** List scheduling failed! ***\n";
Chris Lattner42e20262006-03-08 04:54:34 +0000363 SUnits[i].dump(&DAG);
Evan Chengc4c339c2006-01-26 00:30:29 +0000364 std::cerr << "has not been scheduled!\n";
365 AnyNotSched = true;
Evan Chengab495562006-01-25 09:14:32 +0000366 }
Evan Chengab495562006-01-25 09:14:32 +0000367 }
Evan Chengc4c339c2006-01-26 00:30:29 +0000368 assert(!AnyNotSched);
Reid Spencer5edde662006-01-25 21:49:13 +0000369#endif
Evan Chengab495562006-01-25 09:14:32 +0000370}
371
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000372/// ListScheduleTopDown - The main loop of list scheduling for top-down
373/// schedulers.
Chris Lattner399bee22006-03-09 06:48:37 +0000374void ScheduleDAGList::ListScheduleTopDown() {
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000375 // Emit the entry node first.
376 SUnit *Entry = SUnitMap[DAG.getEntryNode().Val];
Chris Lattner399bee22006-03-09 06:48:37 +0000377 ScheduleNodeTopDown(Entry);
Chris Lattner543832d2006-03-08 04:25:59 +0000378 HazardRec->EmitInstruction(Entry->Node);
Chris Lattnere50c0922006-03-05 22:45:01 +0000379
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000380 // All leaves to Available queue.
Chris Lattner42e20262006-03-08 04:54:34 +0000381 for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000382 // It is available if it has no predecessors.
Chris Lattner42e20262006-03-08 04:54:34 +0000383 if ((SUnits[i].Preds.size() + SUnits[i].ChainPreds.size()) == 0 &&
384 &SUnits[i] != Entry)
Chris Lattner399bee22006-03-09 06:48:37 +0000385 PriorityQueue->push(&SUnits[i]);
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000386 }
387
388 // While Available queue is not empty, grab the node with the highest
389 // priority. If it is not ready put it back. Schedule the node.
390 std::vector<SUnit*> NotReady;
Chris Lattner399bee22006-03-09 06:48:37 +0000391 while (!PriorityQueue->empty()) {
Chris Lattnere50c0922006-03-05 22:45:01 +0000392 SUnit *FoundNode = 0;
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000393
Chris Lattnere50c0922006-03-05 22:45:01 +0000394 bool HasNoopHazards = false;
395 do {
Chris Lattner399bee22006-03-09 06:48:37 +0000396 SUnit *CurNode = PriorityQueue->pop();
Chris Lattner0c801bd2006-03-07 05:40:43 +0000397
398 // Get the node represented by this SUnit.
399 SDNode *N = CurNode->Node;
400 // If this is a pseudo op, like copyfromreg, look to see if there is a
401 // real target node flagged to it. If so, use the target node.
402 for (unsigned i = 0, e = CurNode->FlaggedNodes.size();
403 N->getOpcode() < ISD::BUILTIN_OP_END && i != e; ++i)
404 N = CurNode->FlaggedNodes[i];
405
Chris Lattner543832d2006-03-08 04:25:59 +0000406 HazardRecognizer::HazardType HT = HazardRec->getHazardType(N);
Chris Lattnere50c0922006-03-05 22:45:01 +0000407 if (HT == HazardRecognizer::NoHazard) {
Chris Lattner0c801bd2006-03-07 05:40:43 +0000408 FoundNode = CurNode;
Chris Lattnere50c0922006-03-05 22:45:01 +0000409 break;
410 }
411
412 // Remember if this is a noop hazard.
413 HasNoopHazards |= HT == HazardRecognizer::NoopHazard;
414
Chris Lattner0c801bd2006-03-07 05:40:43 +0000415 NotReady.push_back(CurNode);
Chris Lattner399bee22006-03-09 06:48:37 +0000416 } while (!PriorityQueue->empty());
Chris Lattnere50c0922006-03-05 22:45:01 +0000417
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000418 // Add the nodes that aren't ready back onto the available list.
419 while (!NotReady.empty()) {
Chris Lattner399bee22006-03-09 06:48:37 +0000420 PriorityQueue->push(NotReady.back());
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000421 NotReady.pop_back();
422 }
Chris Lattnere50c0922006-03-05 22:45:01 +0000423
424 // If we found a node to schedule, do it now.
425 if (FoundNode) {
Chris Lattner399bee22006-03-09 06:48:37 +0000426 ScheduleNodeTopDown(FoundNode);
Chris Lattner543832d2006-03-08 04:25:59 +0000427 HazardRec->EmitInstruction(FoundNode->Node);
Chris Lattnere50c0922006-03-05 22:45:01 +0000428 } else if (!HasNoopHazards) {
429 // Otherwise, we have a pipeline stall, but no other problem, just advance
430 // the current cycle and try again.
Chris Lattner0c801bd2006-03-07 05:40:43 +0000431 DEBUG(std::cerr << "*** Advancing cycle, no work to do\n");
Chris Lattner543832d2006-03-08 04:25:59 +0000432 HazardRec->AdvanceCycle();
Chris Lattnerfa5e1c92006-03-05 23:13:56 +0000433 ++NumStalls;
Chris Lattnere50c0922006-03-05 22:45:01 +0000434 } else {
435 // Otherwise, we have no instructions to issue and we have instructions
436 // that will fault if we don't do this right. This is the case for
437 // processors without pipeline interlocks and other cases.
Chris Lattner0c801bd2006-03-07 05:40:43 +0000438 DEBUG(std::cerr << "*** Emitting noop\n");
Chris Lattner543832d2006-03-08 04:25:59 +0000439 HazardRec->EmitNoop();
Chris Lattner00b52ea2006-03-05 23:59:20 +0000440 Sequence.push_back(0); // NULL SUnit* -> noop
Chris Lattnerfa5e1c92006-03-05 23:13:56 +0000441 ++NumNoops;
Chris Lattnere50c0922006-03-05 22:45:01 +0000442 }
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000443 }
444
445#ifndef NDEBUG
446 // Verify that all SUnits were scheduled.
447 bool AnyNotSched = false;
Chris Lattner42e20262006-03-08 04:54:34 +0000448 for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
449 if (SUnits[i].NumPredsLeft != 0 || SUnits[i].NumChainPredsLeft != 0) {
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000450 if (!AnyNotSched)
451 std::cerr << "*** List scheduling failed! ***\n";
Chris Lattner42e20262006-03-08 04:54:34 +0000452 SUnits[i].dump(&DAG);
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000453 std::cerr << "has not been scheduled!\n";
454 AnyNotSched = true;
455 }
456 }
457 assert(!AnyNotSched);
458#endif
459}
460
461
Evan Chengab495562006-01-25 09:14:32 +0000462void ScheduleDAGList::BuildSchedUnits() {
Chris Lattner42e20262006-03-08 04:54:34 +0000463 // Reserve entries in the vector for each of the SUnits we are creating. This
464 // ensure that reallocation of the vector won't happen, so SUnit*'s won't get
465 // invalidated.
466 SUnits.reserve(NodeCount);
467
Evan Chengc4c339c2006-01-26 00:30:29 +0000468 // Pass 1: create the SUnit's.
Jeff Cohenfb206162006-01-25 17:17:49 +0000469 for (unsigned i = 0, NC = NodeCount; i < NC; i++) {
Evan Chengab495562006-01-25 09:14:32 +0000470 NodeInfo *NI = &Info[i];
471 SDNode *N = NI->Node;
Evan Chengc4c339c2006-01-26 00:30:29 +0000472 if (isPassiveNode(N))
473 continue;
Evan Chengab495562006-01-25 09:14:32 +0000474
Evan Chengc4c339c2006-01-26 00:30:29 +0000475 SUnit *SU;
476 if (NI->isInGroup()) {
477 if (NI != NI->Group->getBottom()) // Bottom up, so only look at bottom
478 continue; // node of the NodeGroup
Evan Chengab495562006-01-25 09:14:32 +0000479
Evan Chengc4c339c2006-01-26 00:30:29 +0000480 SU = NewSUnit(N);
481 // Find the flagged nodes.
482 SDOperand FlagOp = N->getOperand(N->getNumOperands() - 1);
483 SDNode *Flag = FlagOp.Val;
484 unsigned ResNo = FlagOp.ResNo;
485 while (Flag->getValueType(ResNo) == MVT::Flag) {
486 NodeInfo *FNI = getNI(Flag);
487 assert(FNI->Group == NI->Group);
488 SU->FlaggedNodes.insert(SU->FlaggedNodes.begin(), Flag);
489 SUnitMap[Flag] = SU;
Evan Chengab495562006-01-25 09:14:32 +0000490
Evan Chengc4c339c2006-01-26 00:30:29 +0000491 FlagOp = Flag->getOperand(Flag->getNumOperands() - 1);
492 Flag = FlagOp.Val;
493 ResNo = FlagOp.ResNo;
494 }
495 } else {
496 SU = NewSUnit(N);
497 }
498 SUnitMap[N] = SU;
Chris Lattner9df64752006-03-09 06:35:14 +0000499
500 // FIXME: assumes uniform latency for now.
501 SU->Latency = 1;
Evan Chengc4c339c2006-01-26 00:30:29 +0000502 }
Evan Chengab495562006-01-25 09:14:32 +0000503
Evan Chengc4c339c2006-01-26 00:30:29 +0000504 // Pass 2: add the preds, succs, etc.
Chris Lattner42e20262006-03-08 04:54:34 +0000505 for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
506 SUnit *SU = &SUnits[i];
Evan Chengc4c339c2006-01-26 00:30:29 +0000507 SDNode *N = SU->Node;
508 NodeInfo *NI = getNI(N);
Evan Cheng5e9a6952006-03-03 06:23:43 +0000509
510 if (N->isTargetOpcode() && TII->isTwoAddrInstr(N->getTargetOpcode()))
511 SU->isTwoAddress = true;
Evan Chengc4c339c2006-01-26 00:30:29 +0000512
513 if (NI->isInGroup()) {
514 // Find all predecessors (of the group).
515 NodeGroupOpIterator NGOI(NI);
516 while (!NGOI.isEnd()) {
517 SDOperand Op = NGOI.next();
518 SDNode *OpN = Op.Val;
519 MVT::ValueType VT = OpN->getValueType(Op.ResNo);
520 NodeInfo *OpNI = getNI(OpN);
521 if (OpNI->Group != NI->Group && !isPassiveNode(OpN)) {
522 assert(VT != MVT::Flag);
523 SUnit *OpSU = SUnitMap[OpN];
524 if (VT == MVT::Other) {
Evan Cheng4e3904f2006-03-02 21:38:29 +0000525 if (SU->ChainPreds.insert(OpSU).second)
526 SU->NumChainPredsLeft++;
527 if (OpSU->ChainSuccs.insert(SU).second)
528 OpSU->NumChainSuccsLeft++;
Evan Chengc4c339c2006-01-26 00:30:29 +0000529 } else {
Evan Cheng4e3904f2006-03-02 21:38:29 +0000530 if (SU->Preds.insert(OpSU).second)
531 SU->NumPredsLeft++;
532 if (OpSU->Succs.insert(SU).second)
533 OpSU->NumSuccsLeft++;
Evan Chengab495562006-01-25 09:14:32 +0000534 }
Evan Chengab495562006-01-25 09:14:32 +0000535 }
536 }
Evan Chengc4c339c2006-01-26 00:30:29 +0000537 } else {
538 // Find node predecessors.
539 for (unsigned j = 0, e = N->getNumOperands(); j != e; j++) {
540 SDOperand Op = N->getOperand(j);
541 SDNode *OpN = Op.Val;
542 MVT::ValueType VT = OpN->getValueType(Op.ResNo);
543 if (!isPassiveNode(OpN)) {
544 assert(VT != MVT::Flag);
545 SUnit *OpSU = SUnitMap[OpN];
546 if (VT == MVT::Other) {
Evan Cheng4e3904f2006-03-02 21:38:29 +0000547 if (SU->ChainPreds.insert(OpSU).second)
548 SU->NumChainPredsLeft++;
549 if (OpSU->ChainSuccs.insert(SU).second)
550 OpSU->NumChainSuccsLeft++;
Evan Chengc4c339c2006-01-26 00:30:29 +0000551 } else {
Evan Cheng4e3904f2006-03-02 21:38:29 +0000552 if (SU->Preds.insert(OpSU).second)
553 SU->NumPredsLeft++;
554 if (OpSU->Succs.insert(SU).second)
555 OpSU->NumSuccsLeft++;
Evan Cheng5e9a6952006-03-03 06:23:43 +0000556 if (j == 0 && SU->isTwoAddress)
Evan Cheng4e3904f2006-03-02 21:38:29 +0000557 OpSU->isDefNUseOperand = true;
Evan Chengc4c339c2006-01-26 00:30:29 +0000558 }
Evan Chengc4c339c2006-01-26 00:30:29 +0000559 }
560 }
Evan Chengab495562006-01-25 09:14:32 +0000561 }
562 }
Evan Chengab495562006-01-25 09:14:32 +0000563}
564
565/// EmitSchedule - Emit the machine code in scheduled order.
566void ScheduleDAGList::EmitSchedule() {
567 for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
Chris Lattner2d945ba2006-03-05 23:51:47 +0000568 if (SUnit *SU = Sequence[i]) {
569 for (unsigned j = 0, ee = SU->FlaggedNodes.size(); j != ee; j++) {
570 SDNode *N = SU->FlaggedNodes[j];
571 EmitNode(getNI(N));
572 }
573 EmitNode(getNI(SU->Node));
574 } else {
575 // Null SUnit* is a noop.
576 EmitNoop();
Evan Chengab495562006-01-25 09:14:32 +0000577 }
Evan Chengab495562006-01-25 09:14:32 +0000578 }
579}
580
581/// dump - dump the schedule.
582void ScheduleDAGList::dump() const {
583 for (unsigned i = 0, e = Sequence.size(); i != e; i++) {
Chris Lattner2d945ba2006-03-05 23:51:47 +0000584 if (SUnit *SU = Sequence[i])
585 SU->dump(&DAG, false);
586 else
587 std::cerr << "**** NOOP ****\n";
Evan Chengab495562006-01-25 09:14:32 +0000588 }
589}
590
591/// Schedule - Schedule the DAG using list scheduling.
592/// FIXME: Right now it only supports the burr (bottom up register reducing)
593/// heuristic.
Evan Cheng31272342006-01-23 08:26:10 +0000594void ScheduleDAGList::Schedule() {
Evan Chengab495562006-01-25 09:14:32 +0000595 DEBUG(std::cerr << "********** List Scheduling **********\n");
596
597 // Build scheduling units.
598 BuildSchedUnits();
Chris Lattnerfd22d422006-03-08 05:18:27 +0000599
Chris Lattner9df64752006-03-09 06:35:14 +0000600 PriorityQueue->initNodes(SUnits);
601
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000602 // Execute the actual scheduling loop Top-Down or Bottom-Up as appropriate.
603 if (isBottomUp)
Chris Lattner399bee22006-03-09 06:48:37 +0000604 ListScheduleBottomUp();
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000605 else
Chris Lattner399bee22006-03-09 06:48:37 +0000606 ListScheduleTopDown();
Chris Lattner9df64752006-03-09 06:35:14 +0000607
608 PriorityQueue->releaseState();
609
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000610 DEBUG(std::cerr << "*** Final schedule ***\n");
611 DEBUG(dump());
612 DEBUG(std::cerr << "\n");
613
Evan Chengab495562006-01-25 09:14:32 +0000614 // Emit in scheduled order
615 EmitSchedule();
Evan Cheng31272342006-01-23 08:26:10 +0000616}
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000617
Chris Lattner9df64752006-03-09 06:35:14 +0000618//===----------------------------------------------------------------------===//
619// RegReductionPriorityQueue Implementation
620//===----------------------------------------------------------------------===//
621//
622// This is a SchedulingPriorityQueue that schedules using Sethi Ullman numbers
623// to reduce register pressure.
624//
625namespace {
626 class RegReductionPriorityQueue;
627
628 /// Sorting functions for the Available queue.
629 struct ls_rr_sort : public std::binary_function<SUnit*, SUnit*, bool> {
630 RegReductionPriorityQueue *SPQ;
631 ls_rr_sort(RegReductionPriorityQueue *spq) : SPQ(spq) {}
632 ls_rr_sort(const ls_rr_sort &RHS) : SPQ(RHS.SPQ) {}
633
634 bool operator()(const SUnit* left, const SUnit* right) const;
635 };
636} // end anonymous namespace
637
638namespace {
639 class RegReductionPriorityQueue : public SchedulingPriorityQueue {
640 // SUnits - The SUnits for the current graph.
641 const std::vector<SUnit> *SUnits;
642
643 // SethiUllmanNumbers - The SethiUllman number for each node.
644 std::vector<int> SethiUllmanNumbers;
645
646 std::priority_queue<SUnit*, std::vector<SUnit*>, ls_rr_sort> Queue;
647 public:
648 RegReductionPriorityQueue() : Queue(ls_rr_sort(this)) {
649 }
650
651 void initNodes(const std::vector<SUnit> &sunits) {
652 SUnits = &sunits;
653 // Calculate node priorities.
654 CalculatePriorities();
655 }
656 void releaseState() {
657 SUnits = 0;
658 SethiUllmanNumbers.clear();
659 }
660
661 unsigned getSethiUllmanNumber(unsigned NodeNum) const {
662 assert(NodeNum < SethiUllmanNumbers.size());
663 return SethiUllmanNumbers[NodeNum];
664 }
665
666 bool empty() const { return Queue.empty(); }
667
668 void push(SUnit *U) {
669 Queue.push(U);
670 }
671 SUnit *pop() {
672 SUnit *V = Queue.top();
673 Queue.pop();
674 return V;
675 }
676 private:
677 void CalculatePriorities();
678 int CalcNodePriority(const SUnit *SU);
679 };
680}
681
682bool ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const {
683 unsigned LeftNum = left->NodeNum;
684 unsigned RightNum = right->NodeNum;
685
686 int LBonus = (int)left ->isDefNUseOperand;
687 int RBonus = (int)right->isDefNUseOperand;
688
689 // Special tie breaker: if two nodes share a operand, the one that
690 // use it as a def&use operand is preferred.
691 if (left->isTwoAddress && !right->isTwoAddress) {
692 SDNode *DUNode = left->Node->getOperand(0).Val;
693 if (DUNode->isOperand(right->Node))
694 LBonus++;
695 }
696 if (!left->isTwoAddress && right->isTwoAddress) {
697 SDNode *DUNode = right->Node->getOperand(0).Val;
698 if (DUNode->isOperand(left->Node))
699 RBonus++;
700 }
701
702 // Priority1 is just the number of live range genned.
703 int LPriority1 = left ->NumPredsLeft - LBonus;
704 int RPriority1 = right->NumPredsLeft - RBonus;
705 int LPriority2 = SPQ->getSethiUllmanNumber(LeftNum) + LBonus;
706 int RPriority2 = SPQ->getSethiUllmanNumber(RightNum) + RBonus;
707
708 if (LPriority1 > RPriority1)
709 return true;
710 else if (LPriority1 == RPriority1)
711 if (LPriority2 < RPriority2)
712 return true;
713 else if (LPriority2 == RPriority2)
714 if (left->CycleBound > right->CycleBound)
715 return true;
716
717 return false;
718}
719
720
721/// CalcNodePriority - Priority is the Sethi Ullman number.
722/// Smaller number is the higher priority.
723int RegReductionPriorityQueue::CalcNodePriority(const SUnit *SU) {
724 int &SethiUllmanNumber = SethiUllmanNumbers[SU->NodeNum];
725 if (SethiUllmanNumber != INT_MIN)
726 return SethiUllmanNumber;
727
728 if (SU->Preds.size() == 0) {
729 SethiUllmanNumber = 1;
730 } else {
731 int Extra = 0;
732 for (std::set<SUnit*>::iterator I = SU->Preds.begin(),
733 E = SU->Preds.end(); I != E; ++I) {
734 SUnit *PredSU = *I;
735 int PredSethiUllman = CalcNodePriority(PredSU);
736 if (PredSethiUllman > SethiUllmanNumber) {
737 SethiUllmanNumber = PredSethiUllman;
738 Extra = 0;
739 } else if (PredSethiUllman == SethiUllmanNumber)
740 Extra++;
741 }
742
743 if (SU->Node->getOpcode() != ISD::TokenFactor)
744 SethiUllmanNumber += Extra;
745 else
746 SethiUllmanNumber = (Extra == 1) ? 0 : Extra-1;
747 }
748
749 return SethiUllmanNumber;
750}
751
752/// CalculatePriorities - Calculate priorities of all scheduling units.
753void RegReductionPriorityQueue::CalculatePriorities() {
754 SethiUllmanNumbers.assign(SUnits->size(), INT_MIN);
755
756 for (unsigned i = 0, e = SUnits->size(); i != e; ++i)
757 CalcNodePriority(&(*SUnits)[i]);
758}
759
760
761//===----------------------------------------------------------------------===//
762// Public Constructor Functions
763//===----------------------------------------------------------------------===//
764
Evan Chengab495562006-01-25 09:14:32 +0000765llvm::ScheduleDAG* llvm::createBURRListDAGScheduler(SelectionDAG &DAG,
766 MachineBasicBlock *BB) {
Chris Lattner543832d2006-03-08 04:25:59 +0000767 return new ScheduleDAGList(DAG, BB, DAG.getTarget(), true,
Chris Lattner9df64752006-03-09 06:35:14 +0000768 new RegReductionPriorityQueue(),
Chris Lattner543832d2006-03-08 04:25:59 +0000769 new HazardRecognizer());
Chris Lattner98ecb8e2006-03-05 21:10:33 +0000770}
771
Chris Lattner47639db2006-03-06 00:22:00 +0000772/// createTDListDAGScheduler - This creates a top-down list scheduler with the
773/// specified hazard recognizer.
774ScheduleDAG* llvm::createTDListDAGScheduler(SelectionDAG &DAG,
775 MachineBasicBlock *BB,
Chris Lattner543832d2006-03-08 04:25:59 +0000776 HazardRecognizer *HR) {
Chris Lattner9df64752006-03-09 06:35:14 +0000777 return new ScheduleDAGList(DAG, BB, DAG.getTarget(), false,
778 new RegReductionPriorityQueue(),
779 HR);
Evan Cheng31272342006-01-23 08:26:10 +0000780}