Lines Matching refs:SU

38 /// Check if scheduling of this SU is possible
43 bool VLIWResourceModel::isResourceAvailable(SUnit *SU) {
44 if (!SU || !SU->getInstr())
49 switch (SU->getInstr()->getOpcode()) {
51 if (!ResourcesModel->canReserveResources(*SU->getInstr()))
75 if (I->getSUnit() == SU)
83 bool VLIWResourceModel::reserveResources(SUnit *SU) {
86 if (!SU) {
92 // If this SU does not fit in the packet
94 if (!isResourceAvailable(SU)) {
101 switch (SU->getInstr()->getOpcode()) {
103 ResourcesModel->reserveResources(*SU->getInstr());
117 Packet.push_back(SU);
122 DEBUG(dbgs() << "\t[" << i << "] SU(");
184 SUnit *SU = SchedImpl->pickNode(IsTopNode);
185 if (!SU) break;
190 scheduleMI(SU, IsTopNode);
192 updateQueues(SU, IsTopNode);
195 SchedImpl->schedNode(SU, IsTopNode);
228 void ConvergingVLIWScheduler::releaseTopNode(SUnit *SU) {
229 if (SU->isScheduled)
232 for (SUnit::succ_iterator I = SU->Preds.begin(), E = SU->Preds.end();
239 if (SU->TopReadyCycle < PredReadyCycle + MinLatency)
240 SU->TopReadyCycle = PredReadyCycle + MinLatency;
242 Top.releaseNode(SU, SU->TopReadyCycle);
245 void ConvergingVLIWScheduler::releaseBottomNode(SUnit *SU) {
246 if (SU->isScheduled)
249 assert(SU->getInstr() && "Scheduled SUnit must have instr");
251 for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
258 if (SU->BotReadyCycle < SuccReadyCycle + MinLatency)
259 SU->BotReadyCycle = SuccReadyCycle + MinLatency;
261 Bot.releaseNode(SU, SU->BotReadyCycle);
264 /// Does this SU have a hazard within the current instruction group.
276 /// TODO: Also check whether the SU must start a new group.
277 bool ConvergingVLIWScheduler::VLIWSchedBoundary::checkHazard(SUnit *SU) {
279 return HazardRec->getHazardType(SU) != ScheduleHazardRecognizer::NoHazard;
281 unsigned uops = SchedModel->getNumMicroOps(SU->getInstr());
288 void ConvergingVLIWScheduler::VLIWSchedBoundary::releaseNode(SUnit *SU,
295 if (ReadyCycle > CurrCycle || checkHazard(SU))
297 Pending.push(SU);
299 Available.push(SU);
329 void ConvergingVLIWScheduler::VLIWSchedBoundary::bumpNode(SUnit *SU) {
334 if (!isTop() && SU->isCall) {
339 HazardRec->EmitInstruction(SU);
343 startNewCycle = ResourceModel->reserveResources(SU);
346 // TODO: Check if this SU must end a dispatch group.
347 IssueCount += SchedModel->getNumMicroOps(SU->getInstr());
367 SUnit *SU = *(Pending.begin()+i);
368 unsigned ReadyCycle = isTop() ? SU->TopReadyCycle : SU->BotReadyCycle;
376 if (checkHazard(SU))
379 Available.push(SU);
386 /// Remove SU from the ready set for this boundary.
387 void ConvergingVLIWScheduler::VLIWSchedBoundary::removeReady(SUnit *SU) {
388 if (Available.isInQueue(SU))
389 Available.remove(Available.find(SU));
391 assert(Pending.isInQueue(SU) && "bad ready count");
392 Pending.remove(Pending.find(SU));
418 SUnit *SU, PressureChange P) {
425 SU->dump(DAG);
430 /// of SU, return it, otherwise return null.
431 static SUnit *getSingleUnscheduledPred(SUnit *SU) {
433 for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
448 /// of SU, return it, otherwise return null.
449 static SUnit *getSingleUnscheduledSucc(SUnit *SU) {
451 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
474 int ConvergingVLIWScheduler::SchedulingCost(ReadyQueue &Q, SUnit *SU,
482 if (!SU || SU->isScheduled)
486 if (SU->isScheduleHigh)
491 ResCount += (SU->getHeight() * ScaleTwo);
495 if (Top.ResourceModel->isResourceAvailable(SU))
498 ResCount += (SU->getDepth() * ScaleTwo);
502 if (Bot.ResourceModel->isResourceAvailable(SU))
512 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
514 if (getSingleUnscheduledPred(I->getSUnit()) == SU)
518 for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
520 if (getSingleUnscheduledSucc(I->getSUnit()) == SU)
558 if (!Candidate.SU) {
559 Candidate.SU = *I;
569 Candidate.SU = *I;
588 if (SUnit *SU = Bot.pickOnlyChoice()) {
590 return SU;
592 if (SUnit *SU = Top.pickOnlyChoice()) {
594 return SU;
611 return BotCand.SU;
621 return TopCand.SU;
627 return BotCand.SU;
631 return TopCand.SU;
635 return TopCand.SU;
639 return BotCand.SU;
649 SUnit *SU;
651 SU = Top.pickOnlyChoice();
652 if (!SU) {
658 SU = TopCand.SU;
662 SU = Bot.pickOnlyChoice();
663 if (!SU) {
669 SU = BotCand.SU;
673 SU = pickNodeBidrectional(IsTopNode);
675 if (SU->isTopReady())
676 Top.removeReady(SU);
677 if (SU->isBottomReady())
678 Bot.removeReady(SU);
683 SU->dump(DAG));
684 return SU;
691 void ConvergingVLIWScheduler::schedNode(SUnit *SU, bool IsTopNode) {
693 SU->TopReadyCycle = Top.CurrCycle;
694 Top.bumpNode(SU);
696 SU->BotReadyCycle = Bot.CurrCycle;
697 Bot.bumpNode(SU);