Home | History | Annotate | Download | only in CodeGen

Lines Matching defs:SU

520 void ScheduleDAGMI::releaseSucc(SUnit *SU, SDep *SuccEdge) {
537 // SU->TopReadyCycle was set to CurrCycle when it was scheduled. However,
539 if (SuccSU->TopReadyCycle < SU->TopReadyCycle + SuccEdge->getLatency())
540 SuccSU->TopReadyCycle = SU->TopReadyCycle + SuccEdge->getLatency();
547 /// releaseSuccessors - Call releaseSucc on each of SU's successors.
548 void ScheduleDAGMI::releaseSuccessors(SUnit *SU) {
549 for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
551 releaseSucc(SU, &*I);
559 void ScheduleDAGMI::releasePred(SUnit *SU, SDep *PredEdge) {
576 // SU->BotReadyCycle was set to CurrCycle when it was scheduled. However,
578 if (PredSU->BotReadyCycle < SU->BotReadyCycle + PredEdge->getLatency())
579 PredSU->BotReadyCycle = SU->BotReadyCycle + PredEdge->getLatency();
586 /// releasePredecessors - Call releasePred on each of SU's predecessors.
587 void ScheduleDAGMI::releasePredecessors(SUnit *SU) {
588 for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
590 releasePred(SU, &*I);
658 DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
659 SUnits[su].dumpAll(this));
666 while (SUnit *SU = SchedImpl->pickNode(IsTopNode)) {
667 assert(!SU->isScheduled && "Node already scheduled");
671 MachineInstr *MI = SU->getInstr();
673 assert(SU->isTopReady() && "node still has unscheduled dependencies");
680 assert(SU->isBottomReady() && "node still has unscheduled dependencies");
696 SchedImpl->schedNode(SU, IsTopNode);
698 updateQueues(SU, IsTopNode);
724 SUnit *SU = &(*I);
725 assert(!SU->isBoundaryNode() && "Boundary node should not be in SUnits");
728 SU->biasCriticalPath();
732 TopRoots.push_back(SU);
735 BotRoots.push_back(SU);
772 void ScheduleDAGMI::updateQueues(SUnit *SU, bool IsTopNode) {
775 releaseSuccessors(SU);
777 releasePredecessors(SU);
779 SU->isScheduled = true;
808 if (SUnit *SU = getSUnit(&(*MI)))
809 SU->dump(this);
908 SU,
910 const PressureDiff &PDiff = getPressureDiff(SU);
961 SUnit *SU = UI->SU;
962 DEBUG(dbgs() << " UpdateRegP: SU(" << SU->NodeNum << ") "
963 << *SU->getInstr());
966 if (!SU->isScheduled && SU != &ExitSU) {
968 = LI.Query(LIS->getInstructionIndex(SU->getInstr()));
970 getPressureDiff(SU).addPressureChange(Reg, true, &MRI);
1000 DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
1001 SUnits[su].dumpAll(this));
1013 while (SUnit *SU = SchedImpl->pickNode(IsTopNode)) {
1014 assert(!SU->isScheduled && "Node already scheduled");
1018 scheduleMI(SU, IsTopNode);
1020 updateQueues(SU, IsTopNode);
1023 unsigned SubtreeID = DFSResult->getSubtreeID(SU);
1032 SchedImpl->schedNode(SU, IsTopNode);
1134 if (UI->SU == &ExitSU)
1139 LI.Query(LIS->getInstructionIndex(UI->SU->getInstr()));
1147 if (LiveOutDepth > UI->SU->getDepth())
1148 CyclicLatency = LiveOutDepth - UI->SU->getDepth();
1150 unsigned LiveInHeight = UI->SU->getHeight() + DefSU->Latency;
1158 DEBUG(dbgs() << "Cyclic Path: SU(" << DefSU->NodeNum << ") -> SU("
1159 << UI->SU->NodeNum << ") = " << CyclicLatency << "c\n");
1169 void ScheduleDAGMILive::scheduleMI(SUnit *SU, bool IsTopNode) {
1171 MachineInstr *MI = SU->getInstr();
1174 assert(SU->isTopReady() && "node still has unscheduled dependencies");
1186 updateScheduledPressure(SU, TopRPTracker.getPressure().MaxSetPressure);
1190 assert(SU->isBottomReady() && "node still has unscheduled dependencies");
1208 updateScheduledPressure(SU, BotRPTracker.getPressure().MaxSetPressure);
1223 SUnit *SU;
1226 LoadInfo(SUnit *su, unsigned reg, unsigned ofs)
1227 : SU(su), BaseReg(reg), Offset(ofs) {}
1251 SUnit *SU = Loads[Idx];
1254 if (TII->getLdStBaseRegImmOfs(SU->getInstr(), BaseReg, Offset, TRI))
1255 LoadRecords.push_back(LoadInfo(SU, BaseReg, Offset));
1267 SUnit *SUa = LoadRecords[Idx].SU;
1268 SUnit *SUb = LoadRecords[Idx+1].SU;
1272 DEBUG(dbgs() << "Cluster loads SU(" << SUa->NodeNum << ") - SU("
1282 DEBUG(dbgs() << " Copy Succ SU(" << SI->getSUnit()->NodeNum << ")\n");
1299 SUnit *SU = &DAG->SUnits[Idx];
1300 if (!SU->getInstr()->mayLoad())
1304 PI = SU->Preds.begin(), PE = SU->Preds.end(); PI != PE; ++PI) {
1317 StoreChainDependents[Result.first->second].push_back(SU);
1349 SUnit *SU = &DAG->SUnits[--Idx];
1350 if (!TII->shouldScheduleAdjacent(SU->getInstr(), Branch))
1353 // Create a single weak edge from SU to ExitSU. The only effect is to cause
1354 // bottom-up scheduling to heavily prioritize the clustered SU. There is no
1355 // need to copy predecessor edges from ExitSU to SU, since top-down
1357 // of SU, we could create an artificial edge from the deepest root, but it
1359 bool Success = DAG->addEdge(&DAG->ExitSU, SDep(SU, SDep::Cluster));
1363 DEBUG(dbgs() << "Macro Fuse SU(" << SU->NodeNum << ")\n");
1517 DEBUG(dbgs() << "Constraining copy SU(" << CopySU->NodeNum << ")\n");
1521 DEBUG(dbgs() << " Local use SU(" << (*I)->NodeNum << ") -> SU("
1527 DEBUG(dbgs() << " Global use SU(" << (*I)->NodeNum << ") -> SU("
1546 SUnit *SU = &DAG->SUnits[Idx];
1547 if (!SU->getInstr()->isCopy())
1550 constrainLocalCopy(SU, static_cast<ScheduleDAGMILive*>(DAG));
1636 unsigned SchedBoundary::getLatencyStallCycles(SUnit *SU) {
1637 if (!SU->isUnbuffered)
1640 unsigned ReadyCycle = (isTop() ? SU->TopReadyCycle : SU->BotReadyCycle);
1660 /// Does this SU have a hazard within the current instruction group.
1672 /// TODO: Also check whether the SU must start a new group.
1673 bool SchedBoundary::checkHazard(SUnit *SU) {
1675 && HazardRec->getHazardType(SU) != ScheduleHazardRecognizer::NoHazard) {
1678 unsigned uops = SchedModel->getNumMicroOps(SU->getInstr());
1680 DEBUG(dbgs() << " SU(" << SU->NodeNum << ") uops="
1681 << SchedModel->getNumMicroOps(SU->getInstr()) << '\n');
1684 if (SchedModel->hasInstrSchedModel() && SU->hasReservedResource) {
1685 const MCSchedClassDesc *SC = DAG->getSchedClass(SU);
1694 DEBUG(dbgs() << " SU(" << SU->NodeNum << ") "
1718 DEBUG(dbgs() << Available.getName() << " RemLatency SU("
1753 void SchedBoundary::releaseNode(SUnit *SU, unsigned ReadyCycle) {
1754 assert(SU->getInstr() && "Scheduled SUnit must have instr");
1770 if ((!IsBuffered && ReadyCycle > CurrCycle) || checkHazard(SU))
1771 Pending.push(SU);
1773 Available.push(SU);
1776 NextSUs.insert(SU);
1779 void SchedBoundary::releaseTopNode(SUnit *SU) {
1780 if (SU->isScheduled)
1783 releaseNode(SU, SU->TopReadyCycle);
1786 void SchedBoundary::releaseBottomNode(SUnit *SU) {
1787 if (SU->isScheduled)
1790 releaseNode(SU, SU->BotReadyCycle);
1876 void SchedBoundary::bumpNode(SUnit *SU) {
1879 if (!isTop() && SU->isCall) {
1884 HazardRec->EmitInstruction(SU);
1888 const MCSchedClassDesc *SC = DAG->getSchedClass(SU);
1889 unsigned IncMOps = SchedModel->getNumMicroOps(SU->getInstr());
1894 unsigned ReadyCycle = (isTop() ? SU->TopReadyCycle : SU->BotReadyCycle);
1913 if (SU->isUnbuffered && ReadyCycle > NextCycle)
1946 if (SU->hasReservedResource) {
1969 if (SU->getDepth() > TopLatency) {
1970 TopLatency = SU->getDepth();
1972 << " TopLatency SU(" << SU->NodeNum << ") " << TopLatency << "c\n");
1974 if (SU->getHeight() > BotLatency) {
1975 BotLatency = SU->getHeight();
1977 << " BotLatency SU(" << SU->NodeNum << ") " << BotLatency << "c\n");
2015 SUnit *SU = *(Pending.begin()+i);
2016 unsigned ReadyCycle = isTop() ? SU->TopReadyCycle : SU->BotReadyCycle;
2024 if (checkHazard(SU))
2027 Available.push(SU);
2035 /// Remove SU from the ready set for this boundary.
2036 void SchedBoundary::removeReady(SUnit *SU) {
2037 if (Available.isInQueue(SU))
2038 Available.remove(Available.find(SU));
2040 assert(Pending.isInQueue(SU) && "bad ready count");
2041 Pending.remove(Pending.find(SU));
2113 const MCSchedClassDesc *SC = DAG->getSchedClass(SU);
2245 Latency = Cand.SU->getDepth();
2248 Latency = Cand.SU->getHeight();
2251 Latency = Cand.SU->getHeight();
2254 Latency = Cand.SU->getDepth();
2257 dbgs() << " SU(" << Cand.SU->NodeNum << ") " << getReasonStr(Cand.Reason);
2314 if (Cand.SU->getDepth() > Zone.getScheduledLatency()) {
2315 if (tryLess(TryCand.SU->getDepth(), Cand.SU->getDepth(),
2319 if (tryGreater(TryCand.SU->getHeight(), Cand.SU->getHeight(),
2324 if (Cand.SU->getHeight() > Zone.getScheduledLatency()) {
2325 if (tryLess(TryCand.SU->getHeight(), Cand.SU->getHeight(),
2329 if (tryGreater(TryCand.SU->getDepth(), Cand.SU->getDepth(),
2495 static unsigned getWeakLeft(const SUnit *SU, bool isTop) {
2496 return (isTop) ? SU->WeakPredsLeft : SU->WeakSuccsLeft;
2506 static int biasPhysRegCopy(const SUnit *SU, bool isTop) {
2507 const MachineInstr *MI = SU->getInstr();
2520 bool AtBoundary = isTop ? !SU->NumSuccsLeft : !SU->NumPredsLeft;
2548 TryCand.SU->getInstr(),
2556 TryCand.SU->getInstr(),
2557 &DAG->getPressureDiff(TryCand.SU),
2564 TryCand.SU->getInstr(),
2565 DAG->getPressureDiff(TryCand.SU),
2573 dbgs() << " SU(" << TryCand.SU->NodeNum << ") "
2583 if (tryGreater(biasPhysRegCopy(TryCand.SU, Zone.isTop()),
2584 biasPhysRegCopy(Cand.SU, Zone.isTop()),
2609 if (tryLess(Zone.getLatencyStallCycles(TryCand.SU),
2610 Zone.getLatencyStallCycles(Cand.SU), TryCand, Cand, Stall))
2621 if (tryGreater(TryCand.SU == NextClusterSU, Cand.SU == NextClusterSU,
2626 if (tryLess(getWeakLeft(TryCand.SU, Zone.isTop()),
2627 getWeakLeft(Cand.SU, Zone.isTop()),
2657 if (tryGreater(Zone.isNextSU(TryCand.SU), Zone.isNextSU(Cand.SU),
2662 if ((Zone.isTop() && TryCand.SU->NodeNum < Cand.SU->NodeNum)
2663 || (!Zone.isTop() && TryCand.SU->NodeNum > Cand.SU->NodeNum)) {
2686 TryCand.SU = *I;
2702 if (SUnit *SU = Bot.pickOnlyChoice()) {
2705 return SU;
2707 if (SUnit *SU = Top.pickOnlyChoice()) {
2710 return SU;
2739 return BotCand.SU;
2749 return TopCand.SU;
2754 return BotCand.SU;
2764 SUnit *SU;
2767 SU = Top.pickOnlyChoice();
2768 if (!SU) {
2774 SU = TopCand.SU;
2779 SU = Bot.pickOnlyChoice();
2780 if (!SU) {
2786 SU = BotCand.SU;
2791 SU = pickNodeBidirectional(IsTopNode);
2793 } while (SU->isScheduled);
2795 if (SU->isTopReady())
2796 Top.removeReady(SU);
2797 if (SU->isBottomReady())
2798 Bot.removeReady(SU);
2800 DEBUG(dbgs() << "Scheduling SU(" << SU->NodeNum << ") " << *SU->getInstr());
2801 return SU;
2804 void GenericScheduler::reschedulePhysRegCopies(SUnit *SU, bool isTop) {
2806 MachineBasicBlock::iterator InsertPos = SU->getInstr();
2809 SmallVectorImpl<SDep> &Deps = isTop ? SU->Preds : SU->Succs;
2836 void GenericScheduler::schedNode(SUnit *SU, bool IsTopNode) {
2838 SU->TopReadyCycle = std::max(SU->TopReadyCycle, Top.getCurrCycle());
2839 Top.bumpNode(SU);
2840 if (SU->hasPhysRegUses)
2841 reschedulePhysRegCopies(SU, true);
2844 SU->BotReadyCycle = std::max(SU->BotReadyCycle, Bot.getCurrCycle());
2845 Bot.bumpNode(SU);
2846 if (SU->hasPhysRegDefs)
2847 reschedulePhysRegCopies(SU, false);
2922 if (tryLess(Top.getLatencyStallCycles(TryCand.SU),
2923 Top.getLatencyStallCycles(Cand.SU), TryCand, Cand, Stall))
2941 if (TryCand.SU->NodeNum < Cand.SU->NodeNum)
2952 TryCand.SU = *I;
2968 SUnit *SU;
2970 SU = Top.pickOnlyChoice();
2971 if (!SU) {
2980 SU = TopCand.SU;
2982 } while (SU->isScheduled);
2985 Top.removeReady(SU);
2987 DEBUG(dbgs() << "Scheduling SU(" << SU->NodeNum << ") " << *SU->getInstr());
2988 return SU;
2993 void PostGenericScheduler::schedNode(SUnit *SU, bool IsTopNode) {
2994 SU->TopReadyCycle = std::max(SU->TopReadyCycle, Top.getCurrCycle());
2995 Top.bumpNode(SU);
3072 SUnit *SU = ReadyQ.back();
3075 DEBUG(dbgs() << "Pick node " << "SU(" << SU->NodeNum << ") "
3076 << " ILP: " << DAG->getDFSResult()->getILP(SU)
3077 << " Tree: " << DAG->getDFSResult()->getSubtreeID(SU) << " @"
3079 DAG->getDFSResult()->getSubtreeID(SU)) << '\n'
3080 SU->getInstr());
3081 return SU;
3091 void schedNode(SUnit *SU, bool IsTopNode) override {
3097 void releaseBottomNode(SUnit *SU) override {
3098 ReadyQ.push_back(SU);
3159 SUnit *SU;
3163 SU = TopQ.top();
3165 } while (SU->isScheduled);
3171 SU = BottomQ.top();
3173 } while (SU->isScheduled);
3178 return SU;
3181 void schedNode(SUnit *SU, bool IsTopNode) override {}
3183 void releaseTopNode(SUnit *SU) override {
3184 TopQ.push(SU);
3186 void releaseBottomNode(SUnit *SU) override {
3187 BottomQ.push(SU);
3248 static std::string getNodeLabel(const SUnit *SU, const ScheduleDAG *G) {
3254 SS << "SU:" << SU->NodeNum;
3256 SS << " I:" << DFS->getNumInstrs(SU);
3259 static std::string getNodeDescription(const SUnit *SU, const ScheduleDAG *G) {
3260 return G->getGraphNodeLabel(SU);