diff options
author | ZhaoQi <zhaoqi01@loongson.cn> | 2025-09-26 10:45:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-26 10:45:29 +0800 |
commit | 4321d4fe8039a745796726dfe145e5e699b928b3 (patch) | |
tree | 589d406b275c99425ea9c7ee22776e9920d7de4f /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | d516d07c268f260e245690f89ab0f3e727389cb5 (diff) | |
parent | ef876268b97d664a90dc0d9a044f518557270e3d (diff) | |
download | llvm-users/zhaoqi5/override-isxxxcheap-hooks.zip llvm-users/zhaoqi5/override-isxxxcheap-hooks.tar.gz llvm-users/zhaoqi5/override-isxxxcheap-hooks.tar.bz2 |
Merge branch 'users/zhaoqi5/test-isxxxcheap' into users/zhaoqi5/override-isxxxcheap-hooksusers/zhaoqi5/override-isxxxcheap-hooks
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineScheduler.cpp | 120 |
1 files changed, 59 insertions, 61 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp index c6fa8f4..299bcc4 100644 --- a/llvm/lib/CodeGen/MachineScheduler.cpp +++ b/llvm/lib/CodeGen/MachineScheduler.cpp @@ -4157,33 +4157,32 @@ SUnit *GenericScheduler::pickNode(bool &IsTopNode) { return nullptr; } SUnit *SU; - do { - if (RegionPolicy.OnlyTopDown) { - SU = Top.pickOnlyChoice(); - if (!SU) { - CandPolicy NoPolicy; - TopCand.reset(NoPolicy); - pickNodeFromQueue(Top, NoPolicy, DAG->getTopRPTracker(), TopCand); - assert(TopCand.Reason != NoCand && "failed to find a candidate"); - tracePick(TopCand); - SU = TopCand.SU; - } - IsTopNode = true; - } else if (RegionPolicy.OnlyBottomUp) { - SU = Bot.pickOnlyChoice(); - if (!SU) { - CandPolicy NoPolicy; - BotCand.reset(NoPolicy); - pickNodeFromQueue(Bot, NoPolicy, DAG->getBotRPTracker(), BotCand); - assert(BotCand.Reason != NoCand && "failed to find a candidate"); - tracePick(BotCand); - SU = BotCand.SU; - } - IsTopNode = false; - } else { - SU = pickNodeBidirectional(IsTopNode); + if (RegionPolicy.OnlyTopDown) { + SU = Top.pickOnlyChoice(); + if (!SU) { + CandPolicy NoPolicy; + TopCand.reset(NoPolicy); + pickNodeFromQueue(Top, NoPolicy, DAG->getTopRPTracker(), TopCand); + assert(TopCand.Reason != NoCand && "failed to find a candidate"); + tracePick(TopCand); + SU = TopCand.SU; } - } while (SU->isScheduled); + IsTopNode = true; + } else if (RegionPolicy.OnlyBottomUp) { + SU = Bot.pickOnlyChoice(); + if (!SU) { + CandPolicy NoPolicy; + BotCand.reset(NoPolicy); + pickNodeFromQueue(Bot, NoPolicy, DAG->getBotRPTracker(), BotCand); + assert(BotCand.Reason != NoCand && "failed to find a candidate"); + tracePick(BotCand); + SU = BotCand.SU; + } + IsTopNode = false; + } else { + SU = pickNodeBidirectional(IsTopNode); + } + assert(!SU->isScheduled && "SUnit scheduled twice."); // If IsTopNode, then SU is in Top.Available and must be removed. Otherwise, // if isTopReady(), then SU is in either Top.Available or Top.Pending. @@ -4524,43 +4523,42 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) { return nullptr; } SUnit *SU; - do { - if (RegionPolicy.OnlyBottomUp) { - SU = Bot.pickOnlyChoice(); - if (SU) { - tracePick(Only1, /*IsTopNode=*/true, /*IsPostRA=*/true); - } else { - CandPolicy NoPolicy; - BotCand.reset(NoPolicy); - // Set the bottom-up policy based on the state of the current bottom - // zone and the instructions outside the zone, including the top zone. - setPolicy(BotCand.Policy, /*IsPostRA=*/true, Bot, nullptr); - pickNodeFromQueue(Bot, BotCand); - assert(BotCand.Reason != NoCand && "failed to find a candidate"); - tracePick(BotCand, /*IsPostRA=*/true); - SU = BotCand.SU; - } - IsTopNode = false; - } else if (RegionPolicy.OnlyTopDown) { - SU = Top.pickOnlyChoice(); - if (SU) { - tracePick(Only1, /*IsTopNode=*/true, /*IsPostRA=*/true); - } else { - CandPolicy NoPolicy; - TopCand.reset(NoPolicy); - // Set the top-down policy based on the state of the current top zone - // and the instructions outside the zone, including the bottom zone. - setPolicy(TopCand.Policy, /*IsPostRA=*/true, Top, nullptr); - pickNodeFromQueue(Top, TopCand); - assert(TopCand.Reason != NoCand && "failed to find a candidate"); - tracePick(TopCand, /*IsPostRA=*/true); - SU = TopCand.SU; - } - IsTopNode = true; + if (RegionPolicy.OnlyBottomUp) { + SU = Bot.pickOnlyChoice(); + if (SU) { + tracePick(Only1, /*IsTopNode=*/true, /*IsPostRA=*/true); } else { - SU = pickNodeBidirectional(IsTopNode); + CandPolicy NoPolicy; + BotCand.reset(NoPolicy); + // Set the bottom-up policy based on the state of the current bottom + // zone and the instructions outside the zone, including the top zone. + setPolicy(BotCand.Policy, /*IsPostRA=*/true, Bot, nullptr); + pickNodeFromQueue(Bot, BotCand); + assert(BotCand.Reason != NoCand && "failed to find a candidate"); + tracePick(BotCand, /*IsPostRA=*/true); + SU = BotCand.SU; } - } while (SU->isScheduled); + IsTopNode = false; + } else if (RegionPolicy.OnlyTopDown) { + SU = Top.pickOnlyChoice(); + if (SU) { + tracePick(Only1, /*IsTopNode=*/true, /*IsPostRA=*/true); + } else { + CandPolicy NoPolicy; + TopCand.reset(NoPolicy); + // Set the top-down policy based on the state of the current top zone + // and the instructions outside the zone, including the bottom zone. + setPolicy(TopCand.Policy, /*IsPostRA=*/true, Top, nullptr); + pickNodeFromQueue(Top, TopCand); + assert(TopCand.Reason != NoCand && "failed to find a candidate"); + tracePick(TopCand, /*IsPostRA=*/true); + SU = TopCand.SU; + } + IsTopNode = true; + } else { + SU = pickNodeBidirectional(IsTopNode); + } + assert(!SU->isScheduled && "SUnit scheduled twice."); if (SU->isTopReady()) Top.removeReady(SU); |