Home | History | Annotate | Download | only in Hexagon

Lines Matching defs:SU

28   for (unsigned su = 0, e = SUnits.size(); su != e; ++su) {
30 if (SUnits[su].getInstr()->isCall())
31 LastSequentialCall = &(SUnits[su]);
33 else if (SUnits[su].getInstr()->isCompare() && LastSequentialCall)
34 SUnits[su].addPred(SDep(LastSequentialCall, SDep::Barrier));
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(");
167 for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
168 if (SUnits[su].getHeight() > maxH)
169 maxH = SUnits[su].getHeight();
172 for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
173 if (SUnits[su].getDepth() > maxD)
174 maxD = SUnits[su].getDepth();
176 DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
177 SUnits[su].dumpAll(this));
182 while (SUnit *SU = SchedImpl->pickNode(IsTopNode)) {
186 scheduleMI(SU, IsTopNode);
188 updateQueues(SU, IsTopNode);
191 SchedImpl->schedNode(SU, IsTopNode);
223 void ConvergingVLIWScheduler::releaseTopNode(SUnit *SU) {
224 if (SU->isScheduled)
227 for (SUnit::succ_iterator I = SU->Preds.begin(), E = SU->Preds.end();
234 if (SU->TopReadyCycle < PredReadyCycle + MinLatency)
235 SU->TopReadyCycle = PredReadyCycle + MinLatency;
237 Top.releaseNode(SU, SU->TopReadyCycle);
240 void ConvergingVLIWScheduler::releaseBottomNode(SUnit *SU) {
241 if (SU->isScheduled)
244 assert(SU->getInstr() && "Scheduled SUnit must have instr");
246 for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
253 if (SU->BotReadyCycle < SuccReadyCycle + MinLatency)
254 SU->BotReadyCycle = SuccReadyCycle + MinLatency;
256 Bot.releaseNode(SU, SU->BotReadyCycle);
259 /// Does this SU have a hazard within the current instruction group.
271 /// TODO: Also check whether the SU must start a new group.
272 bool ConvergingVLIWScheduler::VLIWSchedBoundary::checkHazard(SUnit *SU) {
274 return HazardRec->getHazardType(SU) != ScheduleHazardRecognizer::NoHazard;
276 unsigned uops = SchedModel->getNumMicroOps(SU->getInstr());
283 void ConvergingVLIWScheduler::VLIWSchedBoundary::releaseNode(SUnit *SU,
290 if (ReadyCycle > CurrCycle || checkHazard(SU))
292 Pending.push(SU);
294 Available.push(SU);
324 void ConvergingVLIWScheduler::VLIWSchedBoundary::bumpNode(SUnit *SU) {
329 if (!isTop() && SU->isCall) {
334 HazardRec->EmitInstruction(SU);
338 startNewCycle = ResourceModel->reserveResources(SU);
341 // TODO: Check if this SU must end a dispatch group.
342 IssueCount += SchedModel->getNumMicroOps(SU->getInstr());
362 SUnit *SU = *(Pending.begin()+i);
363 unsigned ReadyCycle = isTop() ? SU->TopReadyCycle : SU->BotReadyCycle;
371 if (checkHazard(SU))
374 Available.push(SU);
381 /// Remove SU from the ready set for this boundary.
382 void ConvergingVLIWScheduler::VLIWSchedBoundary::removeReady(SUnit *SU) {
383 if (Available.isInQueue(SU))
384 Available.remove(Available.find(SU));
386 assert(Pending.isInQueue(SU) && "bad ready count");
387 Pending.remove(Pending.find(SU));
413 SUnit *SU, PressureChange P) {
420 SU->dump(DAG);
425 /// of SU, return it, otherwise return null.
426 static SUnit *getSingleUnscheduledPred(SUnit *SU) {
428 for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
443 /// of SU, return it, otherwise return null.
444 static SUnit *getSingleUnscheduledSucc(SUnit *SU) {
446 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
469 int ConvergingVLIWScheduler::SchedulingCost(ReadyQueue &Q, SUnit *SU,
477 if (!SU || SU->isScheduled)
481 if (SU->isScheduleHigh)
486 ResCount += (SU->getHeight() * ScaleTwo);
490 if (Top.ResourceModel->isResourceAvailable(SU))
493 ResCount += (SU->getDepth() * ScaleTwo);
497 if (Bot.ResourceModel->isResourceAvailable(SU))
507 for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
509 if (getSingleUnscheduledPred(I->getSUnit()) == SU)
513 for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
515 if (getSingleUnscheduledSucc(I->getSUnit()) == SU)
553 if (!Candidate.SU) {
554 Candidate.SU = *I;
564 Candidate.SU = *I;
583 if (SUnit *SU = Bot.pickOnlyChoice()) {
585 return SU;
587 if (SUnit *SU = Top.pickOnlyChoice()) {
589 return SU;
606 return BotCand.SU;
616 return TopCand.SU;
622 return BotCand.SU;
626 return TopCand.SU;
630 return TopCand.SU;
634 return BotCand.SU;
644 SUnit *SU;
646 SU = Top.pickOnlyChoice();
647 if (!SU) {
653 SU = TopCand.SU;
657 SU = Bot.pickOnlyChoice();
658 if (!SU) {
664 SU = BotCand.SU;
668 SU = pickNodeBidrectional(IsTopNode);
670 if (SU->isTopReady())
671 Top.removeReady(SU);
672 if (SU->isBottomReady())
673 Bot.removeReady(SU);
678 SU->dump(DAG));
679 return SU;
686 void ConvergingVLIWScheduler::schedNode(SUnit *SU, bool IsTopNode) {
688 SU->TopReadyCycle = Top.CurrCycle;
689 Top.bumpNode(SU);
691 SU->BotReadyCycle = Bot.CurrCycle;
692 Bot.bumpNode(SU);