summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-09-06 17:32:34 +0000
committerAndrew Trick <atrick@apple.com>2013-09-06 17:32:34 +0000
commit38e61122f27a8ca4ef0578eaf6dc5242880d2918 (patch)
treecd143efdeeeab78bbea3b09a1c70310a8701f74d /include/llvm/CodeGen
parent1bcff6cffa30c2fdcf0eac80ef9551429b38f25d (diff)
downloadllvm-38e61122f27a8ca4ef0578eaf6dc5242880d2918.tar.gz
llvm-38e61122f27a8ca4ef0578eaf6dc5242880d2918.tar.bz2
llvm-38e61122f27a8ca4ef0578eaf6dc5242880d2918.tar.xz
Added MachineSchedPolicy.
Allow subtargets to customize the generic scheduling strategy. This is convenient for targets that don't need to add new heuristics by specializing the strategy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/MachineScheduler.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/MachineScheduler.h b/include/llvm/CodeGen/MachineScheduler.h
index e3768bc72b..18744e7132 100644
--- a/include/llvm/CodeGen/MachineScheduler.h
+++ b/include/llvm/CodeGen/MachineScheduler.h
@@ -101,15 +101,39 @@ public:
class ScheduleDAGMI;
+/// Define a generic scheduling policy for targets that don't provide their own
+/// MachineSchedStrategy. This can be overriden for each scheduling region
+/// before building the DAG.
+struct MachineSchedPolicy {
+ // Allow the scheduler to disable register pressure tracking.
+ bool ShouldTrackPressure;
+
+ // Allow the scheduler to force top-down or bottom-up scheduling. If neither
+ // is true, the scheduler runs in both directions and converges.
+ bool OnlyTopDown;
+ bool OnlyBottomUp;
+
+ MachineSchedPolicy():
+ ShouldTrackPressure(false), OnlyTopDown(false), OnlyBottomUp(false) {}
+};
+
/// MachineSchedStrategy - Interface to the scheduling algorithm used by
/// ScheduleDAGMI.
+///
+/// Initialization sequence:
+/// initPolicy -> shouldTrackPressure -> initialize(DAG) -> registerRoots
class MachineSchedStrategy {
public:
virtual ~MachineSchedStrategy() {}
+ /// Optionally override the per-region scheduling policy.
+ virtual void initPolicy(MachineBasicBlock::iterator Begin,
+ MachineBasicBlock::iterator End,
+ unsigned NumRegionInstrs) {}
+
/// Check if pressure tracking is needed before building the DAG and
- /// initializing this strategy.
- virtual bool shouldTrackPressure(unsigned NumRegionInstrs) { return true; }
+ /// initializing this strategy. Called after initPolicy.
+ virtual bool shouldTrackPressure() const { return true; }
/// Initialize the strategy after building the DAG for a new region.
virtual void initialize(ScheduleDAGMI *DAG) = 0;