1 //===-- ScheduleDAGSimple.cpp - Implement a trivial DAG scheduler ---------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by James M. Laskey and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This implements a simple two pass scheduler. The first pass attempts to push
11 // backward any lengthy instructions and critical paths. The second pass packs
12 // instructions into semi-optimal time slots.
14 //===----------------------------------------------------------------------===//
16 #define DEBUG_TYPE "sched"
17 #include "llvm/CodeGen/ScheduleDAG.h"
18 #include "llvm/CodeGen/SelectionDAG.h"
19 #include "llvm/Target/TargetMachine.h"
20 #include "llvm/Target/TargetInstrInfo.h"
21 #include "llvm/Support/Debug.h"
27 //===----------------------------------------------------------------------===//
29 /// BitsIterator - Provides iteration through individual bits in a bit vector.
34 T Bits; // Bits left to iterate through
38 BitsIterator(T Initial) : Bits(Initial) {}
40 /// Next - Returns the next bit set or zero if exhausted.
42 // Get the rightmost bit set
43 T Result = Bits & -Bits;
46 // Return single bit or zero
51 //===----------------------------------------------------------------------===//
54 //===----------------------------------------------------------------------===//
56 /// ResourceTally - Manages the use of resources over time intervals. Each
57 /// item (slot) in the tally vector represents the resources used at a given
58 /// moment. A bit set to 1 indicates that a resource is in use, otherwise
59 /// available. An assumption is made that the tally is large enough to schedule
60 /// all current instructions (asserts otherwise.)
65 std::vector<T> Tally; // Resources used per slot
66 typedef typename std::vector<T>::iterator Iter;
69 /// SlotsAvailable - Returns true if all units are available.
71 bool SlotsAvailable(Iter Begin, unsigned N, unsigned ResourceSet,
73 assert(N && "Must check availability with N != 0");
74 // Determine end of interval
76 assert(End <= Tally.end() && "Tally is not large enough for schedule");
78 // Iterate thru each resource
79 BitsIterator<T> Resources(ResourceSet & ~*Begin);
80 while (unsigned Res = Resources.Next()) {
81 // Check if resource is available for next N slots
85 if (*Interval & Res) break;
86 } while (Interval != Begin);
89 if (Interval == Begin) {
101 /// RetrySlot - Finds a good candidate slot to retry search.
102 Iter RetrySlot(Iter Begin, unsigned N, unsigned ResourceSet) {
103 assert(N && "Must check availability with N != 0");
104 // Determine end of interval
105 Iter End = Begin + N;
106 assert(End <= Tally.end() && "Tally is not large enough for schedule");
108 while (Begin != End--) {
109 // Clear units in use
110 ResourceSet &= ~*End;
111 // If no units left then we should go no further
112 if (!ResourceSet) return End + 1;
114 // Made it all the way through
118 /// FindAndReserveStages - Return true if the stages can be completed. If
120 bool FindAndReserveStages(Iter Begin,
121 InstrStage *Stage, InstrStage *StageEnd) {
122 // If at last stage then we're done
123 if (Stage == StageEnd) return true;
124 // Get number of cycles for current stage
125 unsigned N = Stage->Cycles;
126 // Check to see if N slots are available, if not fail
128 if (!SlotsAvailable(Begin, N, Stage->Units, Resource)) return false;
129 // Check to see if remaining stages are available, if not fail
130 if (!FindAndReserveStages(Begin + N, Stage + 1, StageEnd)) return false;
132 Reserve(Begin, N, Resource);
137 /// Reserve - Mark busy (set) the specified N slots.
138 void Reserve(Iter Begin, unsigned N, unsigned Resource) {
139 // Determine end of interval
140 Iter End = Begin + N;
141 assert(End <= Tally.end() && "Tally is not large enough for schedule");
143 // Set resource bit in each slot
144 for (; Begin < End; Begin++)
148 /// FindSlots - Starting from Begin, locate consecutive slots where all stages
149 /// can be completed. Returns the address of first slot.
150 Iter FindSlots(Iter Begin, InstrStage *StageBegin, InstrStage *StageEnd) {
154 // Try all possible slots forward
156 // Try at cursor, if successful return position.
157 if (FindAndReserveStages(Cursor, StageBegin, StageEnd)) return Cursor;
158 // Locate a better position
159 Cursor = RetrySlot(Cursor + 1, StageBegin->Cycles, StageBegin->Units);
164 /// Initialize - Resize and zero the tally to the specified number of time
166 inline void Initialize(unsigned N) {
167 Tally.assign(N, 0); // Initialize tally to all zeros.
170 // FindAndReserve - Locate an ideal slot for the specified stages and mark
172 unsigned FindAndReserve(unsigned Slot, InstrStage *StageBegin,
173 InstrStage *StageEnd) {
175 Iter Begin = Tally.begin() + Slot;
177 Iter Where = FindSlots(Begin, StageBegin, StageEnd);
178 // Distance is slot number
179 unsigned Final = Where - Tally.begin();
185 //===----------------------------------------------------------------------===//
187 /// ScheduleDAGSimple - Simple two pass scheduler.
189 class ScheduleDAGSimple : public ScheduleDAG {
191 ResourceTally<unsigned> Tally; // Resource usage tally
192 unsigned NSlots; // Total latency
193 static const unsigned NotFound = ~0U; // Search marker
198 ScheduleDAGSimple(SchedHeuristics hstc, SelectionDAG &dag,
199 MachineBasicBlock *bb, const TargetMachine &tm)
200 : ScheduleDAG(hstc, dag, bb, tm), Tally(), NSlots(0) {
201 assert(&TII && "Target doesn't provide instr info?");
202 assert(&MRI && "Target doesn't provide register info?");
205 virtual ~ScheduleDAGSimple() {};
210 static bool isDefiner(NodeInfo *A, NodeInfo *B);
211 void IncludeNode(NodeInfo *NI);
213 void GatherSchedulingInfo();
214 void FakeGroupDominators();
215 bool isStrongDependency(NodeInfo *A, NodeInfo *B);
216 bool isWeakDependency(NodeInfo *A, NodeInfo *B);
217 void ScheduleBackward();
218 void ScheduleForward();
220 void AddToGroup(NodeInfo *D, NodeInfo *U);
221 /// PrepareNodeInfo - Set up the basic minimum node info for scheduling.
223 void PrepareNodeInfo();
225 /// IdentifyGroups - Put flagged nodes into groups.
227 void IdentifyGroups();
229 /// print - Print ordering to specified output stream.
231 void print(std::ostream &O) const;
233 void dump(const char *tag) const;
235 virtual void dump() const;
237 /// EmitAll - Emit all nodes in schedule sorted order.
241 /// printNI - Print node info.
243 void printNI(std::ostream &O, NodeInfo *NI) const;
245 /// printChanges - Hilight changes in order caused by scheduling.
247 void printChanges(unsigned Index) const;
250 //===----------------------------------------------------------------------===//
251 /// Special case itineraries.
254 CallLatency = 40, // To push calls back in time
256 RSInteger = 0xC0000000, // Two integer units
257 RSFloat = 0x30000000, // Two float units
258 RSLoadStore = 0x0C000000, // Two load store units
259 RSBranch = 0x02000000 // One branch unit
261 static InstrStage CallStage = { CallLatency, RSBranch };
262 static InstrStage LoadStage = { 5, RSLoadStore };
263 static InstrStage StoreStage = { 2, RSLoadStore };
264 static InstrStage IntStage = { 2, RSInteger };
265 static InstrStage FloatStage = { 3, RSFloat };
266 //===----------------------------------------------------------------------===//
270 //===----------------------------------------------------------------------===//
272 /// PrepareNodeInfo - Set up the basic minimum node info for scheduling.
274 void ScheduleDAGSimple::PrepareNodeInfo() {
275 // Allocate node information
276 Info = new NodeInfo[NodeCount];
279 for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
280 E = DAG.allnodes_end(); I != E; ++I, ++i) {
281 // Fast reference to node schedule info
282 NodeInfo* NI = &Info[i];
287 // Set pending visit count
288 NI->setPending(I->use_size());
292 /// IdentifyGroups - Put flagged nodes into groups.
294 void ScheduleDAGSimple::IdentifyGroups() {
295 for (unsigned i = 0, N = NodeCount; i < N; i++) {
296 NodeInfo* NI = &Info[i];
297 SDNode *Node = NI->Node;
299 // For each operand (in reverse to only look at flags)
300 for (unsigned N = Node->getNumOperands(); 0 < N--;) {
302 SDOperand Op = Node->getOperand(N);
303 // No more flags to walk
304 if (Op.getValueType() != MVT::Flag) break;
306 AddToGroup(getNI(Op.Val), NI);
307 // Let everyone else know
313 /// CountInternalUses - Returns the number of edges between the two nodes.
315 static unsigned CountInternalUses(NodeInfo *D, NodeInfo *U) {
317 for (unsigned M = U->Node->getNumOperands(); 0 < M--;) {
318 SDOperand Op = U->Node->getOperand(M);
319 if (Op.Val == D->Node) N++;
325 //===----------------------------------------------------------------------===//
326 /// Add - Adds a definer and user pair to a node group.
328 void ScheduleDAGSimple::AddToGroup(NodeInfo *D, NodeInfo *U) {
329 // Get current groups
330 NodeGroup *DGroup = D->Group;
331 NodeGroup *UGroup = U->Group;
332 // If both are members of groups
333 if (DGroup && UGroup) {
334 // There may have been another edge connecting
335 if (DGroup == UGroup) return;
336 // Add the pending users count
337 DGroup->addPending(UGroup->getPending());
338 // For each member of the users group
339 NodeGroupIterator UNGI(U);
340 while (NodeInfo *UNI = UNGI.next() ) {
343 // For each member of the definers group
344 NodeGroupIterator DNGI(D);
345 while (NodeInfo *DNI = DNGI.next() ) {
346 // Remove internal edges
347 DGroup->addPending(-CountInternalUses(DNI, UNI));
350 // Merge the two lists
351 DGroup->group_insert(DGroup->group_end(),
352 UGroup->group_begin(), UGroup->group_end());
354 // Make user member of definers group
356 // Add users uses to definers group pending
357 DGroup->addPending(U->Node->use_size());
358 // For each member of the definers group
359 NodeGroupIterator DNGI(D);
360 while (NodeInfo *DNI = DNGI.next() ) {
361 // Remove internal edges
362 DGroup->addPending(-CountInternalUses(DNI, U));
364 DGroup->group_push_back(U);
366 // Make definer member of users group
368 // Add definers uses to users group pending
369 UGroup->addPending(D->Node->use_size());
370 // For each member of the users group
371 NodeGroupIterator UNGI(U);
372 while (NodeInfo *UNI = UNGI.next() ) {
373 // Remove internal edges
374 UGroup->addPending(-CountInternalUses(D, UNI));
376 UGroup->group_insert(UGroup->group_begin(), D);
378 D->Group = U->Group = DGroup = new NodeGroup();
379 DGroup->addPending(D->Node->use_size() + U->Node->use_size() -
380 CountInternalUses(D, U));
381 DGroup->group_push_back(D);
382 DGroup->group_push_back(U);
387 TailNG->Next = DGroup;
393 /// print - Print ordering to specified output stream.
395 void ScheduleDAGSimple::print(std::ostream &O) const {
398 for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
399 NodeInfo *NI = Ordering[i];
402 if (NI->isGroupDominator()) {
403 NodeGroup *Group = NI->Group;
404 for (NIIterator NII = Group->group_begin(), E = Group->group_end();
415 void ScheduleDAGSimple::dump(const char *tag) const {
416 std::cerr << tag; dump();
419 void ScheduleDAGSimple::dump() const {
424 /// EmitAll - Emit all nodes in schedule sorted order.
426 void ScheduleDAGSimple::EmitAll() {
427 std::map<SDNode*, unsigned> VRBaseMap;
429 // For each node in the ordering
430 for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
431 // Get the scheduling info
432 NodeInfo *NI = Ordering[i];
433 if (NI->isInGroup()) {
434 NodeGroupIterator NGI(Ordering[i]);
435 while (NodeInfo *NI = NGI.next()) EmitNode(NI->Node, VRBaseMap);
437 EmitNode(NI->Node, VRBaseMap);
442 /// isFlagDefiner - Returns true if the node defines a flag result.
443 static bool isFlagDefiner(SDNode *A) {
444 unsigned N = A->getNumValues();
445 return N && A->getValueType(N - 1) == MVT::Flag;
448 /// isFlagUser - Returns true if the node uses a flag result.
450 static bool isFlagUser(SDNode *A) {
451 unsigned N = A->getNumOperands();
452 return N && A->getOperand(N - 1).getValueType() == MVT::Flag;
455 /// printNI - Print node info.
457 void ScheduleDAGSimple::printNI(std::ostream &O, NodeInfo *NI) const {
459 SDNode *Node = NI->Node;
461 << std::hex << Node << std::dec
462 << ", Lat=" << NI->Latency
463 << ", Slot=" << NI->Slot
464 << ", ARITY=(" << Node->getNumOperands() << ","
465 << Node->getNumValues() << ")"
466 << " " << Node->getOperationName(&DAG);
467 if (isFlagDefiner(Node)) O << "<#";
468 if (isFlagUser(Node)) O << ">#";
472 /// printChanges - Hilight changes in order caused by scheduling.
474 void ScheduleDAGSimple::printChanges(unsigned Index) const {
476 // Get the ordered node count
477 unsigned N = Ordering.size();
478 // Determine if any changes
481 NodeInfo *NI = Ordering[i];
482 if (NI->Preorder != i) break;
486 std::cerr << Index << ". New Ordering\n";
488 for (i = 0; i < N; i++) {
489 NodeInfo *NI = Ordering[i];
490 std::cerr << " " << NI->Preorder << ". ";
491 printNI(std::cerr, NI);
493 if (NI->isGroupDominator()) {
494 NodeGroup *Group = NI->Group;
495 for (NIIterator NII = Group->group_begin(), E = Group->group_end();
498 printNI(std::cerr, *NII);
504 std::cerr << Index << ". No Changes\n";
509 //===----------------------------------------------------------------------===//
510 /// isDefiner - Return true if node A is a definer for B.
512 bool ScheduleDAGSimple::isDefiner(NodeInfo *A, NodeInfo *B) {
513 // While there are A nodes
514 NodeGroupIterator NII(A);
515 while (NodeInfo *NI = NII.next()) {
517 SDNode *Node = NI->Node;
518 // While there operands in nodes of B
519 NodeGroupOpIterator NGOI(B);
520 while (!NGOI.isEnd()) {
521 SDOperand Op = NGOI.next();
522 // If node from A defines a node in B
523 if (Node == Op.Val) return true;
529 /// IncludeNode - Add node to NodeInfo vector.
531 void ScheduleDAGSimple::IncludeNode(NodeInfo *NI) {
533 SDNode *Node = NI->Node;
535 if (Node->getOpcode() == ISD::EntryToken) return;
536 // Check current count for node
537 int Count = NI->getPending();
538 // If the node is already in list
539 if (Count < 0) return;
540 // Decrement count to indicate a visit
542 // If count has gone to zero then add node to list
545 if (NI->isInGroup()) {
546 Ordering.push_back(NI->Group->getDominator());
548 Ordering.push_back(NI);
550 // indicate node has been added
553 // Mark as visited with new count
554 NI->setPending(Count);
557 /// GatherSchedulingInfo - Get latency and resource information about each node.
559 void ScheduleDAGSimple::GatherSchedulingInfo() {
560 // Get instruction itineraries for the target
561 const InstrItineraryData &InstrItins = TM.getInstrItineraryData();
564 for (unsigned i = 0, N = NodeCount; i < N; i++) {
566 NodeInfo* NI = &Info[i];
567 SDNode *Node = NI->Node;
569 // If there are itineraries and it is a machine instruction
570 if (InstrItins.isEmpty() || Heuristic == simpleNoItinScheduling) {
572 if (Node->isTargetOpcode()) {
573 // Get return type to guess which processing unit
574 MVT::ValueType VT = Node->getValueType(0);
575 // Get machine opcode
576 MachineOpCode TOpc = Node->getTargetOpcode();
577 NI->IsCall = TII->isCall(TOpc);
578 NI->IsLoad = TII->isLoad(TOpc);
579 NI->IsStore = TII->isStore(TOpc);
581 if (TII->isLoad(TOpc)) NI->StageBegin = &LoadStage;
582 else if (TII->isStore(TOpc)) NI->StageBegin = &StoreStage;
583 else if (MVT::isInteger(VT)) NI->StageBegin = &IntStage;
584 else if (MVT::isFloatingPoint(VT)) NI->StageBegin = &FloatStage;
585 if (NI->StageBegin) NI->StageEnd = NI->StageBegin + 1;
587 } else if (Node->isTargetOpcode()) {
588 // get machine opcode
589 MachineOpCode TOpc = Node->getTargetOpcode();
590 // Check to see if it is a call
591 NI->IsCall = TII->isCall(TOpc);
592 // Get itinerary stages for instruction
593 unsigned II = TII->getSchedClass(TOpc);
594 NI->StageBegin = InstrItins.begin(II);
595 NI->StageEnd = InstrItins.end(II);
598 // One slot for the instruction itself
601 // Add long latency for a call to push it back in time
602 if (NI->IsCall) NI->Latency += CallLatency;
604 // Sum up all the latencies
605 for (InstrStage *Stage = NI->StageBegin, *E = NI->StageEnd;
606 Stage != E; Stage++) {
607 NI->Latency += Stage->Cycles;
610 // Sum up all the latencies for max tally size
611 NSlots += NI->Latency;
614 // Unify metrics if in a group
616 for (unsigned i = 0, N = NodeCount; i < N; i++) {
617 NodeInfo* NI = &Info[i];
619 if (NI->isInGroup()) {
620 NodeGroup *Group = NI->Group;
622 if (!Group->getDominator()) {
623 NIIterator NGI = Group->group_begin(), NGE = Group->group_end();
624 NodeInfo *Dominator = *NGI;
625 unsigned Latency = 0;
627 for (NGI++; NGI != NGE; NGI++) {
628 NodeInfo* NGNI = *NGI;
629 Latency += NGNI->Latency;
630 if (Dominator->Latency < NGNI->Latency) Dominator = NGNI;
633 Dominator->Latency = Latency;
634 Group->setDominator(Dominator);
641 /// VisitAll - Visit each node breadth-wise to produce an initial ordering.
642 /// Note that the ordering in the Nodes vector is reversed.
643 void ScheduleDAGSimple::VisitAll() {
644 // Add first element to list
645 NodeInfo *NI = getNI(DAG.getRoot().Val);
646 if (NI->isInGroup()) {
647 Ordering.push_back(NI->Group->getDominator());
649 Ordering.push_back(NI);
652 // Iterate through all nodes that have been added
653 for (unsigned i = 0; i < Ordering.size(); i++) { // note: size() varies
654 // Visit all operands
655 NodeGroupOpIterator NGI(Ordering[i]);
656 while (!NGI.isEnd()) {
658 SDOperand Op = NGI.next();
660 SDNode *Node = Op.Val;
661 // Ignore passive nodes
662 if (isPassiveNode(Node)) continue;
664 IncludeNode(getNI(Node));
668 // Add entry node last (IncludeNode filters entry nodes)
669 if (DAG.getEntryNode().Val != DAG.getRoot().Val)
670 Ordering.push_back(getNI(DAG.getEntryNode().Val));
673 std::reverse(Ordering.begin(), Ordering.end());
676 /// FakeGroupDominators - Set dominators for non-scheduling.
678 void ScheduleDAGSimple::FakeGroupDominators() {
679 for (unsigned i = 0, N = NodeCount; i < N; i++) {
680 NodeInfo* NI = &Info[i];
682 if (NI->isInGroup()) {
683 NodeGroup *Group = NI->Group;
685 if (!Group->getDominator()) {
686 Group->setDominator(NI);
692 /// isStrongDependency - Return true if node A has results used by node B.
693 /// I.E., B must wait for latency of A.
694 bool ScheduleDAGSimple::isStrongDependency(NodeInfo *A, NodeInfo *B) {
695 // If A defines for B then it's a strong dependency or
696 // if a load follows a store (may be dependent but why take a chance.)
697 return isDefiner(A, B) || (A->IsStore && B->IsLoad);
700 /// isWeakDependency Return true if node A produces a result that will
701 /// conflict with operands of B. It is assumed that we have called
702 /// isStrongDependency prior.
703 bool ScheduleDAGSimple::isWeakDependency(NodeInfo *A, NodeInfo *B) {
704 // TODO check for conflicting real registers and aliases
705 #if 0 // FIXME - Since we are in SSA form and not checking register aliasing
706 return A->Node->getOpcode() == ISD::EntryToken || isStrongDependency(B, A);
708 return A->Node->getOpcode() == ISD::EntryToken;
712 /// ScheduleBackward - Schedule instructions so that any long latency
713 /// instructions and the critical path get pushed back in time. Time is run in
714 /// reverse to allow code reuse of the Tally and eliminate the overhead of
715 /// biasing every slot indices against NSlots.
716 void ScheduleDAGSimple::ScheduleBackward() {
717 // Size and clear the resource tally
718 Tally.Initialize(NSlots);
719 // Get number of nodes to schedule
720 unsigned N = Ordering.size();
722 // For each node being scheduled
723 for (unsigned i = N; 0 < i--;) {
724 NodeInfo *NI = Ordering[i];
726 unsigned Slot = NotFound;
728 // Compare against those previously scheduled nodes
731 // Get following instruction
732 NodeInfo *Other = Ordering[j];
734 // Check dependency against previously inserted nodes
735 if (isStrongDependency(NI, Other)) {
736 Slot = Other->Slot + Other->Latency;
738 } else if (isWeakDependency(NI, Other)) {
744 // If independent of others (or first entry)
745 if (Slot == NotFound) Slot = 0;
747 #if 0 // FIXME - measure later
748 // Find a slot where the needed resources are available
749 if (NI->StageBegin != NI->StageEnd)
750 Slot = Tally.FindAndReserve(Slot, NI->StageBegin, NI->StageEnd);
756 // Insert sort based on slot
759 // Get following instruction
760 NodeInfo *Other = Ordering[j];
761 // Should we look further (remember slots are in reverse time)
762 if (Slot >= Other->Slot) break;
763 // Shuffle other into ordering
764 Ordering[j - 1] = Other;
766 // Insert node in proper slot
767 if (j != i + 1) Ordering[j - 1] = NI;
771 /// ScheduleForward - Schedule instructions to maximize packing.
773 void ScheduleDAGSimple::ScheduleForward() {
774 // Size and clear the resource tally
775 Tally.Initialize(NSlots);
776 // Get number of nodes to schedule
777 unsigned N = Ordering.size();
779 // For each node being scheduled
780 for (unsigned i = 0; i < N; i++) {
781 NodeInfo *NI = Ordering[i];
783 unsigned Slot = NotFound;
785 // Compare against those previously scheduled nodes
788 // Get following instruction
789 NodeInfo *Other = Ordering[j];
791 // Check dependency against previously inserted nodes
792 if (isStrongDependency(Other, NI)) {
793 Slot = Other->Slot + Other->Latency;
795 } else if (Other->IsCall || isWeakDependency(Other, NI)) {
801 // If independent of others (or first entry)
802 if (Slot == NotFound) Slot = 0;
804 // Find a slot where the needed resources are available
805 if (NI->StageBegin != NI->StageEnd)
806 Slot = Tally.FindAndReserve(Slot, NI->StageBegin, NI->StageEnd);
811 // Insert sort based on slot
814 // Get prior instruction
815 NodeInfo *Other = Ordering[j];
816 // Should we look further
817 if (Slot >= Other->Slot) break;
818 // Shuffle other into ordering
819 Ordering[j + 1] = Other;
821 // Insert node in proper slot
822 if (j != i) Ordering[j + 1] = NI;
826 /// Schedule - Order nodes according to selected style.
828 void ScheduleDAGSimple::Schedule() {
829 // Set up minimum info for scheduling
831 // Construct node groups for flagged nodes
834 // Test to see if scheduling should occur
835 bool ShouldSchedule = NodeCount > 3 && Heuristic != noScheduling;
836 // Don't waste time if is only entry and return
837 if (ShouldSchedule) {
838 // Get latency and resource requirements
839 GatherSchedulingInfo();
840 } else if (HasGroups) {
841 // Make sure all the groups have dominators
842 FakeGroupDominators();
845 // Breadth first walk of DAG
849 static unsigned Count = 0;
851 for (unsigned i = 0, N = Ordering.size(); i < N; i++) {
852 NodeInfo *NI = Ordering[i];
857 // Don't waste time if is only entry and return
858 if (ShouldSchedule) {
859 // Push back long instructions and critical path
862 // Pack instructions to maximize resource utilization
866 DEBUG(printChanges(Count));
868 // Emit in scheduled order
873 /// createSimpleDAGScheduler - This creates a simple two pass instruction
875 llvm::ScheduleDAG* llvm::createSimpleDAGScheduler(SchedHeuristics Heuristic,
877 MachineBasicBlock *BB) {
878 return new ScheduleDAGSimple(Heuristic, DAG, BB, DAG.getTarget());