Lines Matching refs:SU

70 ResourcePriorityQueue::numberRCValPredInSU(SUnit *SU, unsigned RCId) {
72 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
107 unsigned ResourcePriorityQueue::numberRCValSuccInSU(SUnit *SU,
110 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
145 static unsigned numberCtrlDepsInSU(SUnit *SU) {
147 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
155 static unsigned numberCtrlPredInSU(SUnit *SU) {
157 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
173 SUnit *SU = &(*SUnits)[i];
174 initNumRegDefsLeft(SU);
175 SU->NodeQueueId = 0;
214 /// of SU, return it, otherwise return null.
215 SUnit *ResourcePriorityQueue::getSingleUnscheduledPred(SUnit *SU) {
217 for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
231 void ResourcePriorityQueue::push(SUnit *SU) {
235 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
237 if (getSingleUnscheduledPred(I->getSUnit()) == SU)
240 NumNodesSolelyBlocking[SU->NodeNum] = NumNodesBlocking;
241 Queue.push_back(SU);
244 /// Check if scheduling of this SU is possible
246 bool ResourcePriorityQueue::isResourceAvailable(SUnit *SU) {
247 if (!SU || !SU->getNode())
252 if (SU->getNode()->getGluedNode())
257 if (SU->getNode()->isMachineOpcode())
258 switch (SU->getNode()->getMachineOpcode()) {
261 SU->getNode()->getMachineOpcode())))
281 if (I->getSUnit() == SU)
289 void ResourcePriorityQueue::reserveResources(SUnit *SU) {
290 // If this SU does not fit in the packet
292 if (!isResourceAvailable(SU) || SU->getNode()->getGluedNode()) {
297 if (SU->getNode() && SU->getNode()->isMachineOpcode()) {
298 switch (SU->getNode()->getMachineOpcode()) {
301 SU->getNode()->getMachineOpcode()));
310 Packet.push_back(SU);
326 signed ResourcePriorityQueue::rawRegPressureDelta(SUnit *SU, unsigned RCId) {
329 if (!SU || !SU->getNode() || !SU->getNode()->isMachineOpcode())
333 for (unsigned i = 0, e = SU->getNode()->getNumValues(); i != e; ++i) {
334 MVT VT = SU->getNode()->getSimpleValueType(i);
338 RegBalance += numberRCValSuccInSU(SU, RCId);
341 for (unsigned i = 0, e = SU->getNode()->getNumOperands(); i != e; ++i) {
342 const SDValue &Op = SU->getNode()->getOperand(i);
349 RegBalance -= numberRCValPredInSU(SU, RCId);
354 /// Estimates change in reg pressure from this SU.
360 signed ResourcePriorityQueue::regPressureDelta(SUnit *SU, bool RawPressure) {
363 if (!SU || !SU->getNode() || !SU->getNode()->isMachineOpcode())
370 RegBalance += rawRegPressureDelta(SU, RC->getID());
378 rawRegPressureDelta(SU, RC->getID()) > 0) &&
380 rawRegPressureDelta(SU, RC->getID()) >= RegLimit[RC->getID()]))
381 RegBalance += rawRegPressureDelta(SU, RC->getID());
399 /// Returns single number reflecting benefit of scheduling SU
401 signed ResourcePriorityQueue::SUSchedulingCost(SUnit *SU) {
406 if (SU->isScheduled)
410 if (SU->isScheduleHigh)
418 ResCount += (SU->getHeight() * ScaleTwo);
421 if (isResourceAvailable(SU))
425 // this SU.
426 ResCount -= (regPressureDelta(SU,true) * ScaleOne);
432 ResCount += (SU->getHeight() * ScaleTwo);
433 // Now see how many instructions is blocked by this SU.
434 ResCount += (NumNodesSolelyBlocking[SU->NodeNum] * ScaleTwo);
437 if (isResourceAvailable(SU))
440 ResCount -= (regPressureDelta(SU) * ScaleTwo);
446 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode()) {
471 void ResourcePriorityQueue::scheduledNode(SUnit *SU) {
474 if (!SU) {
480 const SDNode *ScegN = SU->getNode();
491 RegPressure[RC->getID()] += numberRCValSuccInSU(SU, RC->getID());
503 (numberRCValPredInSU(SU, RC->getID())))
504 RegPressure[RC->getID()] -= numberRCValPredInSU(SU, RC->getID());
509 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
517 // Reserve resources for this SU.
518 reserveResources(SU);
525 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
533 if (ParallelLiveRanges >= SU->NumPreds)
534 ParallelLiveRanges -= SU->NumPreds;
540 ParallelLiveRanges += SU->NumRegDefsLeft;
543 HorizontalVerticalBalance += (SU->Succs.size() - numberCtrlDepsInSU(SU));
544 HorizontalVerticalBalance -= (SU->Preds.size() - numberCtrlPredInSU(SU));
547 void ResourcePriorityQueue::initNumRegDefsLeft(SUnit *SU) {
549 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode())
570 SU->NumRegDefsLeft = NodeNumDefs;
573 /// adjustPriorityOfUnscheduledPreds - One of the predecessors of SU was just
574 /// scheduled. If SU is not itself available, then there is at least one
575 /// predecessor node that has not been scheduled yet. If SU has exactly ONE
579 void ResourcePriorityQueue::adjustPriorityOfUnscheduledPreds(SUnit *SU) {
580 if (SU->isAvailable) return; // All preds scheduled.
582 SUnit *OnlyAvailablePred = getSingleUnscheduledPred(SU);
632 void ResourcePriorityQueue::remove(SUnit *SU) {
634 std::vector<SUnit *>::iterator I = std::find(Queue.begin(), Queue.end(), SU);