mi-sched: Force bottom up scheduling for generic targets.

Fast register pressure tracking currently only takes effect during
bottom up scheduling. Forcing this is a bit faster and simpler for
targets that don't have many scheduling constraints and don't need
top-down scheduling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190014 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick
2013-09-04 23:54:00 +00:00
parent a38c27be0f
commit d4486ebd5f
3 changed files with 34 additions and 19 deletions
+23 -3
View File
@@ -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;