[llvm] b2c2fe7 - [NFC] Move InPQueue into arguments of releaseNode
Qiu Chaofan via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 8 06:15:53 PST 2020
Author: Qiu Chaofan
Date: 2020-01-08T22:15:32+08:00
New Revision: b2c2fe72197267af90b4b6a187ab6163f806ce00
URL: https://github.com/llvm/llvm-project/commit/b2c2fe72197267af90b4b6a187ab6163f806ce00
DIFF: https://github.com/llvm/llvm-project/commit/b2c2fe72197267af90b4b6a187ab6163f806ce00.diff
LOG: [NFC] Move InPQueue into arguments of releaseNode
This patch moves `InPQueue` into function arguments instead of template
arguments of `releaseNode`, which is a cleaner approach.
Differential Revision: https://reviews.llvm.org/D72125
Added:
Modified:
llvm/include/llvm/CodeGen/MachineScheduler.h
llvm/lib/CodeGen/MachineScheduler.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/MachineScheduler.h b/llvm/include/llvm/CodeGen/MachineScheduler.h
index 173b3024cfef..6cebaa47fe6a 100644
--- a/llvm/include/llvm/CodeGen/MachineScheduler.h
+++ b/llvm/include/llvm/CodeGen/MachineScheduler.h
@@ -757,8 +757,16 @@ class SchedBoundary {
unsigned getOtherResourceCount(unsigned &OtherCritIdx);
- template <bool InPQueue>
- void releaseNode(SUnit *SU, unsigned ReadyCycle, unsigned Idx = 0);
+ /// Release SU to make it ready. If it's not in hazard, remove it from
+ /// pending queue (if already in) and push into available queue.
+ /// Otherwise, push the SU into pending queue.
+ ///
+ /// @param SU The unit to be released.
+ /// @param ReadyCycle Until which cycle the unit is ready.
+ /// @param InPQueue Whether SU is already in pending queue.
+ /// @param Idx Position offset in pending queue (if in it).
+ void releaseNode(SUnit *SU, unsigned ReadyCycle, bool InPQueue,
+ unsigned Idx = 0);
void bumpCycle(unsigned NextCycle);
@@ -956,7 +964,7 @@ class GenericScheduler : public GenericSchedulerBase {
if (SU->isScheduled)
return;
- Top.releaseNode<false>(SU, SU->TopReadyCycle);
+ Top.releaseNode(SU, SU->TopReadyCycle, false);
TopCand.SU = nullptr;
}
@@ -964,7 +972,7 @@ class GenericScheduler : public GenericSchedulerBase {
if (SU->isScheduled)
return;
- Bot.releaseNode<false>(SU, SU->BotReadyCycle);
+ Bot.releaseNode(SU, SU->BotReadyCycle, false);
BotCand.SU = nullptr;
}
@@ -1044,7 +1052,7 @@ class PostGenericScheduler : public GenericSchedulerBase {
void releaseTopNode(SUnit *SU) override {
if (SU->isScheduled)
return;
- Top.releaseNode<false>(SU, SU->TopReadyCycle);
+ Top.releaseNode(SU, SU->TopReadyCycle, false);
}
// Only called for roots.
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index bee7848ba4c9..52855ceb4280 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -2088,13 +2088,8 @@ getOtherResourceCount(unsigned &OtherCritIdx) {
return OtherCritCount;
}
-template void SchedBoundary::releaseNode<true>(SUnit *SU, unsigned ReadyCycle,
- unsigned Idx);
-template void SchedBoundary::releaseNode<false>(SUnit *SU, unsigned ReadyCycle,
- unsigned Idx);
-
-template <bool InPQueue>
-void SchedBoundary::releaseNode(SUnit *SU, unsigned ReadyCycle, unsigned Idx) {
+void SchedBoundary::releaseNode(SUnit *SU, unsigned ReadyCycle, bool InPQueue,
+ unsigned Idx) {
assert(SU->getInstr() && "Scheduled SUnit must have instr");
#ifndef NDEBUG
@@ -2373,7 +2368,7 @@ void SchedBoundary::releasePending() {
if (Available.size() >= ReadyListLimit)
break;
- releaseNode<true>(SU, ReadyCycle, I);
+ releaseNode(SU, ReadyCycle, true, I);
if (E != Pending.size()) {
--I;
--E;
More information about the llvm-commits
mailing list