LLVM 24.0.0git
ResourcePriorityQueue.cpp
Go to the documentation of this file.
1//===- ResourcePriorityQueue.cpp - A DFA-oriented priority queue -*- 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// This file implements the ResourcePriorityQueue class, which is a
10// SchedulingPriorityQueue that prioritizes instructions using DFA state to
11// reduce the length of the critical path through the basic block
12// on VLIW platforms.
13// The scheduler is basically a top-down adaptable list scheduler with DFA
14// resource tracking added to the cost function.
15// DFA is queried as a state machine to model "packets/bundles" during
16// schedule. Currently packets/bundles are discarded at the end of
17// scheduling, affecting only order of instructions.
18//
19//===----------------------------------------------------------------------===//
20
22#include "SelectionDAGOptions.h"
30
31using namespace llvm;
32
33#define DEBUG_TYPE "scheduler"
34
36 : Picker(this), InstrItins(IS->MF->getSubtarget().getInstrItineraryData()) {
37 const TargetSubtargetInfo &STI = IS->MF->getSubtarget();
38 TRI = STI.getRegisterInfo();
39 TLI = IS->TLI;
40 TII = STI.getInstrInfo();
41 Opts = &IS->CurDAG->getSelectionDAGOptions();
42 ResourcesModel.reset(TII->CreateTargetScheduleState(STI));
43 // This hard requirement could be relaxed, but for now
44 // do not let it proceed.
45 assert(ResourcesModel && "Unimplemented CreateTargetScheduleState.");
46
47 MF = IS->MF;
48
49 unsigned NumRC = TRI->getNumRegClasses();
50 RegLimit.resize(NumRC);
51 RegPressure.resize(NumRC);
52}
53
55
56unsigned
57ResourcePriorityQueue::numberRCValPredInSU(SUnit *SU, unsigned RCId) {
58 unsigned NumberDeps = 0;
59 for (SDep &Pred : SU->Preds) {
60 if (Pred.isCtrl())
61 continue;
62
63 SUnit *PredSU = Pred.getSUnit();
64 const SDNode *ScegN = PredSU->getNode();
65
66 if (!ScegN)
67 continue;
68
69 // If value is passed to CopyToReg, it is probably
70 // live outside BB.
71 switch (ScegN->getOpcode()) {
72 default: break;
73 case ISD::TokenFactor: break;
74 case ISD::CopyFromReg: NumberDeps++; break;
75 case ISD::CopyToReg: break;
76 case ISD::INLINEASM: break;
77 case ISD::INLINEASM_BR: break;
78 }
79 if (!ScegN->isMachineOpcode())
80 continue;
81
82 for (unsigned i = 0, e = ScegN->getNumValues(); i != e; ++i) {
83 MVT VT = ScegN->getSimpleValueType(i);
84 if (TLI->isTypeLegal(VT)
85 && (TLI->getRegClassFor(VT)->getID() == RCId)) {
86 NumberDeps++;
87 break;
88 }
89 }
90 }
91 return NumberDeps;
92}
93
94unsigned ResourcePriorityQueue::numberRCValSuccInSU(SUnit *SU,
95 unsigned RCId) {
96 unsigned NumberDeps = 0;
97 for (const SDep &Succ : SU->Succs) {
98 if (Succ.isCtrl())
99 continue;
100
101 SUnit *SuccSU = Succ.getSUnit();
102 const SDNode *ScegN = SuccSU->getNode();
103 if (!ScegN)
104 continue;
105
106 // If value is passed to CopyToReg, it is probably
107 // live outside BB.
108 switch (ScegN->getOpcode()) {
109 default: break;
110 case ISD::TokenFactor: break;
111 case ISD::CopyFromReg: break;
112 case ISD::CopyToReg: NumberDeps++; break;
113 case ISD::INLINEASM: break;
114 case ISD::INLINEASM_BR: break;
115 }
116 if (!ScegN->isMachineOpcode())
117 continue;
118
119 for (unsigned i = 0, e = ScegN->getNumOperands(); i != e; ++i) {
120 const SDValue &Op = ScegN->getOperand(i);
121 MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo());
122 if (TLI->isTypeLegal(VT)
123 && (TLI->getRegClassFor(VT)->getID() == RCId)) {
124 NumberDeps++;
125 break;
126 }
127 }
128 }
129 return NumberDeps;
130}
131
132static unsigned numberCtrlDepsInSU(SUnit *SU) {
133 unsigned NumberDeps = 0;
134 for (const SDep &Succ : SU->Succs)
135 if (Succ.isCtrl())
136 NumberDeps++;
137
138 return NumberDeps;
139}
140
141static unsigned numberCtrlPredInSU(SUnit *SU) {
142 unsigned NumberDeps = 0;
143 for (SDep &Pred : SU->Preds)
144 if (Pred.isCtrl())
145 NumberDeps++;
146
147 return NumberDeps;
148}
149
150///
151/// Initialize nodes.
152///
153void ResourcePriorityQueue::initNodes(std::vector<SUnit> &sunits) {
154 SUnits = &sunits;
155 NumNodesSolelyBlocking.assign(SUnits->size(), 0);
156 // The limits depend on function state that can change between blocks, e.g.
157 // whether a frame pointer is needed.
158 for (const TargetRegisterClass &RC : TRI->regclasses())
159 RegLimit[RC.getID()] = TRI->getRegPressureLimit(&RC, *MF);
160 llvm::fill(RegPressure, 0);
161 ParallelLiveRanges = 0;
162 HorizontalVerticalBalance = 0;
163 ResourcesModel->clearResources();
164 Packet.clear();
165
166 for (SUnit &SU : *SUnits) {
168 SU.NodeQueueId = 0;
169 }
170}
171
172/// This heuristic is used if DFA scheduling is not desired
173/// for some VLIW platform.
174bool resource_sort::operator()(const SUnit *LHS, const SUnit *RHS) const {
175 // The isScheduleHigh flag allows nodes with wraparound dependencies that
176 // cannot easily be modeled as edges with latencies to be scheduled as
177 // soon as possible in a top-down schedule.
178 if (LHS->isScheduleHigh && !RHS->isScheduleHigh)
179 return false;
180
181 if (!LHS->isScheduleHigh && RHS->isScheduleHigh)
182 return true;
183
184 unsigned LHSNum = LHS->NodeNum;
185 unsigned RHSNum = RHS->NodeNum;
186
187 // The most important heuristic is scheduling the critical path.
188 unsigned LHSLatency = PQ->getLatency(LHSNum);
189 unsigned RHSLatency = PQ->getLatency(RHSNum);
190 if (LHSLatency < RHSLatency) return true;
191 if (LHSLatency > RHSLatency) return false;
192
193 // After that, if two nodes have identical latencies, look to see if one will
194 // unblock more other nodes than the other.
195 unsigned LHSBlocked = PQ->getNumSolelyBlockNodes(LHSNum);
196 unsigned RHSBlocked = PQ->getNumSolelyBlockNodes(RHSNum);
197 if (LHSBlocked < RHSBlocked) return true;
198 if (LHSBlocked > RHSBlocked) return false;
199
200 // Finally, just to provide a stable ordering, use the node number as a
201 // deciding factor.
202 return LHSNum < RHSNum;
203}
204
205
206/// getSingleUnscheduledPred - If there is exactly one unscheduled predecessor
207/// of SU, return it, otherwise return null.
208SUnit *ResourcePriorityQueue::getSingleUnscheduledPred(SUnit *SU) {
209 SUnit *OnlyAvailablePred = nullptr;
210 for (const SDep &Pred : SU->Preds) {
211 SUnit &PredSU = *Pred.getSUnit();
212 if (!PredSU.isScheduled) {
213 // We found an available, but not scheduled, predecessor. If it's the
214 // only one we have found, keep track of it... otherwise give up.
215 if (OnlyAvailablePred && OnlyAvailablePred != &PredSU)
216 return nullptr;
217 OnlyAvailablePred = &PredSU;
218 }
219 }
220 return OnlyAvailablePred;
221}
222
224 // Look at all of the successors of this node. Count the number of nodes that
225 // this node is the sole unscheduled node for.
226 unsigned NumNodesBlocking = 0;
227 for (const SDep &Succ : SU->Succs)
228 if (getSingleUnscheduledPred(Succ.getSUnit()) == SU)
229 ++NumNodesBlocking;
230
231 NumNodesSolelyBlocking[SU->NodeNum] = NumNodesBlocking;
232 Queue.push_back(SU);
233}
234
235/// Check if scheduling of this SU is possible
236/// in the current packet.
238 if (!SU || !SU->getNode())
239 return false;
240
241 // If this is a compound instruction,
242 // it is likely to be a call. Do not delay it.
243 if (SU->getNode()->getGluedNode())
244 return true;
245
246 // First see if the pipeline could receive this instruction
247 // in the current cycle.
248 if (SU->getNode()->isMachineOpcode())
249 switch (SU->getNode()->getMachineOpcode()) {
250 default:
251 if (!ResourcesModel->canReserveResources(&TII->get(
252 SU->getNode()->getMachineOpcode())))
253 return false;
254 break;
255 case TargetOpcode::EXTRACT_SUBREG:
256 case TargetOpcode::INSERT_SUBREG:
257 case TargetOpcode::SUBREG_TO_REG:
258 case TargetOpcode::REG_SEQUENCE:
259 case TargetOpcode::IMPLICIT_DEF:
260 break;
261 }
262
263 // Now see if there are no other dependencies
264 // to instructions already in the packet.
265 for (const SUnit *S : Packet)
266 for (const SDep &Succ : S->Succs) {
267 // Since we do not add pseudos to packets, might as well
268 // ignore order deps.
269 if (Succ.isCtrl())
270 continue;
271
272 if (Succ.getSUnit() == SU)
273 return false;
274 }
275
276 return true;
277}
278
279/// Keep track of available resources.
281 // If this SU does not fit in the packet
282 // start a new one.
283 if (!isResourceAvailable(SU) || SU->getNode()->getGluedNode()) {
284 ResourcesModel->clearResources();
285 Packet.clear();
286 }
287
288 if (SU->getNode() && SU->getNode()->isMachineOpcode()) {
289 switch (SU->getNode()->getMachineOpcode()) {
290 default:
291 ResourcesModel->reserveResources(&TII->get(
292 SU->getNode()->getMachineOpcode()));
293 break;
294 case TargetOpcode::EXTRACT_SUBREG:
295 case TargetOpcode::INSERT_SUBREG:
296 case TargetOpcode::SUBREG_TO_REG:
297 case TargetOpcode::REG_SEQUENCE:
298 case TargetOpcode::IMPLICIT_DEF:
299 break;
300 }
301 Packet.push_back(SU);
302 }
303 // Forcefully end packet for PseudoOps.
304 else {
305 ResourcesModel->clearResources();
306 Packet.clear();
307 }
308
309 // If packet is now full, reset the state so in the next cycle
310 // we start fresh.
311 if (Packet.size() >= InstrItins->SchedModel.IssueWidth) {
312 ResourcesModel->clearResources();
313 Packet.clear();
314 }
315}
316
318 int RegBalance = 0;
319
320 if (!SU || !SU->getNode() || !SU->getNode()->isMachineOpcode())
321 return RegBalance;
322
323 // Gen estimate.
324 for (unsigned i = 0, e = SU->getNode()->getNumValues(); i != e; ++i) {
325 MVT VT = SU->getNode()->getSimpleValueType(i);
326 if (TLI->isTypeLegal(VT)
327 && TLI->getRegClassFor(VT)
328 && TLI->getRegClassFor(VT)->getID() == RCId)
329 RegBalance += numberRCValSuccInSU(SU, RCId);
330 }
331 // Kill estimate.
332 for (unsigned i = 0, e = SU->getNode()->getNumOperands(); i != e; ++i) {
333 const SDValue &Op = SU->getNode()->getOperand(i);
334 MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo());
335 if (isa<ConstantSDNode>(Op.getNode()))
336 continue;
337
338 if (TLI->isTypeLegal(VT) && TLI->getRegClassFor(VT)
339 && TLI->getRegClassFor(VT)->getID() == RCId)
340 RegBalance -= numberRCValPredInSU(SU, RCId);
341 }
342 return RegBalance;
343}
344
345/// Estimates change in reg pressure from this SU.
346/// It is achieved by trivial tracking of defined
347/// and used vregs in dependent instructions.
348/// The RawPressure flag makes this function to ignore
349/// existing reg file sizes, and report raw def/use
350/// balance.
352 int RegBalance = 0;
353
354 if (!SU || !SU->getNode() || !SU->getNode()->isMachineOpcode())
355 return RegBalance;
356
357 if (RawPressure) {
358 for (const TargetRegisterClass &RC : TRI->regclasses())
359 RegBalance += rawRegPressureDelta(SU, RC.getID());
360 }
361 else {
362 for (const TargetRegisterClass &RC : TRI->regclasses()) {
363 if ((RegPressure[RC.getID()] + rawRegPressureDelta(SU, RC.getID()) > 0) &&
364 (RegPressure[RC.getID()] + rawRegPressureDelta(SU, RC.getID()) >=
365 RegLimit[RC.getID()]))
366 RegBalance += rawRegPressureDelta(SU, RC.getID());
367 }
368 }
369
370 return RegBalance;
371}
372
373// Constants used to denote relative importance of
374// heuristic components for cost computation.
375static const unsigned PriorityOne = 200;
376static const unsigned PriorityTwo = 50;
377static const unsigned PriorityThree = 15;
378static const unsigned PriorityFour = 5;
379static const unsigned ScaleOne = 20;
380static const unsigned ScaleTwo = 10;
381static const unsigned ScaleThree = 5;
382static const unsigned FactorOne = 2;
383
384/// Returns single number reflecting benefit of scheduling SU
385/// in the current cycle.
387 // Initial trivial priority.
388 int ResCount = 1;
389
390 // Do not waste time on a node that is already scheduled.
391 if (SU->isScheduled)
392 return ResCount;
393
394 // Forced priority is high.
395 if (SU->isScheduleHigh)
396 ResCount += PriorityOne;
397
398 // Adaptable scheduling
399 // A small, but very parallel
400 // region, where reg pressure is an issue.
401 if (HorizontalVerticalBalance > Opts->dfa_sched_reg_pressure_threshold) {
402 // Critical path first
403 ResCount += (SU->getHeight() * ScaleTwo);
404 // If resources are available for it, multiply the
405 // chance of scheduling.
406 if (isResourceAvailable(SU))
407 ResCount <<= FactorOne;
408
409 // Consider change to reg pressure from scheduling
410 // this SU.
411 ResCount -= (regPressureDelta(SU,true) * ScaleOne);
412 }
413 // Default heuristic, greeady and
414 // critical path driven.
415 else {
416 // Critical path first.
417 ResCount += (SU->getHeight() * ScaleTwo);
418 // Now see how many instructions is blocked by this SU.
419 ResCount += (NumNodesSolelyBlocking[SU->NodeNum] * ScaleTwo);
420 // If resources are available for it, multiply the
421 // chance of scheduling.
422 if (isResourceAvailable(SU))
423 ResCount <<= FactorOne;
424
425 ResCount -= (regPressureDelta(SU) * ScaleTwo);
426 }
427
428 // These are platform-specific things.
429 // Will need to go into the back end
430 // and accessed from here via a hook.
431 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode()) {
432 if (N->isMachineOpcode()) {
433 const MCInstrDesc &TID = TII->get(N->getMachineOpcode());
434 if (TID.isCall())
435 ResCount += (PriorityTwo + (ScaleThree*N->getNumValues()));
436 }
437 else
438 switch (N->getOpcode()) {
439 default: break;
440 case ISD::TokenFactor:
441 case ISD::CopyFromReg:
442 case ISD::CopyToReg:
443 ResCount += PriorityFour;
444 break;
445
446 case ISD::INLINEASM:
448 ResCount += PriorityThree;
449 break;
450 }
451 }
452 return ResCount;
453}
454
455
456/// Main resource tracking point.
458 // Use NULL entry as an event marker to reset
459 // the DFA state.
460 if (!SU) {
461 ResourcesModel->clearResources();
462 Packet.clear();
463 return;
464 }
465
466 const SDNode *ScegN = SU->getNode();
467 // Update reg pressure tracking.
468 // First update current node.
469 if (ScegN->isMachineOpcode()) {
470 // Estimate generated regs.
471 for (unsigned i = 0, e = ScegN->getNumValues(); i != e; ++i) {
472 MVT VT = ScegN->getSimpleValueType(i);
473
474 if (TLI->isTypeLegal(VT)) {
475 const TargetRegisterClass *RC = TLI->getRegClassFor(VT);
476 if (RC)
477 RegPressure[RC->getID()] += numberRCValSuccInSU(SU, RC->getID());
478 }
479 }
480 // Estimate killed regs.
481 for (unsigned i = 0, e = ScegN->getNumOperands(); i != e; ++i) {
482 const SDValue &Op = ScegN->getOperand(i);
483 MVT VT = Op.getNode()->getSimpleValueType(Op.getResNo());
484
485 if (TLI->isTypeLegal(VT)) {
486 const TargetRegisterClass *RC = TLI->getRegClassFor(VT);
487 if (RC) {
488 if (RegPressure[RC->getID()] >
489 (numberRCValPredInSU(SU, RC->getID())))
490 RegPressure[RC->getID()] -= numberRCValPredInSU(SU, RC->getID());
491 else RegPressure[RC->getID()] = 0;
492 }
493 }
494 }
495 for (SDep &Pred : SU->Preds) {
496 if (Pred.isCtrl() || (Pred.getSUnit()->NumRegDefsLeft == 0))
497 continue;
498 --Pred.getSUnit()->NumRegDefsLeft;
499 }
500 }
501
502 // Reserve resources for this SU.
504
505 // Adjust number of parallel live ranges.
506 // Heuristic is simple - node with no data successors reduces
507 // number of live ranges. All others, increase it.
508 unsigned NumberNonControlDeps = 0;
509
510 for (const SDep &Succ : SU->Succs) {
511 adjustPriorityOfUnscheduledPreds(Succ.getSUnit());
512 if (!Succ.isCtrl())
513 NumberNonControlDeps++;
514 }
515
516 if (!NumberNonControlDeps) {
517 if (ParallelLiveRanges >= SU->NumPreds)
518 ParallelLiveRanges -= SU->NumPreds;
519 else
520 ParallelLiveRanges = 0;
521
522 }
523 else
524 ParallelLiveRanges += SU->NumRegDefsLeft;
525
526 // Track parallel live chains.
527 HorizontalVerticalBalance += (SU->Succs.size() - numberCtrlDepsInSU(SU));
528 HorizontalVerticalBalance -= (SU->Preds.size() - numberCtrlPredInSU(SU));
529}
530
532 unsigned NodeNumDefs = 0;
533 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode())
534 if (N->isMachineOpcode()) {
535 const MCInstrDesc &TID = TII->get(N->getMachineOpcode());
536 // No register need be allocated for this.
537 if (N->getMachineOpcode() == TargetOpcode::IMPLICIT_DEF) {
538 NodeNumDefs = 0;
539 break;
540 }
541 NodeNumDefs = std::min(N->getNumValues(), TID.getNumDefs());
542 }
543 else
544 switch(N->getOpcode()) {
545 default: break;
546 case ISD::CopyFromReg:
547 NodeNumDefs++;
548 break;
549 case ISD::INLINEASM:
551 NodeNumDefs++;
552 break;
553 }
554
555 SU->NumRegDefsLeft = NodeNumDefs;
556}
557
558/// adjustPriorityOfUnscheduledPreds - One of the predecessors of SU was just
559/// scheduled. If SU is not itself available, then there is at least one
560/// predecessor node that has not been scheduled yet. If SU has exactly ONE
561/// unscheduled predecessor, we want to increase its priority: it getting
562/// scheduled will make this node available, so it is better than some other
563/// node of the same priority that will not make a node available.
564void ResourcePriorityQueue::adjustPriorityOfUnscheduledPreds(SUnit *SU) {
565 if (SU->isAvailable) return; // All preds scheduled.
566
567 SUnit *OnlyAvailablePred = getSingleUnscheduledPred(SU);
568 if (!OnlyAvailablePred || !OnlyAvailablePred->isAvailable)
569 return;
570
571 // Okay, we found a single predecessor that is available, but not scheduled.
572 // Since it is available, it must be in the priority queue. First remove it.
573 remove(OnlyAvailablePred);
574
575 // Reinsert the node into the priority queue, which recomputes its
576 // NumNodesSolelyBlocking value.
577 push(OnlyAvailablePred);
578}
579
580
581/// Main access point - returns next instructions
582/// to be placed in scheduling sequence.
584 if (empty())
585 return nullptr;
586
587 std::vector<SUnit *>::iterator Best = Queue.begin();
588 if (!Opts->disable_dfa_sched) {
589 int BestCost = SUSchedulingCost(*Best);
590 for (auto I = std::next(Queue.begin()), E = Queue.end(); I != E; ++I) {
591
592 if (SUSchedulingCost(*I) > BestCost) {
593 BestCost = SUSchedulingCost(*I);
594 Best = I;
595 }
596 }
597 }
598 // Use default TD scheduling mechanism.
599 else {
600 for (auto I = std::next(Queue.begin()), E = Queue.end(); I != E; ++I)
601 if (Picker(*Best, *I))
602 Best = I;
603 }
604
605 SUnit *V = *Best;
606 if (Best != std::prev(Queue.end()))
607 std::swap(*Best, Queue.back());
608
609 Queue.pop_back();
610
611 return V;
612}
613
614
616 assert(!Queue.empty() && "Queue is empty!");
617 std::vector<SUnit *>::iterator I = find(Queue, SU);
618 if (I != std::prev(Queue.end()))
619 std::swap(*I, Queue.back());
620
621 Queue.pop_back();
622}
return SDValue()
const TargetLowering & TLI
SDValue Pred
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define I(x, y, z)
Definition MD5.cpp:57
static const unsigned PriorityTwo
static const unsigned FactorOne
static const unsigned PriorityThree
static const unsigned ScaleOne
static unsigned numberCtrlPredInSU(SUnit *SU)
static const unsigned PriorityOne
static unsigned numberCtrlDepsInSU(SUnit *SU)
static const unsigned PriorityFour
static const unsigned ScaleTwo
static const unsigned ScaleThree
This file describes how to lower LLVM code to machine code.
Describe properties that are true of each instruction in the target description file.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
bool isCall() const
Return true if the instruction is a call.
unsigned getID() const
getID() - Return the register class ID number.
Machine Value Type.
void scheduledNode(SUnit *SU) override
scheduledNode - Main resource tracking point.
ResourcePriorityQueue(SelectionDAGISel *IS)
void initNodes(std::vector< SUnit > &sunits) override
Initialize nodes.
SUnit * pop() override
Main access point - returns next instructions to be placed in scheduling sequence.
int rawRegPressureDelta(SUnit *SU, unsigned RCId)
int regPressureDelta(SUnit *SU, bool RawPressure=false)
Estimates change in reg pressure from this SU.
void reserveResources(SUnit *SU)
Keep track of available resources.
int SUSchedulingCost(SUnit *SU)
Single cost function reflecting benefit of scheduling SU in the current cycle.
void initNumRegDefsLeft(SUnit *SU)
InitNumRegDefsLeft - Determine the # of regs defined by this node.
bool isResourceAvailable(SUnit *SU)
Check if scheduling of this SU is possible in the current packet.
Represents one node in the SelectionDAG.
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
unsigned getNumOperands() const
Return the number of values used by this operation.
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
const SDValue & getOperand(unsigned Num) const
SDNode * getGluedNode() const
If this node has a glue operand, return the node to which the glue operand points.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
Scheduling dependency.
Definition ScheduleDAG.h:54
SUnit * getSUnit() const
bool isCtrl() const
Shorthand for getKind() != SDep::Data.
Scheduling unit. This is a node in the scheduling DAG.
unsigned NumPreds
unsigned NodeQueueId
Queue id of node.
unsigned NodeNum
Entry # of node in the node vector.
unsigned getHeight() const
Returns the height of this node, which is the length of the maximum path down to any node which has n...
unsigned short NumRegDefsLeft
bool isScheduleHigh
True if preferable to schedule high.
bool isScheduled
True once scheduled.
bool isAvailable
True once available.
SmallVector< SDep, 4 > Succs
All sunit successors.
SDNode * getNode() const
Returns the representative SDNode for this SUnit.
SmallVector< SDep, 4 > Preds
All sunit predecessors.
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetInstrInfo * getInstrInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
@ CopyFromReg
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
Definition ISDOpcodes.h:232
@ CopyToReg
CopyToReg - This node has three operands: a chain, a register number to set to this value,...
Definition ISDOpcodes.h:226
@ INLINEASM_BR
INLINEASM_BR - Branching version of inline asm. Used by asm-goto.
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
Definition ISDOpcodes.h:55
@ INLINEASM
INLINEASM - Represents an inline asm block.
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1781
void fill(R &&Range, T &&Value)
Provide wrappers to std::fill which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1775
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
DWARFExpression::Operation Op
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:881
#define N
LLVM_ABI bool operator()(const SUnit *LHS, const SUnit *RHS) const
This heuristic is used if DFA scheduling is not desired for some VLIW platform.
ResourcePriorityQueue * PQ