77 #ifndef LLVM_CODEGEN_MACHINESCHEDULER_H
78 #define LLVM_CODEGEN_MACHINESCHEDULER_H
91 class MachineDominatorTree;
92 class MachineLoopInfo;
93 class RegisterClassInfo;
94 class ScheduleDAGInstrs;
167 virtual void anchor();
174 unsigned NumRegionInstrs) {}
216 std::vector<SUnit*> Queue;
221 unsigned getID()
const {
return ID; }
228 bool empty()
const {
return Queue.empty(); }
232 unsigned size()
const {
return Queue.size(); }
243 return std::find(Queue.begin(), Queue.end(), SU);
252 (*I)->NodeQueueId &= ~ID;
254 unsigned idx =
I - Queue.begin();
256 return Queue.begin() + idx;
259 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
266 virtual void anchor();
460 const std::vector<
unsigned> &NewMaxPressure);
void releaseSucc(SUnit *SU, SDep *SuccEdge)
IntervalPressure TopPressure
virtual void initialize(ScheduleDAGMI *DAG)=0
Initialize the strategy after building the DAG for a new region.
const IntervalPressure & getTopPressure() const
Get current register pressure for the top scheduled instructions.
virtual ~MachineSchedContext()
void addMutation(ScheduleDAGMutation *Mutation)
virtual void releaseTopNode(SUnit *SU)=0
bool isInQueue(SUnit *SU) const
ScheduleDAGTopologicalSort Topo
MachineBasicBlock::iterator CurrentTop
The top of the unscheduled zone.
const MachineLoopInfo * MLI
virtual ~MachineSchedStrategy()
void buildDAGWithRegPressure()
Build the DAG and setup three register pressure trackers.
void *(* MachinePassCtor)()
MachineBasicBlock::iterator begin() const
begin - Return an iterator to the top of the current scheduling region.
MachineSchedRegistry(const char *N, const char *D, ScheduleDAGCtor C)
Mutate the DAG as a postpass after normal DAG building.
IntervalPressure BotPressure
static void setListener(MachinePassRegistryListener *L)
virtual bool shouldTrackPressure() const
MachineBasicBlock::iterator top() const
MachineSchedRegistry * getNext() const
void updateQueues(SUnit *SU, bool IsTopNode)
Update scheduler DAG and queues after scheduling an instruction.
virtual void schedNode(SUnit *SU, bool IsTopNode)=0
const RegPressureTracker & getTopRPTracker() const
unsigned NumInstrsScheduled
ArrayRef< SUnit * > elements()
void viewGraph() LLVM_OVERRIDE
Out-of-line implementation with no arguments is handy for gdb.
BitVector & getScheduledTrees()
const TargetPassConfig * PassConfig
IntervalPressure RegPressure
void enterRegion(MachineBasicBlock *bb, MachineBasicBlock::iterator begin, MachineBasicBlock::iterator end, unsigned regioninstrs) LLVM_OVERRIDE
ScheduleDAGCtor FunctionPassCtor
static MachineSchedRegistry * getList()
Compute the values of each DAG node for various metrics during DFS.
const MachineLoopInfo & MLI
virtual void initPolicy(MachineBasicBlock::iterator Begin, MachineBasicBlock::iterator End, unsigned NumRegionInstrs)
Optionally override the per-region scheduling policy.
bool isTrackingPressure() const
Return true if register pressure tracking is enabled.
virtual void registerRoots()
virtual ~ScheduleDAGMutation()
std::vector< SUnit * >::iterator iterator
MachineSchedStrategy * SchedImpl
RegisterClassInfo * RegClassInfo
bundle_iterator< MachineInstr, instr_iterator > iterator
std::vector< ScheduleDAGMutation * > Mutations
Ordered list of DAG postprocessing steps.
void updatePressureDiffs(ArrayRef< unsigned > LiveUses)
void dumpSchedule() const
dump the scheduled Sequence.
MachinePassRegistryNode * getNext() const
PressureDiff & getPressureDiff(const SUnit *SU)
bool addEdge(SUnit *SuccSU, const SDep &PredDep)
Add a DAG edge to the given SU with the given predecessor dependence data.
static MachinePassRegistry Registry
void releasePred(SUnit *SU, SDep *PredEdge)
virtual void releaseBottomNode(SUnit *SU)=0
void findRootsAndBiasEdges(SmallVectorImpl< SUnit * > &TopRoots, SmallVectorImpl< SUnit * > &BotRoots)
void updateScheduledPressure(const SUnit *SU, const std::vector< unsigned > &NewMaxPressure)
ScheduleDAGMI(MachineSchedContext *C, MachineSchedStrategy *S)
void releaseSuccessors(SUnit *SU)
releaseSuccessors - Call releaseSucc on each of SU's successors.
const SUnit * NextClusterSucc
void scheduleMI(SUnit *SU, bool IsTopNode)
Move an instruction and update register pressure.
MachineBasicBlock::iterator LiveRegionEnd
const MachineDominatorTree & MDT
const SUnit * NextClusterPred
Record the next node in a scheduled cluster.
ScheduleDAGInstrs *(* ScheduleDAGCtor)(MachineSchedContext *)
unsigned computeCyclicCriticalPath()
Compute the cyclic critical path through the DAG.
const std::vector< PressureChange > & getRegionCriticalPSets() const
PressureDiffs SUPressureDiffs
ReadyQueue(unsigned id, const Twine &name)
MachineBasicBlock::iterator bottom() const
void moveInstruction(MachineInstr *MI, MachineBasicBlock::iterator InsertPos)
MachineBasicBlock::iterator end() const
end - Return an iterator to the bottom of the current scheduling region.
const IntervalPressure & getRegPressure() const
Get register pressure for the entire scheduling region before scheduling.
const SUnit * getNextClusterSucc() const
virtual void scheduleTree(unsigned SubtreeID)
Scheduler callback to notify that a new subtree is scheduled.
RegPressureTracker BotRPTracker
void releasePredecessors(SUnit *SU)
releasePredecessors - Call releasePred on each of SU's predecessors.
virtual SUnit * pickNode(bool &IsTopNode)=0
RegPressureTracker RPTracker
const MachineDominatorTree * MDT
cl::opt< bool > ForceBottomUp
void placeDebugValues()
Reinsert debug_values recorded in ScheduleDAGInstrs::DbgValues.
RegisterClassInfo * RegClassInfo
SchedDFSResult * DFSResult
std::vector< PressureChange > RegionCriticalPSets
MachineBasicBlock::iterator CurrentBottom
The bottom of the unscheduled zone.
const IntervalPressure & getBotPressure() const
Get current register pressure for the bottom scheduled instructions.
void initQueues(ArrayRef< SUnit * > TopRoots, ArrayRef< SUnit * > BotRoots)
Release ExitSU predecessors and setup scheduler queues.
void postprocessDAG()
Apply each ScheduleDAGMutation step in order.
bool ShouldTrackPressure
Register pressure in this region computed by initRegPressure.
RegPressureTracker TopRPTracker
const SUnit * getNextClusterPred() const
StringRef getName() const
bool canAddEdge(SUnit *SuccSU, SUnit *PredSU)
True if an edge can be added from PredSU to SuccSU without creating a cycle.
const RegPressureTracker & getBotRPTracker() const
std::vector< SUnit > SUnits
const SchedDFSResult * getDFSResult() const
Return a non-null DFS result if the scheduling strategy initialized it.
virtual void apply(ScheduleDAGMI *DAG)=0
LiveIntervals * LIS
Live Intervals provides reaching defs in preRA scheduling.
SUnit - Scheduling unit. This is a node in the scheduling DAG.
cl::opt< bool > ForceTopDown