summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2012-03-19 18:38:38 +0000
committerLang Hames <lhames@gmail.com>2012-03-19 18:38:38 +0000
commitdd98c497b9b605f99d43c8c9abd551801b2f73dc (patch)
tree10af718fb7e4ed63809b38a717c3348f1c2c260e /llvm/lib
parent7fd63a29f70420db2b8f69958e04b8292d4f7bb6 (diff)
downloadbcm5719-llvm-dd98c497b9b605f99d43c8c9abd551801b2f73dc.tar.gz
bcm5719-llvm-dd98c497b9b605f99d43c8c9abd551801b2f73dc.zip
Add an option to the MI scheduler to cut off scheduling after a fixed number of
instructions have been scheduled. Handy for tracking down scheduler bugs, or bugs exposed by scheduling. llvm-svn: 153045
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 10a318c46dc..f1a2532200b 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -39,6 +39,9 @@ static cl::opt<bool> ForceBottomUp("misched-bottomup", cl::Hidden,
#ifndef NDEBUG
static cl::opt<bool> ViewMISchedDAGs("view-misched-dags", cl::Hidden,
cl::desc("Pop up a window to show MISched dags after they are processed"));
+
+static cl::opt<unsigned> MISchedCutoff("misched-cutoff", cl::Hidden,
+ cl::desc("Stop scheduling after N instructions"), cl::init(~0U));
#else
static bool ViewMISchedDAGs = false;
#endif // NDEBUG
@@ -281,10 +284,15 @@ class ScheduleDAGMI : public ScheduleDAGInstrs {
/// The bottom of the unscheduled zone.
MachineBasicBlock::iterator CurrentBottom;
+
+ /// The number of instructions scheduled so far. Used to cut off the
+ /// scheduler at the point determined by misched-cutoff.
+ unsigned NumInstrsScheduled;
public:
ScheduleDAGMI(MachineSchedContext *C, MachineSchedStrategy *S):
ScheduleDAGInstrs(*C->MF, *C->MLI, *C->MDT, /*IsPostRA=*/false, C->LIS),
- AA(C->AA), SchedImpl(S), CurrentTop(), CurrentBottom() {}
+ AA(C->AA), SchedImpl(S), CurrentTop(), CurrentBottom(),
+ NumInstrsScheduled(0) {}
~ScheduleDAGMI() {
delete SchedImpl;
@@ -398,6 +406,16 @@ void ScheduleDAGMI::schedule() {
CurrentBottom = RegionEnd;
bool IsTopNode = false;
while (SUnit *SU = SchedImpl->pickNode(IsTopNode)) {
+
+#ifndef NDEBUG
+ // Enable break
+ if (NumInstrsScheduled == MISchedCutoff && MISchedCutoff != ~0U) {
+ CurrentTop = CurrentBottom;
+ break;
+ }
+ ++NumInstrsScheduled;
+#endif
+
DEBUG(dbgs() << "*** " << (IsTopNode ? "Top" : "Bottom")
<< " Scheduling Instruction:\n"; SU->dump(this));
OpenPOWER on IntegriCloud