9494#include < cassert>
9595#include < llvm/Support/raw_ostream.h>
9696#include < memory>
97+ #include < set>
9798#include < string>
9899#include < vector>
99100
@@ -241,12 +242,6 @@ class MachineSchedStrategy {
241242 // / Tell the strategy that MBB is about to be processed.
242243 virtual void enterMBB (MachineBasicBlock *MBB) {};
243244
244- virtual bool disableForRegionPreRA (MachineBasicBlock::iterator begin,
245- MachineBasicBlock::iterator end,
246- unsigned regioninstrs) const {
247- return false ;
248- }
249-
250245 // / Tell the strategy that current MBB is done.
251246 virtual void leaveMBB () {};
252247
@@ -496,9 +491,7 @@ class ScheduleDAGMILive : public ScheduleDAGMI {
496491 bool disableForRegion (MachineBasicBlock *bb,
497492 MachineBasicBlock::iterator begin,
498493 MachineBasicBlock::iterator end,
499- unsigned regioninstrs) const override {
500- return SchedImpl->disableForRegionPreRA (begin, end, regioninstrs);
501- }
494+ unsigned regioninstrs) const override ;
502495
503496 // / Implement ScheduleDAGInstrs interface for scheduling a sequence of
504497 // / reorderable instructions.
@@ -1084,7 +1077,7 @@ class GenericSchedulerBase : public MachineSchedStrategy {
10841077 enum CandReason : uint8_t {
10851078 NoCand, Only1, PhysReg, RegExcess, RegCritical, Stall, Cluster, Weak,
10861079 RegMax, ResourceReduce, ResourceDemand, BotHeightReduce, BotPathReduce,
1087- TopDepthReduce, TopPathReduce, NextDefUse, NodeOrder};
1080+ TopDepthReduce, TopPathReduce, NextDefUse, RegPressure, NodeOrder};
10881081
10891082#ifndef NDEBUG
10901083 static const char *getReasonStr (GenericSchedulerBase::CandReason Reason);
@@ -1221,6 +1214,33 @@ int biasPhysReg(const SUnit *SU, bool isTop);
12211214// / GenericScheduler shrinks the unscheduled zone using heuristics to balance
12221215// / the schedule.
12231216class GenericScheduler : public GenericSchedulerBase {
1217+ // // Experimental members for OOO scheduling. ////
1218+
1219+ // TODO: Integrate with SchedDFSResult class.
1220+ // SU -> Nodes above in subtree.
1221+ std::vector<std::set<const SUnit *> > TreeSUs;
1222+ // SU -> Virtual regs defined above in subtree.
1223+ std::vector<std::set<Register> > TreeDefs;
1224+ // SU -> Regs used but not defined above in subtree.
1225+ std::vector<std::set<Register> > TreeUses;
1226+
1227+ // If this SU is non-null, it is the start of a subtree to be scheduled as
1228+ // a unit.
1229+ mutable SUnit *NextSubtreeSU = nullptr ;
1230+ // A (small) set of instructions to be scheduled next as a unit.
1231+ std::set<const SUnit *> NextQueue;
1232+
1233+ unsigned DAGHeight;
1234+ unsigned DAGDepth;
1235+ unsigned NumScheduled;
1236+ std::set<Register> LiveRegs; // Currently live registers.
1237+
1238+ void initLiveRegs (ScheduleDAGMILive *DAG);
1239+ void getMIPDiff (const MachineInstr *MI, PressureDiff &PDiff) const ;
1240+ void getTreePDiff (unsigned NodeNum, PressureDiff &PDiff) const ;
1241+ int comparePDiffs (PressureDiff &PDiff1, PressureDiff &PDiff2) const ;
1242+ // // ////
1243+
12241244public:
12251245 GenericScheduler (const MachineSchedContext *C):
12261246 GenericSchedulerBase (C), Top(SchedBoundary::TopQID, " TopQ" ),
@@ -1232,10 +1252,6 @@ class GenericScheduler : public GenericSchedulerBase {
12321252
12331253 void dumpPolicy () const override ;
12341254
1235- bool disableForRegionPreRA (MachineBasicBlock::iterator Begin,
1236- MachineBasicBlock::iterator End,
1237- unsigned NumRegionInstrs) const override ;
1238-
12391255 bool shouldTrackPressure () const override {
12401256 return RegionPolicy.ShouldTrackPressure ;
12411257 }
0 commit comments