Lines Matching refs:SU

72 ResourcePriorityQueue::numberRCValPredInSU(SUnit *SU, unsigned RCId) {
74 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
109 unsigned ResourcePriorityQueue::numberRCValSuccInSU(SUnit *SU,
112 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
147 static unsigned numberCtrlDepsInSU(SUnit *SU) {
149 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
157 static unsigned numberCtrlPredInSU(SUnit *SU) {
159 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
175 SUnit *SU = &(*SUnits)[i];
176 initNumRegDefsLeft(SU);
177 SU->NodeQueueId = 0;
216 /// of SU, return it, otherwise return null.
217 SUnit *ResourcePriorityQueue::getSingleUnscheduledPred(SUnit *SU) {
219 for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
233 void ResourcePriorityQueue::push(SUnit *SU) {
237 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
239 if (getSingleUnscheduledPred(I->getSUnit()) == SU)
242 NumNodesSolelyBlocking[SU->NodeNum] = NumNodesBlocking;
243 Queue.push_back(SU);
246 /// Check if scheduling of this SU is possible
248 bool ResourcePriorityQueue::isResourceAvailable(SUnit *SU) {
249 if (!SU || !SU->getNode())
254 if (SU->getNode()->getGluedNode())
259 if (SU->getNode()->isMachineOpcode())
260 switch (SU->getNode()->getMachineOpcode()) {
263 SU->getNode()->getMachineOpcode())))
283 if (I->getSUnit() == SU)
291 void ResourcePriorityQueue::reserveResources(SUnit *SU) {
292 // If this SU does not fit in the packet
294 if (!isResourceAvailable(SU) || SU->getNode()->getGluedNode()) {
299 if (SU->getNode() && SU->getNode()->isMachineOpcode()) {
300 switch (SU->getNode()->getMachineOpcode()) {
303 SU->getNode()->getMachineOpcode()));
312 Packet.push_back(SU);
328 signed ResourcePriorityQueue::rawRegPressureDelta(SUnit *SU, unsigned RCId) {
331 if (!SU || !SU->getNode() || !SU->getNode()->isMachineOpcode())
335 for (unsigned i = 0, e = SU->getNode()->getNumValues(); i != e; ++i) {
336 MVT VT = SU->getNode()->getSimpleValueType(i);
340 RegBalance += numberRCValSuccInSU(SU, RCId);
343 for (unsigned i = 0, e = SU->getNode()->getNumOperands(); i != e; ++i) {
344 const SDValue &Op = SU->getNode()->getOperand(i);
351 RegBalance -= numberRCValPredInSU(SU, RCId);
356 /// Estimates change in reg pressure from this SU.
362 signed ResourcePriorityQueue::regPressureDelta(SUnit *SU, bool RawPressure) {
365 if (!SU || !SU->getNode() || !SU->getNode()->isMachineOpcode())
372 RegBalance += rawRegPressureDelta(SU, RC->getID());
380 rawRegPressureDelta(SU, RC->getID()) > 0) &&
382 rawRegPressureDelta(SU, RC->getID()) >= RegLimit[RC->getID()]))
383 RegBalance += rawRegPressureDelta(SU, RC->getID());
401 /// Returns single number reflecting benefit of scheduling SU
403 signed ResourcePriorityQueue::SUSchedulingCost(SUnit *SU) {
408 if (SU->isScheduled)
412 if (SU->isScheduleHigh)
420 ResCount += (SU->getHeight() * ScaleTwo);
423 if (isResourceAvailable(SU))
427 // this SU.
428 ResCount -= (regPressureDelta(SU,true) * ScaleOne);
434 ResCount += (SU->getHeight() * ScaleTwo);
435 // Now see how many instructions is blocked by this SU.
436 ResCount += (NumNodesSolelyBlocking[SU->NodeNum] * ScaleTwo);
439 if (isResourceAvailable(SU))
442 ResCount -= (regPressureDelta(SU) * ScaleTwo);
448 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode()) {
473 void ResourcePriorityQueue::scheduledNode(SUnit *SU) {
476 if (!SU) {
482 const SDNode *ScegN = SU->getNode();
493 RegPressure[RC->getID()] += numberRCValSuccInSU(SU, RC->getID());
505 (numberRCValPredInSU(SU, RC->getID())))
506 RegPressure[RC->getID()] -= numberRCValPredInSU(SU, RC->getID());
511 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
519 // Reserve resources for this SU.
520 reserveResources(SU);
527 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
535 if (ParallelLiveRanges >= SU->NumPreds)
536 ParallelLiveRanges -= SU->NumPreds;
542 ParallelLiveRanges += SU->NumRegDefsLeft;
545 HorizontalVerticalBalance += (SU->Succs.size() - numberCtrlDepsInSU(SU));
546 HorizontalVerticalBalance -= (SU->Preds.size() - numberCtrlPredInSU(SU));
549 void ResourcePriorityQueue::initNumRegDefsLeft(SUnit *SU) {
551 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode())
572 SU->NumRegDefsLeft = NodeNumDefs;
575 /// adjustPriorityOfUnscheduledPreds - One of the predecessors of SU was just
576 /// scheduled. If SU is not itself available, then there is at least one
577 /// predecessor node that has not been scheduled yet. If SU has exactly ONE
581 void ResourcePriorityQueue::adjustPriorityOfUnscheduledPreds(SUnit *SU) {
582 if (SU->isAvailable) return; // All preds scheduled.
584 SUnit *OnlyAvailablePred = getSingleUnscheduledPred(SU);
634 void ResourcePriorityQueue::remove(SUnit *SU) {
636 std::vector<SUnit *>::iterator I = std::find(Queue.begin(), Queue.end(), SU);