summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index d9850d32f0a..9600cb69430 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -1594,6 +1594,12 @@ private:
SchedBoundary Top;
SchedBoundary Bot;
+ // Allow the driver to force top-down or bottom-up scheduling. If neither is
+ // true, the scheduler runs in both directions and converges. For generic
+ // targets, we default to bottom-up, because it's simpler and more
+ // compile-time optimizations have been implemented in that direction.
+ bool OnlyBottomUp;
+ bool OnlyTopDown;
public:
/// SUnit::NodeQueueId: 0 (none), 1 (top), 2 (bot), 3 (both)
enum {
@@ -1604,7 +1610,8 @@ public:
ConvergingScheduler(const MachineSchedContext *C):
Context(C), DAG(0), SchedModel(0), TRI(0),
- Top(TopQID, "TopQ"), Bot(BotQID, "BotQ") {}
+ Top(TopQID, "TopQ"), Bot(BotQID, "BotQ"),
+ OnlyBottomUp(true), OnlyTopDown(false) {}
virtual bool shouldTrackPressure(unsigned NumRegionInstrs);
@@ -1709,6 +1716,19 @@ void ConvergingScheduler::initialize(ScheduleDAGMI *dag) {
}
assert((!ForceTopDown || !ForceBottomUp) &&
"-misched-topdown incompatible with -misched-bottomup");
+
+ // Check -misched-topdown/bottomup can force or unforce scheduling direction.
+ // e.g. -misched-bottomup=false allows scheduling in both directions.
+ if (ForceBottomUp.getNumOccurrences() > 0) {
+ OnlyBottomUp = ForceBottomUp;
+ if (OnlyBottomUp)
+ OnlyTopDown = false;
+ }
+ if (ForceTopDown.getNumOccurrences() > 0) {
+ OnlyTopDown = ForceTopDown;
+ if (OnlyTopDown)
+ OnlyBottomUp = false;
+ }
}
void ConvergingScheduler::releaseTopNode(SUnit *SU) {
@@ -2674,7 +2694,7 @@ SUnit *ConvergingScheduler::pickNode(bool &IsTopNode) {
}
SUnit *SU;
do {
- if (ForceTopDown) {
+ if (OnlyTopDown) {
SU = Top.pickOnlyChoice();
if (!SU) {
CandPolicy NoPolicy;
@@ -2686,7 +2706,7 @@ SUnit *ConvergingScheduler::pickNode(bool &IsTopNode) {
}
IsTopNode = true;
}
- else if (ForceBottomUp) {
+ else if (OnlyBottomUp) {
SU = Bot.pickOnlyChoice();
if (!SU) {
CandPolicy NoPolicy;
OpenPOWER on IntegriCloud