• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/contrib/llvm-project/llvm/lib/Target/Hexagon/

Lines Matching defs:SU

92 /// Check if scheduling of this SU is possible
97 bool VLIWResourceModel::isResourceAvailable(SUnit *SU, bool IsTop) {
98 if (!SU || !SU->getInstr())
103 switch (SU->getInstr()->getOpcode()) {
105 if (!ResourcesModel->canReserveResources(*SU->getInstr()))
119 MachineBasicBlock *MBB = SU->getInstr()->getParent();
127 if (hasDependence(Packet[i], SU, QII))
131 if (hasDependence(SU, Packet[i], QII))
138 bool VLIWResourceModel::reserveResources(SUnit *SU, bool IsTop) {
141 if (!SU) {
147 // If this SU does not fit in the packet or the packet is now full
149 if (!isResourceAvailable(SU, IsTop) ||
157 switch (SU->getInstr()->getOpcode()) {
159 ResourcesModel->reserveResources(*SU->getInstr());
174 Packet.push_back(SU);
179 LLVM_DEBUG(dbgs() << "\t[" << i << "] SU(");
228 SUnit *SU = SchedImpl->pickNode(IsTopNode);
229 if (!SU) break;
234 scheduleMI(SU, IsTopNode);
237 SchedImpl->schedNode(SU, IsTopNode);
239 updateQueues(SU, IsTopNode);
288 void ConvergingVLIWScheduler::releaseTopNode(SUnit *SU) {
289 if (SU->isScheduled)
292 for (const SDep &PI : SU->Preds) {
298 if (SU->TopReadyCycle < PredReadyCycle + MinLatency)
299 SU->TopReadyCycle = PredReadyCycle + MinLatency;
301 Top.releaseNode(SU, SU->TopReadyCycle);
304 void ConvergingVLIWScheduler::releaseBottomNode(SUnit *SU) {
305 if (SU->isScheduled)
308 assert(SU->getInstr() && "Scheduled SUnit must have instr");
310 for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
317 if (SU->BotReadyCycle < SuccReadyCycle + MinLatency)
318 SU->BotReadyCycle = SuccReadyCycle + MinLatency;
320 Bot.releaseNode(SU, SU->BotReadyCycle);
323 /// Does this SU have a hazard within the current instruction group.
335 /// TODO: Also check whether the SU must start a new group.
336 bool ConvergingVLIWScheduler::VLIWSchedBoundary::checkHazard(SUnit *SU) {
338 return HazardRec->getHazardType(SU) != ScheduleHazardRecognizer::NoHazard;
340 unsigned uops = SchedModel->getNumMicroOps(SU->getInstr());
347 void ConvergingVLIWScheduler::VLIWSchedBoundary::releaseNode(SUnit *SU,
354 if (ReadyCycle > CurrCycle || checkHazard(SU))
356 Pending.push(SU);
358 Available.push(SU);
389 void ConvergingVLIWScheduler::VLIWSchedBoundary::bumpNode(SUnit *SU) {
394 if (!isTop() && SU->isCall) {
399 HazardRec->EmitInstruction(SU);
403 startNewCycle = ResourceModel->reserveResources(SU, isTop());
406 // TODO: Check if this SU must end a dispatch group.
407 IssueCount += SchedModel->getNumMicroOps(SU->getInstr());
427 SUnit *SU = *(Pending.begin()+i);
428 unsigned ReadyCycle = isTop() ? SU->TopReadyCycle : SU->BotReadyCycle;
436 if (checkHazard(SU))
439 Available.push(SU);
446 /// Remove SU from the ready set for this boundary.
447 void ConvergingVLIWScheduler::VLIWSchedBoundary::removeReady(SUnit *SU) {
448 if (Available.isInQueue(SU))
449 Available.remove(Available.find(SU));
451 assert(Pending.isInQueue(SU) && "bad ready count");
452 Pending.remove(Pending.find(SU));
485 const ReadyQueue &Q, SUnit *SU, int Cost, PressureChange P) {
493 DAG->dumpNode(*SU);
509 dbgstr << "SU(" << std::setw(3) << (*I)->NodeNum << ")";
520 /// of SU, return true (we may have duplicates)
521 static inline bool isSingleUnscheduledPred(SUnit *SU, SUnit *SU2) {
522 if (SU->NumPredsLeft == 0)
525 for (auto &Pred : SU->Preds) {
535 /// of SU, return true (we may have duplicates)
536 static inline bool isSingleUnscheduledSucc(SUnit *SU, SUnit *SU2) {
537 if (SU->NumSuccsLeft == 0)
540 for (auto &Succ : SU->Succs) {
553 int ConvergingVLIWScheduler::pressureChange(const SUnit *SU, bool isBotUp) {
554 PressureDiff &PD = DAG->getPressureDiff(SU);
576 int ConvergingVLIWScheduler::SchedulingCost(ReadyQueue &Q, SUnit *SU,
584 if (!SU || SU->isScheduled)
590 if (SU->isScheduleHigh) {
598 if (Top.isLatencyBound(SU)) {
600 ResCount += (SU->getHeight() * ScaleTwo);
605 dbgstr << "h" << std::setw(3) << SU->getHeight() << "|";
611 if (Top.ResourceModel->isResourceAvailable(SU, true)) {
618 if (Bot.isLatencyBound(SU)) {
620 ResCount += (SU->getDepth() * ScaleTwo);
625 dbgstr << "d" << std::setw(3) << SU->getDepth() << "|";
631 if (Bot.ResourceModel->isResourceAvailable(SU, false)) {
645 if (Top.isLatencyBound(SU))
646 for (const SDep &SI : SU->Succs)
647 if (isSingleUnscheduledPred(SI.getSUnit(), SU))
651 if (Bot.isLatencyBound(SU))
652 for (const SDep &PI : SU->Preds)
653 if (isSingleUnscheduledSucc(PI.getSUnit(), SU))
676 if (IsAvailableAmt && pressureChange(SU, Q.getID() != TopQID) > 0 &&
691 if (SU->isInstr() && QII.mayBeCurLoad(*SU->getInstr())) {
693 Top.ResourceModel->isResourceAvailable(SU, true)) {
697 Bot.ResourceModel->isResourceAvailable(SU, false)) {
705 if (Q.getID() == TopQID && getWeakLeft(SU, true) == 0) {
706 for (const SDep &PI : SU->Preds) {
714 } else if (Q.getID() == BotQID && getWeakLeft(SU, false) == 0) {
715 for (const SDep &SI : SU->Succs) {
732 for (const auto &PI : SU->Preds) {
740 for (const auto &SI : SU->Succs) {
786 if (!Candidate.SU) {
788 Candidate.SU = *I;
798 if ((Q.getID() == TopQID && (*I)->NodeNum < Candidate.SU->NodeNum)
799 || (Q.getID() == BotQID && (*I)->NodeNum > Candidate.SU->NodeNum)) {
801 Candidate.SU = *I;
812 Candidate.SU = *I;
821 unsigned CandWeak = getWeakLeft(Candidate.SU, (Q.getID() == TopQID));
825 Candidate.SU = *I;
837 CandSize = Candidate.SU->Succs.size();
840 CandSize = Candidate.SU->Preds.size();
844 Candidate.SU = *I;
859 if ((Q.getID() == TopQID && (*I)->NodeNum < Candidate.SU->NodeNum)
860 || (Q.getID() == BotQID && (*I)->NodeNum > Candidate.SU->NodeNum)) {
862 Candidate.SU = *I;
882 if (SUnit *SU = Bot.pickOnlyChoice()) {
885 return SU;
887 if (SUnit *SU = Top.pickOnlyChoice()) {
890 return SU;
908 return BotCand.SU;
919 return TopCand.SU;
926 return BotCand.SU;
931 return TopCand.SU;
936 return TopCand.SU;
941 return BotCand.SU;
951 SUnit *SU;
953 SU = Top.pickOnlyChoice();
954 if (!SU) {
960 SU = TopCand.SU;
964 SU = Bot.pickOnlyChoice();
965 if (!SU) {
971 SU = BotCand.SU;
975 SU = pickNodeBidrectional(IsTopNode);
977 if (SU->isTopReady())
978 Top.removeReady(SU);
979 if (SU->isBottomReady())
980 Bot.removeReady(SU);
986 DAG->dumpNode(*SU));
987 return SU;
994 void ConvergingVLIWScheduler::schedNode(SUnit *SU, bool IsTopNode) {
996 Top.bumpNode(SU);
997 SU->TopReadyCycle = Top.CurrCycle;
999 Bot.bumpNode(SU);
1000 SU->BotReadyCycle = Bot.CurrCycle;