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