LLVM 22.0.0git
ScheduleDAG.h
Go to the documentation of this file.
1//===- llvm/CodeGen/ScheduleDAG.h - Common Base Class -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file Implements the ScheduleDAG class, which is used as the common base
10/// class for instruction schedulers. This encapsulates the scheduling DAG,
11/// which is shared between SelectionDAG and MachineInstr scheduling.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CODEGEN_SCHEDULEDAG_H
16#define LLVM_CODEGEN_SCHEDULEDAG_H
17
18#include "llvm/ADT/BitVector.h"
20#include "llvm/ADT/SmallSet.h"
22#include "llvm/ADT/iterator.h"
27#include <cassert>
28#include <cstddef>
29#include <iterator>
30#include <string>
31#include <vector>
32
33namespace llvm {
34
35template <class GraphType> struct GraphTraits;
36template<class Graph> class GraphWriter;
37class TargetMachine;
38class MachineFunction;
39class MachineRegisterInfo;
40class MCInstrDesc;
41struct MCSchedClassDesc;
42class SDNode;
43class SUnit;
44class ScheduleDAG;
45class TargetInstrInfo;
46class TargetRegisterClass;
47class TargetRegisterInfo;
48
49 /// Scheduling dependency. This represents one direction of an edge in the
50 /// scheduling DAG.
51 class SDep {
52 public:
53 /// These are the different kinds of scheduling dependencies.
54 enum Kind {
55 Data, ///< Regular data dependence (aka true-dependence).
56 Anti, ///< A register anti-dependence (aka WAR).
57 Output, ///< A register output-dependence (aka WAW).
58 Order ///< Any other ordering dependency.
59 };
60
61 // Strong dependencies must be respected by the scheduler. Artificial
62 // dependencies may be removed only if they are redundant with another
63 // strong dependence.
64 //
65 // Weak dependencies may be violated by the scheduling strategy, but only if
66 // the strategy can prove it is correct to do so.
67 //
68 // Strong OrderKinds must occur before "Weak".
69 // Weak OrderKinds must occur after "Weak".
70 enum OrderKind {
71 Barrier, ///< An unknown scheduling barrier.
72 MayAliasMem, ///< Nonvolatile load/Store instructions that may alias.
73 MustAliasMem, ///< Nonvolatile load/Store instructions that must alias.
74 Artificial, ///< Arbitrary strong DAG edge (no real dependence).
75 Weak, ///< Arbitrary weak DAG edge.
76 Cluster ///< Weak DAG edge linking a chain of clustered instrs.
77 };
78
79 private:
80 /// A pointer to the depending/depended-on SUnit, and an enum
81 /// indicating the kind of the dependency.
83
84 /// A union discriminated by the dependence kind.
85 union {
86 /// For Data, Anti, and Output dependencies, the associated register. For
87 /// Data dependencies that don't currently have a register/ assigned, this
88 /// is set to zero.
89 unsigned Reg;
90
91 /// Additional information about Order dependencies.
92 unsigned OrdKind; // enum OrderKind
93 } Contents;
94
95 /// The time associated with this edge. Often this is just the value of the
96 /// Latency field of the predecessor, however advanced models may provide
97 /// additional information about specific edges.
98 unsigned Latency = 0u;
99
100 public:
101 /// Constructs a null SDep. This is only for use by container classes which
102 /// require default constructors. SUnits may not/ have null SDep edges.
103 SDep() : Dep(nullptr, Data) {}
104
105 /// Constructs an SDep with the specified values.
106 SDep(SUnit *S, Kind kind, Register Reg) : Dep(S, kind), Contents() {
107 switch (kind) {
108 default:
109 llvm_unreachable("Reg given for non-register dependence!");
110 case Anti:
111 case Output:
112 assert(Reg && "SDep::Anti and SDep::Output must use a non-zero Reg!");
113 Contents.Reg = Reg.id();
114 Latency = 0;
115 break;
116 case Data:
117 Contents.Reg = Reg.id();
118 Latency = 1;
119 break;
120 }
121 }
122
124 : Dep(S, Order), Contents(), Latency(0) {
125 Contents.OrdKind = kind;
126 }
127
128 /// Returns true if the specified SDep is equivalent except for latency.
129 bool overlaps(const SDep &Other) const;
130
131 bool operator==(const SDep &Other) const {
132 return overlaps(Other) && Latency == Other.Latency;
133 }
134
135 bool operator!=(const SDep &Other) const {
136 return !operator==(Other);
137 }
138
139 /// Returns the latency value for this edge, which roughly means the
140 /// minimum number of cycles that must elapse between the predecessor and
141 /// the successor, given that they have this edge between them.
142 unsigned getLatency() const {
143 return Latency;
144 }
145
146 /// Sets the latency for this edge.
147 void setLatency(unsigned Lat) {
148 Latency = Lat;
149 }
150
151 //// Returns the SUnit to which this edge points.
152 SUnit *getSUnit() const;
153
154 //// Assigns the SUnit to which this edge points.
155 void setSUnit(SUnit *SU);
156
157 /// Returns an enum value representing the kind of the dependence.
158 Kind getKind() const;
159
160 /// Shorthand for getKind() != SDep::Data.
161 bool isCtrl() const {
162 return getKind() != Data;
163 }
164
165 /// Tests if this is an Order dependence between two memory accesses
166 /// where both sides of the dependence access memory in non-volatile and
167 /// fully modeled ways.
168 bool isNormalMemory() const {
169 return getKind() == Order && (Contents.OrdKind == MayAliasMem
170 || Contents.OrdKind == MustAliasMem);
171 }
172
173 /// Tests if this is an Order dependence that is marked as a barrier.
174 bool isBarrier() const {
175 return getKind() == Order && Contents.OrdKind == Barrier;
176 }
177
178 /// Tests if this is could be any kind of memory dependence.
180 return (isNormalMemory() || isBarrier());
181 }
182
183 /// Tests if this is an Order dependence that is marked as
184 /// "must alias", meaning that the SUnits at either end of the edge have a
185 /// memory dependence on a known memory location.
186 bool isMustAlias() const {
187 return getKind() == Order && Contents.OrdKind == MustAliasMem;
188 }
189
190 /// Tests if this a weak dependence. Weak dependencies are considered DAG
191 /// edges for height computation and other heuristics, but do not force
192 /// ordering. Breaking a weak edge may require the scheduler to compensate,
193 /// for example by inserting a copy.
194 bool isWeak() const {
195 return getKind() == Order && Contents.OrdKind >= Weak;
196 }
197
198 /// Tests if this is an Order dependence that is marked as
199 /// "artificial", meaning it isn't necessary for correctness.
200 bool isArtificial() const {
201 return getKind() == Order && Contents.OrdKind == Artificial;
202 }
203
204 /// Tests if this is an Order dependence that is marked as "cluster",
205 /// meaning it is artificial and wants to be adjacent.
206 bool isCluster() const {
207 return getKind() == Order && Contents.OrdKind == Cluster;
208 }
209
210 /// Tests if this is a Data dependence that is associated with a register.
211 bool isAssignedRegDep() const { return getKind() == Data && Contents.Reg; }
212
213 /// Returns the register associated with this edge. This is only valid on
214 /// Data, Anti, and Output edges. On Data edges, this value may be zero,
215 /// meaning there is no associated register.
216 Register getReg() const {
217 assert((getKind() == Data || getKind() == Anti || getKind() == Output) &&
218 "getReg called on non-register dependence edge!");
219 return Contents.Reg;
220 }
221
222 /// Assigns the associated register for this edge. This is only valid on
223 /// Data, Anti, and Output edges. On Anti and Output edges, this value must
224 /// not be zero. On Data edges, the value may be zero, which would mean that
225 /// no specific register is associated with this edge.
227 assert((getKind() == Data || getKind() == Anti || getKind() == Output) &&
228 "setReg called on non-register dependence edge!");
229 assert((getKind() != Anti || Reg) &&
230 "SDep::Anti edge cannot use the zero register!");
231 assert((getKind() != Output || Reg) &&
232 "SDep::Output edge cannot use the zero register!");
233 Contents.Reg = Reg.id();
234 }
235
236 LLVM_ABI void dump(const TargetRegisterInfo *TRI = nullptr) const;
237 };
238
239 /// Keep record of which SUnit are in the same cluster group.
241 constexpr unsigned InvalidClusterId = ~0u;
242
243 /// Return whether the input cluster ID's are the same and valid.
244 inline bool isTheSameCluster(unsigned A, unsigned B) {
245 return A != InvalidClusterId && A == B;
246 }
247
248 /// Scheduling unit. This is a node in the scheduling DAG.
249 class SUnit {
250 private:
251 enum : unsigned { BoundaryID = ~0u };
252
253 union {
254 SDNode *Node; ///< Representative node.
255 MachineInstr *Instr; ///< Alternatively, a MachineInstr.
256 };
257
258 public:
259 SUnit *OrigNode = nullptr; ///< If not this, the node from which this node
260 /// was cloned. (SD scheduling only)
261
263 nullptr; ///< nullptr or resolved SchedClass.
264
266 nullptr; ///< Is a special copy node if != nullptr.
268
269 SmallVector<SDep, 4> Preds; ///< All sunit predecessors.
270 SmallVector<SDep, 4> Succs; ///< All sunit successors.
271
276
277 unsigned NodeNum = BoundaryID; ///< Entry # of node in the node vector.
278 unsigned NodeQueueId = 0; ///< Queue id of node.
279 unsigned NumPreds = 0; ///< # of SDep::Data preds.
280 unsigned NumSuccs = 0; ///< # of SDep::Data sucss.
281 unsigned NumPredsLeft = 0; ///< # of preds not scheduled.
282 unsigned NumSuccsLeft = 0; ///< # of succs not scheduled.
283 unsigned WeakPredsLeft = 0; ///< # of weak preds not scheduled.
284 unsigned WeakSuccsLeft = 0; ///< # of weak succs not scheduled.
285 unsigned TopReadyCycle = 0; ///< Cycle relative to start when node is ready.
286 unsigned BotReadyCycle = 0; ///< Cycle relative to end when node is ready.
287
288 unsigned ParentClusterIdx = InvalidClusterId; ///< The parent cluster id.
289
290 private:
291 unsigned Depth = 0; ///< Node depth.
292 unsigned Height = 0; ///< Node height.
293
294 public:
295 bool isVRegCycle : 1; ///< May use and def the same vreg.
296 bool isCall : 1; ///< Is a function call.
297 bool isCallOp : 1; ///< Is a function call operand.
298 bool isTwoAddress : 1; ///< Is a two-address instruction.
299 bool isCommutable : 1; ///< Is a commutable instruction.
300 bool hasPhysRegUses : 1; ///< Has physreg uses.
301 bool hasPhysRegDefs : 1; ///< Has physreg defs that are being used.
302 bool hasPhysRegClobbers : 1; ///< Has any physreg defs, used or not.
303 bool isPending : 1; ///< True once pending.
304 bool isAvailable : 1; ///< True once available.
305 bool isScheduled : 1; ///< True once scheduled.
306 bool isScheduleHigh : 1; ///< True if preferable to schedule high.
307 bool isScheduleLow : 1; ///< True if preferable to schedule low.
308 bool isCloned : 1; ///< True if this node has been cloned.
309 bool isUnbuffered : 1; ///< Uses an unbuffered resource.
310 bool hasReservedResource : 1; ///< Uses a reserved resource.
311 unsigned short NumRegDefsLeft = 0; ///< # of reg defs with no scheduled use.
312 unsigned short Latency = 0; ///< Node latency.
313
314 private:
315 bool isDepthCurrent : 1; ///< True if Depth is current.
316 bool isHeightCurrent : 1; ///< True if Height is current.
317 bool isNode : 1; ///< True if the representative is an SDNode
318 bool isInst : 1; ///< True if the representative is a MachineInstr
319
320 public:
321 Sched::Preference SchedulingPref : 4; ///< Scheduling preference.
322 static_assert(Sched::Preference::Last <= (1 << 4),
323 "not enough bits in bitfield");
324
325 /// Constructs an SUnit for pre-regalloc scheduling to represent an
326 /// SDNode and any nodes flagged to it.
327 SUnit(SDNode *node, unsigned nodenum)
328 : Node(node), NodeNum(nodenum), isVRegCycle(false), isCall(false),
334 isDepthCurrent(false), isHeightCurrent(false), isNode(true),
335 isInst(false), SchedulingPref(Sched::None) {}
336
337 /// Constructs an SUnit for post-regalloc scheduling to represent a
338 /// MachineInstr.
339 SUnit(MachineInstr *instr, unsigned nodenum)
346 isDepthCurrent(false), isHeightCurrent(false), isNode(false),
347 isInst(true), SchedulingPref(Sched::None) {}
348
349 /// Constructs a placeholder SUnit.
356 hasReservedResource(false), isDepthCurrent(false),
357 isHeightCurrent(false), isNode(false), isInst(false),
358 SchedulingPref(Sched::None) {}
359
360 /// Boundary nodes are placeholders for the boundary of the
361 /// scheduling region.
362 ///
363 /// BoundaryNodes can have DAG edges, including Data edges, but they do not
364 /// correspond to schedulable entities (e.g. instructions) and do not have a
365 /// valid ID. Consequently, always check for boundary nodes before accessing
366 /// an associative data structure keyed on node ID.
367 bool isBoundaryNode() const { return NodeNum == BoundaryID; }
368
369 /// Assigns the representative SDNode for this SUnit. This may be used
370 /// during pre-regalloc scheduling.
371 void setNode(SDNode *N) {
372 assert(!isInst && "Setting SDNode of SUnit with MachineInstr!");
373 Node = N;
374 isNode = true;
375 }
376
377 /// Returns the representative SDNode for this SUnit. This may be used
378 /// during pre-regalloc scheduling.
379 SDNode *getNode() const {
380 assert(!isInst && (isNode || !Instr) &&
381 "Reading SDNode of SUnit without SDNode!");
382 return Node;
383 }
384
385 /// Returns true if this SUnit refers to a machine instruction as
386 /// opposed to an SDNode.
387 bool isInstr() const { return isInst && Instr; }
388
389 /// Assigns the instruction for the SUnit. This may be used during
390 /// post-regalloc scheduling.
392 assert(!isNode && "Setting MachineInstr of SUnit with SDNode!");
393 Instr = MI;
394 isInst = true;
395 }
396
397 /// Returns the representative MachineInstr for this SUnit. This may be used
398 /// during post-regalloc scheduling.
400 assert(!isNode && (isInst || !Node) &&
401 "Reading MachineInstr of SUnit without MachineInstr!");
402 return Instr;
403 }
404
405 /// Adds the specified edge as a pred of the current node if not already.
406 /// It also adds the current node as a successor of the specified node.
407 LLVM_ABI bool addPred(const SDep &D, bool Required = true);
408
409 /// Adds a barrier edge to SU by calling addPred(), with latency 0
410 /// generally or latency 1 for a store followed by a load.
412 SDep Dep(SU, SDep::Barrier);
413 unsigned TrueMemOrderLatency =
414 ((SU->getInstr()->mayStore() && this->getInstr()->mayLoad()) ? 1 : 0);
415 Dep.setLatency(TrueMemOrderLatency);
416 return addPred(Dep);
417 }
418
419 /// Removes the specified edge as a pred of the current node if it exists.
420 /// It also removes the current node as a successor of the specified node.
421 LLVM_ABI void removePred(const SDep &D);
422
423 /// Returns the depth of this node, which is the length of the maximum path
424 /// up to any node which has no predecessors.
425 unsigned getDepth() const {
426 if (!isDepthCurrent)
427 const_cast<SUnit *>(this)->ComputeDepth();
428 return Depth;
429 }
430
431 /// Returns the height of this node, which is the length of the
432 /// maximum path down to any node which has no successors.
433 unsigned getHeight() const {
434 if (!isHeightCurrent)
435 const_cast<SUnit *>(this)->ComputeHeight();
436 return Height;
437 }
438
439 /// If NewDepth is greater than this node's depth value, sets it to
440 /// be the new depth value. This also recursively marks successor nodes
441 /// dirty.
442 LLVM_ABI void setDepthToAtLeast(unsigned NewDepth);
443
444 /// If NewHeight is greater than this node's height value, set it to be
445 /// the new height value. This also recursively marks predecessor nodes
446 /// dirty.
447 LLVM_ABI void setHeightToAtLeast(unsigned NewHeight);
448
449 /// Sets a flag in this node to indicate that its stored Depth value
450 /// will require recomputation the next time getDepth() is called.
451 LLVM_ABI void setDepthDirty();
452
453 /// Sets a flag in this node to indicate that its stored Height value
454 /// will require recomputation the next time getHeight() is called.
456
457 /// Tests if node N is a predecessor of this node.
458 bool isPred(const SUnit *N) const {
459 for (const SDep &Pred : Preds)
460 if (Pred.getSUnit() == N)
461 return true;
462 return false;
463 }
464
465 /// Tests if node N is a successor of this node.
466 bool isSucc(const SUnit *N) const {
467 for (const SDep &Succ : Succs)
468 if (Succ.getSUnit() == N)
469 return true;
470 return false;
471 }
472
473 bool isTopReady() const {
474 return NumPredsLeft == 0;
475 }
476 bool isBottomReady() const {
477 return NumSuccsLeft == 0;
478 }
479
480 /// Orders this node's predecessor edges such that the critical path
481 /// edge occurs first.
483
484 LLVM_ABI void dumpAttributes() const;
485
486 private:
487 LLVM_ABI void ComputeDepth();
488 LLVM_ABI void ComputeHeight();
489 };
490
491 /// Returns true if the specified SDep is equivalent except for latency.
492 inline bool SDep::overlaps(const SDep &Other) const {
493 if (Dep != Other.Dep)
494 return false;
495 switch (Dep.getInt()) {
496 case Data:
497 case Anti:
498 case Output:
499 return Contents.Reg == Other.Contents.Reg;
500 case Order:
501 return Contents.OrdKind == Other.Contents.OrdKind;
502 }
503 llvm_unreachable("Invalid dependency kind!");
504 }
505
506 //// Returns the SUnit to which this edge points.
507 inline SUnit *SDep::getSUnit() const { return Dep.getPointer(); }
508
509 //// Assigns the SUnit to which this edge points.
510 inline void SDep::setSUnit(SUnit *SU) { Dep.setPointer(SU); }
511
512 /// Returns an enum value representing the kind of the dependence.
513 inline SDep::Kind SDep::getKind() const { return Dep.getInt(); }
514
515 //===--------------------------------------------------------------------===//
516
517 /// This interface is used to plug different priorities computation
518 /// algorithms into the list scheduler. It implements the interface of a
519 /// standard priority queue, where nodes are inserted in arbitrary order and
520 /// returned in priority order. The computation of the priority and the
521 /// representation of the queue are totally up to the implementation to
522 /// decide.
524 virtual void anchor();
525
526 unsigned CurCycle = 0;
527 bool HasReadyFilter;
528
529 public:
530 SchedulingPriorityQueue(bool rf = false) : HasReadyFilter(rf) {}
531
532 virtual ~SchedulingPriorityQueue() = default;
533
534 virtual bool isBottomUp() const = 0;
535
536 virtual void initNodes(std::vector<SUnit> &SUnits) = 0;
537 virtual void addNode(const SUnit *SU) = 0;
538 virtual void updateNode(const SUnit *SU) = 0;
539 virtual void releaseState() = 0;
540
541 virtual bool empty() const = 0;
542
543 bool hasReadyFilter() const { return HasReadyFilter; }
544
545 virtual bool tracksRegPressure() const { return false; }
546
547 virtual bool isReady(SUnit *) const {
548 assert(!HasReadyFilter && "The ready filter must override isReady()");
549 return true;
550 }
551
552 virtual void push(SUnit *U) = 0;
553
554 void push_all(const std::vector<SUnit *> &Nodes) {
555 for (SUnit *SU : Nodes)
556 push(SU);
557 }
558
559 virtual SUnit *pop() = 0;
560
561 virtual void remove(SUnit *SU) = 0;
562
563 virtual void dump(ScheduleDAG *) const {}
564
565 /// As each node is scheduled, this method is invoked. This allows the
566 /// priority function to adjust the priority of related unscheduled nodes,
567 /// for example.
568 virtual void scheduledNode(SUnit *) {}
569
570 virtual void unscheduledNode(SUnit *) {}
571
572 void setCurCycle(unsigned Cycle) {
573 CurCycle = Cycle;
574 }
575
576 unsigned getCurCycle() const {
577 return CurCycle;
578 }
579 };
580
582 public:
583 const TargetMachine &TM; ///< Target processor
584 const TargetInstrInfo *TII; ///< Target instruction information
585 const TargetRegisterInfo *TRI; ///< Target processor register info
586 MachineFunction &MF; ///< Machine function
587 MachineRegisterInfo &MRI; ///< Virtual/real register map
588 std::vector<SUnit> SUnits; ///< The scheduling units.
589 SUnit EntrySU; ///< Special node for the region entry.
590 SUnit ExitSU; ///< Special node for the region exit.
591
592#ifdef NDEBUG
593 static const bool StressSched = false;
594#else
596#endif
597
598 // This class is designed to be passed by reference only. Copy constructor
599 // is declared as deleted here to make the derived classes have deleted
600 // implicit-declared copy constructor, which suppresses the warnings from
601 // static analyzer when the derived classes own resources that are freed in
602 // their destructors, but don't have user-written copy constructors (rule
603 // of three).
604 ScheduleDAG(const ScheduleDAG &) = delete;
606
607 explicit ScheduleDAG(MachineFunction &mf);
608
609 virtual ~ScheduleDAG();
610
611 /// Clears the DAG state (between regions).
612 void clearDAG();
613
614 /// Returns the MCInstrDesc of this SUnit.
615 /// Returns NULL for SDNodes without a machine opcode.
616 const MCInstrDesc *getInstrDesc(const SUnit *SU) const {
617 if (SU->isInstr()) return &SU->getInstr()->getDesc();
618 return getNodeDesc(SU->getNode());
619 }
620
621 /// Pops up a GraphViz/gv window with the ScheduleDAG rendered using 'dot'.
622 virtual void viewGraph(const Twine &Name, const Twine &Title);
623 virtual void viewGraph();
624
625 virtual void dumpNode(const SUnit &SU) const = 0;
626 virtual void dump() const = 0;
627 void dumpNodeName(const SUnit &SU) const;
628
629 /// Returns a label for an SUnit node in a visualization of the ScheduleDAG.
630 virtual std::string getGraphNodeLabel(const SUnit *SU) const = 0;
631
632 /// Returns a label for the region of code covered by the DAG.
633 virtual std::string getDAGName() const = 0;
634
635 /// Adds custom features for a visualization of the ScheduleDAG.
637
638#ifndef NDEBUG
639 /// Verifies that all SUnits were scheduled and that their state is
640 /// consistent. Returns the number of scheduled SUnits.
641 unsigned VerifyScheduledDAG(bool isBottomUp);
642#endif
643
644 protected:
645 void dumpNodeAll(const SUnit &SU) const;
646
647 private:
648 /// Returns the MCInstrDesc of this SDNode or NULL.
649 const MCInstrDesc *getNodeDesc(const SDNode *Node) const;
650 };
651
653 SUnit *Node;
654 unsigned Operand;
655
656 SUnitIterator(SUnit *N, unsigned Op) : Node(N), Operand(Op) {}
657
658 public:
659 using iterator_category = std::forward_iterator_tag;
661 using difference_type = std::ptrdiff_t;
664
665 bool operator==(const SUnitIterator& x) const {
666 return Operand == x.Operand;
667 }
668 bool operator!=(const SUnitIterator& x) const { return !operator==(x); }
669
671 return Node->Preds[Operand].getSUnit();
672 }
673 pointer operator->() const { return operator*(); }
674
675 SUnitIterator& operator++() { // Preincrement
676 ++Operand;
677 return *this;
678 }
679 SUnitIterator operator++(int) { // Postincrement
680 SUnitIterator tmp = *this; ++*this; return tmp;
681 }
682
683 static SUnitIterator begin(SUnit *N) { return SUnitIterator(N, 0); }
685 return SUnitIterator(N, (unsigned)N->Preds.size());
686 }
687
688 unsigned getOperand() const { return Operand; }
689 const SUnit *getNode() const { return Node; }
690
691 /// Tests if this is not an SDep::Data dependence.
692 bool isCtrlDep() const {
693 return getSDep().isCtrl();
694 }
695 bool isArtificialDep() const {
696 return getSDep().isArtificial();
697 }
698 const SDep &getSDep() const {
699 return Node->Preds[Operand];
700 }
701 };
702
703 template <> struct GraphTraits<SUnit*> {
704 typedef SUnit *NodeRef;
706 static NodeRef getEntryNode(SUnit *N) { return N; }
708 return SUnitIterator::begin(N);
709 }
711 return SUnitIterator::end(N);
712 }
713 };
714
715 template <> struct GraphTraits<ScheduleDAG*> : public GraphTraits<SUnit*> {
718 return nodes_iterator(G->SUnits.begin());
719 }
721 return nodes_iterator(G->SUnits.end());
722 }
723 };
724
725 /// This class can compute a topological ordering for SUnits and provides
726 /// methods for dynamically updating the ordering as new edges are added.
727 ///
728 /// This allows a very fast implementation of IsReachable, for example.
730 /// A reference to the ScheduleDAG's SUnits.
731 std::vector<SUnit> &SUnits;
732 SUnit *ExitSU;
733
734 // Have any new nodes been added?
735 bool Dirty = false;
736
737 // Outstanding added edges, that have not been applied to the ordering.
739
740 /// Maps topological index to the node number.
741 std::vector<int> Index2Node;
742 /// Maps the node number to its topological index.
743 std::vector<int> Node2Index;
744 /// a set of nodes visited during a DFS traversal.
745 BitVector Visited;
746
747 /// Makes a DFS traversal and mark all nodes affected by the edge insertion.
748 /// These nodes will later get new topological indexes by means of the Shift
749 /// method.
750 void DFS(const SUnit *SU, int UpperBound, bool& HasLoop);
751
752 /// Reassigns topological indexes for the nodes in the DAG to
753 /// preserve the topological ordering.
754 void Shift(BitVector& Visited, int LowerBound, int UpperBound);
755
756 /// Assigns the topological index to the node n.
757 void Allocate(int n, int index);
758
759 /// Fix the ordering, by either recomputing from scratch or by applying
760 /// any outstanding updates. Uses a heuristic to estimate what will be
761 /// cheaper.
762 void FixOrder();
763
764 public:
765 LLVM_ABI ScheduleDAGTopologicalSort(std::vector<SUnit> &SUnits,
766 SUnit *ExitSU);
767
768 /// Add a SUnit without predecessors to the end of the topological order. It
769 /// also must be the first new node added to the DAG.
771
772 /// Creates the initial topological ordering from the DAG to be scheduled.
774
775 /// Returns an array of SUs that are both in the successor
776 /// subtree of StartSU and in the predecessor subtree of TargetSU.
777 /// StartSU and TargetSU are not in the array.
778 /// Success is false if TargetSU is not in the successor subtree of
779 /// StartSU, else it is true.
780 LLVM_ABI std::vector<int> GetSubGraph(const SUnit &StartSU,
781 const SUnit &TargetSU, bool &Success);
782
783 /// Checks if \p SU is reachable from \p TargetSU.
784 LLVM_ABI bool IsReachable(const SUnit *SU, const SUnit *TargetSU);
785
786 /// Returns true if addPred(TargetSU, SU) creates a cycle.
787 LLVM_ABI bool WillCreateCycle(SUnit *TargetSU, SUnit *SU);
788
789 /// Updates the topological ordering to accommodate an edge to be
790 /// added from SUnit \p X to SUnit \p Y.
791 LLVM_ABI void AddPred(SUnit *Y, SUnit *X);
792
793 /// Queues an update to the topological ordering to accommodate an edge to
794 /// be added from SUnit \p X to SUnit \p Y.
796
797 /// Updates the topological ordering to accommodate an edge to be
798 /// removed from the specified node \p N from the predecessors of the
799 /// current node \p M.
800 LLVM_ABI void RemovePred(SUnit *M, SUnit *N);
801
802 /// Mark the ordering as temporarily broken, after a new node has been
803 /// added.
804 void MarkDirty() { Dirty = true; }
805
806 typedef std::vector<int>::iterator iterator;
807 typedef std::vector<int>::const_iterator const_iterator;
808 iterator begin() { return Index2Node.begin(); }
809 const_iterator begin() const { return Index2Node.begin(); }
810 iterator end() { return Index2Node.end(); }
811 const_iterator end() const { return Index2Node.end(); }
812
813 typedef std::vector<int>::reverse_iterator reverse_iterator;
814 typedef std::vector<int>::const_reverse_iterator const_reverse_iterator;
815 reverse_iterator rbegin() { return Index2Node.rbegin(); }
816 const_reverse_iterator rbegin() const { return Index2Node.rbegin(); }
817 reverse_iterator rend() { return Index2Node.rend(); }
818 const_reverse_iterator rend() const { return Index2Node.rend(); }
819 };
820
821} // end namespace llvm
822
823#endif // LLVM_CODEGEN_SCHEDULEDAG_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the BitVector class.
static void push(SmallVectorImpl< uint64_t > &R, StringRef Str)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_ABI
Definition: Compiler.h:213
std::string Name
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
IRTranslator LLVM IR MI
#define G(x, y, z)
Definition: MD5.cpp:56
Register const TargetRegisterInfo * TRI
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
This file defines the PointerIntPair class.
This file defines the SmallSet class.
This file defines the SmallVector class.
This file describes how to lower LLVM code to machine code.
This class represents an Operation in the Expression.
A possibly irreducible generalization of a Loop.
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:199
Representation of each machine instruction.
Definition: MachineInstr.h:72
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Definition: MachineInstr.h:584
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
PointerIntPair - This class implements a pair of a pointer and small integer.
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
Represents one node in the SelectionDAG.
Scheduling dependency.
Definition: ScheduleDAG.h:51
SUnit * getSUnit() const
Definition: ScheduleDAG.h:507
bool overlaps(const SDep &Other) const
Returns true if the specified SDep is equivalent except for latency.
Definition: ScheduleDAG.h:492
Kind getKind() const
Returns an enum value representing the kind of the dependence.
Definition: ScheduleDAG.h:513
Kind
These are the different kinds of scheduling dependencies.
Definition: ScheduleDAG.h:54
@ Output
A register output-dependence (aka WAW).
Definition: ScheduleDAG.h:57
@ Order
Any other ordering dependency.
Definition: ScheduleDAG.h:58
@ Anti
A register anti-dependence (aka WAR).
Definition: ScheduleDAG.h:56
@ Data
Regular data dependence (aka true-dependence).
Definition: ScheduleDAG.h:55
void setLatency(unsigned Lat)
Sets the latency for this edge.
Definition: ScheduleDAG.h:147
bool isWeak() const
Tests if this a weak dependence.
Definition: ScheduleDAG.h:194
@ Cluster
Weak DAG edge linking a chain of clustered instrs.
Definition: ScheduleDAG.h:76
@ Barrier
An unknown scheduling barrier.
Definition: ScheduleDAG.h:71
@ Artificial
Arbitrary strong DAG edge (no real dependence).
Definition: ScheduleDAG.h:74
@ MayAliasMem
Nonvolatile load/Store instructions that may alias.
Definition: ScheduleDAG.h:72
@ Weak
Arbitrary weak DAG edge.
Definition: ScheduleDAG.h:75
@ MustAliasMem
Nonvolatile load/Store instructions that must alias.
Definition: ScheduleDAG.h:73
unsigned OrdKind
Additional information about Order dependencies.
Definition: ScheduleDAG.h:92
unsigned getLatency() const
Returns the latency value for this edge, which roughly means the minimum number of cycles that must e...
Definition: ScheduleDAG.h:142
bool isAssignedRegDep() const
Tests if this is a Data dependence that is associated with a register.
Definition: ScheduleDAG.h:211
bool isNormalMemory() const
Tests if this is an Order dependence between two memory accesses where both sides of the dependence a...
Definition: ScheduleDAG.h:168
bool isArtificial() const
Tests if this is an Order dependence that is marked as "artificial", meaning it isn't necessary for c...
Definition: ScheduleDAG.h:200
bool operator==(const SDep &Other) const
Definition: ScheduleDAG.h:131
bool isCtrl() const
Shorthand for getKind() != SDep::Data.
Definition: ScheduleDAG.h:161
SDep(SUnit *S, OrderKind kind)
Definition: ScheduleDAG.h:123
SDep()
Constructs a null SDep.
Definition: ScheduleDAG.h:103
bool operator!=(const SDep &Other) const
Definition: ScheduleDAG.h:135
void setSUnit(SUnit *SU)
Definition: ScheduleDAG.h:510
SDep(SUnit *S, Kind kind, Register Reg)
Constructs an SDep with the specified values.
Definition: ScheduleDAG.h:106
unsigned Reg
For Data, Anti, and Output dependencies, the associated register.
Definition: ScheduleDAG.h:89
Register getReg() const
Returns the register associated with this edge.
Definition: ScheduleDAG.h:216
bool isCluster() const
Tests if this is an Order dependence that is marked as "cluster", meaning it is artificial and wants ...
Definition: ScheduleDAG.h:206
LLVM_ABI void dump(const TargetRegisterInfo *TRI=nullptr) const
Definition: ScheduleDAG.cpp:74
void setReg(Register Reg)
Assigns the associated register for this edge.
Definition: ScheduleDAG.h:226
bool isBarrier() const
Tests if this is an Order dependence that is marked as a barrier.
Definition: ScheduleDAG.h:174
bool isNormalMemoryOrBarrier() const
Tests if this is could be any kind of memory dependence.
Definition: ScheduleDAG.h:179
bool isMustAlias() const
Tests if this is an Order dependence that is marked as "must alias", meaning that the SUnits at eithe...
Definition: ScheduleDAG.h:186
const SUnit * getNode() const
Definition: ScheduleDAG.h:689
std::forward_iterator_tag iterator_category
Definition: ScheduleDAG.h:659
unsigned getOperand() const
Definition: ScheduleDAG.h:688
static SUnitIterator end(SUnit *N)
Definition: ScheduleDAG.h:684
pointer operator*() const
Definition: ScheduleDAG.h:670
SUnitIterator operator++(int)
Definition: ScheduleDAG.h:679
static SUnitIterator begin(SUnit *N)
Definition: ScheduleDAG.h:683
SUnitIterator & operator++()
Definition: ScheduleDAG.h:675
pointer operator->() const
Definition: ScheduleDAG.h:673
bool operator==(const SUnitIterator &x) const
Definition: ScheduleDAG.h:665
const SDep & getSDep() const
Definition: ScheduleDAG.h:698
bool operator!=(const SUnitIterator &x) const
Definition: ScheduleDAG.h:668
bool isArtificialDep() const
Definition: ScheduleDAG.h:695
bool isCtrlDep() const
Tests if this is not an SDep::Data dependence.
Definition: ScheduleDAG.h:692
std::ptrdiff_t difference_type
Definition: ScheduleDAG.h:661
Scheduling unit. This is a node in the scheduling DAG.
Definition: ScheduleDAG.h:249
bool isCloned
True if this node has been cloned.
Definition: ScheduleDAG.h:308
bool isCall
Is a function call.
Definition: ScheduleDAG.h:296
LLVM_ABI void setHeightToAtLeast(unsigned NewHeight)
If NewHeight is greater than this node's height value, set it to be the new height value.
bool addPredBarrier(SUnit *SU)
Adds a barrier edge to SU by calling addPred(), with latency 0 generally or latency 1 for a store fol...
Definition: ScheduleDAG.h:411
unsigned NumSuccs
Definition: ScheduleDAG.h:280
void setNode(SDNode *N)
Assigns the representative SDNode for this SUnit.
Definition: ScheduleDAG.h:371
unsigned NumPreds
Definition: ScheduleDAG.h:279
unsigned NodeQueueId
Queue id of node.
Definition: ScheduleDAG.h:278
bool isInstr() const
Returns true if this SUnit refers to a machine instruction as opposed to an SDNode.
Definition: ScheduleDAG.h:387
unsigned TopReadyCycle
Cycle relative to start when node is ready.
Definition: ScheduleDAG.h:285
SmallVectorImpl< SDep >::const_iterator const_succ_iterator
Definition: ScheduleDAG.h:275
const MCSchedClassDesc * SchedClass
nullptr or resolved SchedClass.
Definition: ScheduleDAG.h:262
unsigned NodeNum
Entry # of node in the node vector.
Definition: ScheduleDAG.h:277
unsigned NumSuccsLeft
Definition: ScheduleDAG.h:282
bool hasPhysRegClobbers
Has any physreg defs, used or not.
Definition: ScheduleDAG.h:302
LLVM_ABI void biasCriticalPath()
Orders this node's predecessor edges such that the critical path edge occurs first.
bool isUnbuffered
Uses an unbuffered resource.
Definition: ScheduleDAG.h:309
bool isCallOp
Is a function call operand.
Definition: ScheduleDAG.h:297
const TargetRegisterClass * CopyDstRC
Is a special copy node if != nullptr.
Definition: ScheduleDAG.h:265
SUnit(MachineInstr *instr, unsigned nodenum)
Constructs an SUnit for post-regalloc scheduling to represent a MachineInstr.
Definition: ScheduleDAG.h:339
SmallVectorImpl< SDep >::const_iterator const_pred_iterator
Definition: ScheduleDAG.h:274
unsigned getHeight() const
Returns the height of this node, which is the length of the maximum path down to any node which has n...
Definition: ScheduleDAG.h:433
void setInstr(MachineInstr *MI)
Assigns the instruction for the SUnit.
Definition: ScheduleDAG.h:391
LLVM_ABI void setHeightDirty()
Sets a flag in this node to indicate that its stored Height value will require recomputation the next...
bool isSucc(const SUnit *N) const
Tests if node N is a successor of this node.
Definition: ScheduleDAG.h:466
LLVM_ABI void removePred(const SDep &D)
Removes the specified edge as a pred of the current node if it exists.
bool isPred(const SUnit *N) const
Tests if node N is a predecessor of this node.
Definition: ScheduleDAG.h:458
unsigned short Latency
Node latency.
Definition: ScheduleDAG.h:312
SmallVectorImpl< SDep >::iterator pred_iterator
Definition: ScheduleDAG.h:272
bool isBoundaryNode() const
Boundary nodes are placeholders for the boundary of the scheduling region.
Definition: ScheduleDAG.h:367
unsigned short NumRegDefsLeft
Definition: ScheduleDAG.h:311
bool isScheduleHigh
True if preferable to schedule high.
Definition: ScheduleDAG.h:306
bool isPending
True once pending.
Definition: ScheduleDAG.h:303
unsigned getDepth() const
Returns the depth of this node, which is the length of the maximum path up to any node which has no p...
Definition: ScheduleDAG.h:425
bool isScheduled
True once scheduled.
Definition: ScheduleDAG.h:305
unsigned ParentClusterIdx
The parent cluster id.
Definition: ScheduleDAG.h:288
bool isAvailable
True once available.
Definition: ScheduleDAG.h:304
unsigned NumPredsLeft
Definition: ScheduleDAG.h:281
bool isScheduleLow
True if preferable to schedule low.
Definition: ScheduleDAG.h:307
bool hasPhysRegDefs
Has physreg defs that are being used.
Definition: ScheduleDAG.h:301
unsigned BotReadyCycle
Cycle relative to end when node is ready.
Definition: ScheduleDAG.h:286
LLVM_ABI void dumpAttributes() const
SmallVector< SDep, 4 > Succs
All sunit successors.
Definition: ScheduleDAG.h:270
Sched::Preference SchedulingPref
Scheduling preference.
Definition: ScheduleDAG.h:321
SUnit(SDNode *node, unsigned nodenum)
Constructs an SUnit for pre-regalloc scheduling to represent an SDNode and any nodes flagged to it.
Definition: ScheduleDAG.h:327
bool hasReservedResource
Uses a reserved resource.
Definition: ScheduleDAG.h:310
unsigned WeakPredsLeft
Definition: ScheduleDAG.h:283
const TargetRegisterClass * CopySrcRC
Definition: ScheduleDAG.h:267
bool isBottomReady() const
Definition: ScheduleDAG.h:476
SDNode * getNode() const
Returns the representative SDNode for this SUnit.
Definition: ScheduleDAG.h:379
bool isTwoAddress
Is a two-address instruction.
Definition: ScheduleDAG.h:298
bool isCommutable
Is a commutable instruction.
Definition: ScheduleDAG.h:299
bool isVRegCycle
May use and def the same vreg.
Definition: ScheduleDAG.h:295
SUnit()
Constructs a placeholder SUnit.
Definition: ScheduleDAG.h:350
SDNode * Node
Representative node.
Definition: ScheduleDAG.h:254
bool hasPhysRegUses
Has physreg uses.
Definition: ScheduleDAG.h:300
LLVM_ABI void setDepthDirty()
Sets a flag in this node to indicate that its stored Depth value will require recomputation the next ...
MachineInstr * Instr
Alternatively, a MachineInstr.
Definition: ScheduleDAG.h:255
bool isTopReady() const
Definition: ScheduleDAG.h:473
SmallVector< SDep, 4 > Preds
All sunit predecessors.
Definition: ScheduleDAG.h:269
unsigned WeakSuccsLeft
Definition: ScheduleDAG.h:284
SmallVectorImpl< SDep >::iterator succ_iterator
Definition: ScheduleDAG.h:273
LLVM_ABI void setDepthToAtLeast(unsigned NewDepth)
If NewDepth is greater than this node's depth value, sets it to be the new depth value.
SUnit * OrigNode
If not this, the node from which this node was cloned.
Definition: ScheduleDAG.h:259
LLVM_ABI bool addPred(const SDep &D, bool Required=true)
Adds the specified edge as a pred of the current node if not already.
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
Definition: ScheduleDAG.h:399
This class can compute a topological ordering for SUnits and provides methods for dynamically updatin...
Definition: ScheduleDAG.h:729
LLVM_ABI void RemovePred(SUnit *M, SUnit *N)
Updates the topological ordering to accommodate an edge to be removed from the specified node N from ...
LLVM_ABI bool WillCreateCycle(SUnit *TargetSU, SUnit *SU)
Returns true if addPred(TargetSU, SU) creates a cycle.
void MarkDirty()
Mark the ordering as temporarily broken, after a new node has been added.
Definition: ScheduleDAG.h:804
LLVM_ABI void AddSUnitWithoutPredecessors(const SUnit *SU)
Add a SUnit without predecessors to the end of the topological order.
const_reverse_iterator rbegin() const
Definition: ScheduleDAG.h:816
std::vector< int >::reverse_iterator reverse_iterator
Definition: ScheduleDAG.h:813
LLVM_ABI std::vector< int > GetSubGraph(const SUnit &StartSU, const SUnit &TargetSU, bool &Success)
Returns an array of SUs that are both in the successor subtree of StartSU and in the predecessor subt...
const_iterator end() const
Definition: ScheduleDAG.h:811
LLVM_ABI void InitDAGTopologicalSorting()
Creates the initial topological ordering from the DAG to be scheduled.
LLVM_ABI void AddPred(SUnit *Y, SUnit *X)
Updates the topological ordering to accommodate an edge to be added from SUnit X to SUnit Y.
std::vector< int >::const_iterator const_iterator
Definition: ScheduleDAG.h:807
std::vector< int >::iterator iterator
Definition: ScheduleDAG.h:806
const_reverse_iterator rend() const
Definition: ScheduleDAG.h:818
const_iterator begin() const
Definition: ScheduleDAG.h:809
LLVM_ABI bool IsReachable(const SUnit *SU, const SUnit *TargetSU)
Checks if SU is reachable from TargetSU.
LLVM_ABI void AddPredQueued(SUnit *Y, SUnit *X)
Queues an update to the topological ordering to accommodate an edge to be added from SUnit X to SUnit...
std::vector< int >::const_reverse_iterator const_reverse_iterator
Definition: ScheduleDAG.h:814
const MCInstrDesc * getInstrDesc(const SUnit *SU) const
Returns the MCInstrDesc of this SUnit.
Definition: ScheduleDAG.h:616
MachineRegisterInfo & MRI
Virtual/real register map.
Definition: ScheduleDAG.h:587
virtual std::string getGraphNodeLabel(const SUnit *SU) const =0
Returns a label for an SUnit node in a visualization of the ScheduleDAG.
const TargetInstrInfo * TII
Target instruction information.
Definition: ScheduleDAG.h:584
virtual std::string getDAGName() const =0
Returns a label for the region of code covered by the DAG.
std::vector< SUnit > SUnits
The scheduling units.
Definition: ScheduleDAG.h:588
virtual ~ScheduleDAG()
const TargetRegisterInfo * TRI
Target processor register info.
Definition: ScheduleDAG.h:585
SUnit EntrySU
Special node for the region entry.
Definition: ScheduleDAG.h:589
MachineFunction & MF
Machine function.
Definition: ScheduleDAG.h:586
ScheduleDAG & operator=(const ScheduleDAG &)=delete
virtual void dump() const =0
ScheduleDAG(const ScheduleDAG &)=delete
const TargetMachine & TM
Target processor.
Definition: ScheduleDAG.h:583
virtual void addCustomGraphFeatures(GraphWriter< ScheduleDAG * > &) const
Adds custom features for a visualization of the ScheduleDAG.
Definition: ScheduleDAG.h:636
virtual void dumpNode(const SUnit &SU) const =0
SUnit ExitSU
Special node for the region exit.
Definition: ScheduleDAG.h:590
This interface is used to plug different priorities computation algorithms into the list scheduler.
Definition: ScheduleDAG.h:523
void setCurCycle(unsigned Cycle)
Definition: ScheduleDAG.h:572
SchedulingPriorityQueue(bool rf=false)
Definition: ScheduleDAG.h:530
virtual void remove(SUnit *SU)=0
virtual bool isBottomUp() const =0
virtual void releaseState()=0
virtual SUnit * pop()=0
virtual void scheduledNode(SUnit *)
As each node is scheduled, this method is invoked.
Definition: ScheduleDAG.h:568
virtual bool isReady(SUnit *) const
Definition: ScheduleDAG.h:547
virtual bool tracksRegPressure() const
Definition: ScheduleDAG.h:545
virtual void dump(ScheduleDAG *) const
Definition: ScheduleDAG.h:563
virtual void initNodes(std::vector< SUnit > &SUnits)=0
virtual ~SchedulingPriorityQueue()=default
virtual bool empty() const =0
virtual void unscheduledNode(SUnit *)
Definition: ScheduleDAG.h:570
void push_all(const std::vector< SUnit * > &Nodes)
Definition: ScheduleDAG.h:554
virtual void addNode(const SUnit *SU)=0
unsigned getCurCycle() const
Definition: ScheduleDAG.h:576
virtual void updateNode(const SUnit *SU)=0
virtual void push(SUnit *U)=0
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:541
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:579
typename SuperClass::iterator iterator
Definition: SmallVector.h:578
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
TargetInstrInfo - Interface to description of machine instruction set.
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:83
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:82
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ None
Definition: CodeGenData.h:107
@ Success
The lock was released successfully.
constexpr unsigned InvalidClusterId
Definition: ScheduleDAG.h:241
@ Other
Any other memory.
bool isTheSameCluster(unsigned A, unsigned B)
Return whether the input cluster ID's are the same and valid.
Definition: ScheduleDAG.h:244
SmallPtrSet< SUnit *, 8 > ClusterInfo
Keep record of which SUnit are in the same cluster group.
Definition: ScheduleDAG.h:240
#define N
SUnitIterator ChildIteratorType
Definition: ScheduleDAG.h:705
static ChildIteratorType child_begin(NodeRef N)
Definition: ScheduleDAG.h:707
static NodeRef getEntryNode(SUnit *N)
Definition: ScheduleDAG.h:706
static ChildIteratorType child_end(NodeRef N)
Definition: ScheduleDAG.h:710
static nodes_iterator nodes_begin(ScheduleDAG *G)
Definition: ScheduleDAG.h:717
static nodes_iterator nodes_end(ScheduleDAG *G)
Definition: ScheduleDAG.h:720
pointer_iterator< std::vector< SUnit >::iterator > nodes_iterator
Definition: ScheduleDAG.h:716
Summarize the scheduling resources required for an instruction of a particular scheduling class.
Definition: MCSchedule.h:123