Lines Matching refs:SU

71 ResourcePriorityQueue::numberRCValPredInSU(SUnit *SU, unsigned RCId) {
73 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
108 unsigned ResourcePriorityQueue::numberRCValSuccInSU(SUnit *SU,
111 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
146 static unsigned numberCtrlDepsInSU(SUnit *SU) {
148 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
156 static unsigned numberCtrlPredInSU(SUnit *SU) {
158 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
174 SUnit *SU = &(*SUnits)[i];
175 initNumRegDefsLeft(SU);
176 SU->NodeQueueId = 0;
215 /// of SU, return it, otherwise return null.
216 SUnit *ResourcePriorityQueue::getSingleUnscheduledPred(SUnit *SU) {
218 for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
232 void ResourcePriorityQueue::push(SUnit *SU) {
236 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
238 if (getSingleUnscheduledPred(I->getSUnit()) == SU)
241 NumNodesSolelyBlocking[SU->NodeNum] = NumNodesBlocking;
242 Queue.push_back(SU);
245 /// Check if scheduling of this SU is possible
247 bool ResourcePriorityQueue::isResourceAvailable(SUnit *SU) {
248 if (!SU || !SU->getNode())
253 if (SU->getNode()->getGluedNode())
258 if (SU->getNode()->isMachineOpcode())
259 switch (SU->getNode()->getMachineOpcode()) {
262 SU->getNode()->getMachineOpcode())))
282 if (I->getSUnit() == SU)
290 void ResourcePriorityQueue::reserveResources(SUnit *SU) {
291 // If this SU does not fit in the packet
293 if (!isResourceAvailable(SU) || SU->getNode()->getGluedNode()) {
298 if (SU->getNode() && SU->getNode()->isMachineOpcode()) {
299 switch (SU->getNode()->getMachineOpcode()) {
302 SU->getNode()->getMachineOpcode()));
311 Packet.push_back(SU);
327 signed ResourcePriorityQueue::rawRegPressureDelta(SUnit *SU, unsigned RCId) {
330 if (!SU || !SU->getNode() || !SU->getNode()->isMachineOpcode())
334 for (unsigned i = 0, e = SU->getNode()->getNumValues(); i != e; ++i) {
335 MVT VT = SU->getNode()->getSimpleValueType(i);
339 RegBalance += numberRCValSuccInSU(SU, RCId);
342 for (unsigned i = 0, e = SU->getNode()->getNumOperands(); i != e; ++i) {
343 const SDValue &Op = SU->getNode()->getOperand(i);
350 RegBalance -= numberRCValPredInSU(SU, RCId);
355 /// Estimates change in reg pressure from this SU.
361 signed ResourcePriorityQueue::regPressureDelta(SUnit *SU, bool RawPressure) {
364 if (!SU || !SU->getNode() || !SU->getNode()->isMachineOpcode())
371 RegBalance += rawRegPressureDelta(SU, RC->getID());
379 rawRegPressureDelta(SU, RC->getID()) > 0) &&
381 rawRegPressureDelta(SU, RC->getID()) >= RegLimit[RC->getID()]))
382 RegBalance += rawRegPressureDelta(SU, RC->getID());
400 /// Returns single number reflecting benefit of scheduling SU
402 signed ResourcePriorityQueue::SUSchedulingCost(SUnit *SU) {
407 if (SU->isScheduled)
411 if (SU->isScheduleHigh)
419 ResCount += (SU->getHeight() * ScaleTwo);
422 if (isResourceAvailable(SU))
426 // this SU.
427 ResCount -= (regPressureDelta(SU,true) * ScaleOne);
433 ResCount += (SU->getHeight() * ScaleTwo);
434 // Now see how many instructions is blocked by this SU.
435 ResCount += (NumNodesSolelyBlocking[SU->NodeNum] * ScaleTwo);
438 if (isResourceAvailable(SU))
441 ResCount -= (regPressureDelta(SU) * ScaleTwo);
447 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode()) {
472 void ResourcePriorityQueue::scheduledNode(SUnit *SU) {
475 if (!SU) {
481 const SDNode *ScegN = SU->getNode();
492 RegPressure[RC->getID()] += numberRCValSuccInSU(SU, RC->getID());
504 (numberRCValPredInSU(SU, RC->getID())))
505 RegPressure[RC->getID()] -= numberRCValPredInSU(SU, RC->getID());
510 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
518 // Reserve resources for this SU.
519 reserveResources(SU);
526 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
534 if (ParallelLiveRanges >= SU->NumPreds)
535 ParallelLiveRanges -= SU->NumPreds;
541 ParallelLiveRanges += SU->NumRegDefsLeft;
544 HorizontalVerticalBalance += (SU->Succs.size() - numberCtrlDepsInSU(SU));
545 HorizontalVerticalBalance -= (SU->Preds.size() - numberCtrlPredInSU(SU));
548 void ResourcePriorityQueue::initNumRegDefsLeft(SUnit *SU) {
550 for (SDNode *N = SU->getNode(); N; N = N->getGluedNode())
571 SU->NumRegDefsLeft = NodeNumDefs;
574 /// adjustPriorityOfUnscheduledPreds - One of the predecessors of SU was just
575 /// scheduled. If SU is not itself available, then there is at least one
576 /// predecessor node that has not been scheduled yet. If SU has exactly ONE
580 void ResourcePriorityQueue::adjustPriorityOfUnscheduledPreds(SUnit *SU) {
581 if (SU->isAvailable) return; // All preds scheduled.
583 SUnit *OnlyAvailablePred = getSingleUnscheduledPred(SU);
633 void ResourcePriorityQueue::remove(SUnit *SU) {
635 std::vector<SUnit *>::iterator I = std::find(Queue.begin(), Queue.end(), SU);