LLVM 20.0.0git
|
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while updating LiveIntervals and tracking regpressure. More...
#include "llvm/CodeGen/MachineScheduler.h"
Public Member Functions | |
ScheduleDAGMILive (MachineSchedContext *C, std::unique_ptr< MachineSchedStrategy > S) | |
~ScheduleDAGMILive () override | |
bool | hasVRegLiveness () const override |
Return true if this DAG supports VReg liveness and RegPressure. | |
bool | isTrackingPressure () const |
Return true if register pressure tracking is enabled. | |
const IntervalPressure & | getTopPressure () const |
Get current register pressure for the top scheduled instructions. | |
const RegPressureTracker & | getTopRPTracker () const |
const IntervalPressure & | getBotPressure () const |
Get current register pressure for the bottom scheduled instructions. | |
const RegPressureTracker & | getBotRPTracker () const |
const IntervalPressure & | getRegPressure () const |
Get register pressure for the entire scheduling region before scheduling. | |
const std::vector< PressureChange > & | getRegionCriticalPSets () const |
PressureDiff & | getPressureDiff (const SUnit *SU) |
const PressureDiff & | getPressureDiff (const SUnit *SU) const |
void | computeDFSResult () |
Compute a DFSResult after DAG building is complete, and before any queue comparisons. | |
const SchedDFSResult * | getDFSResult () const |
Return a non-null DFS result if the scheduling strategy initialized it. | |
BitVector & | getScheduledTrees () |
void | enterRegion (MachineBasicBlock *bb, MachineBasicBlock::iterator begin, MachineBasicBlock::iterator end, unsigned regioninstrs) override |
Implement the ScheduleDAGInstrs interface for handling the next scheduling region. | |
void | schedule () override |
Implement ScheduleDAGInstrs interface for scheduling a sequence of reorderable instructions. | |
unsigned | computeCyclicCriticalPath () |
Compute the cyclic critical path through the DAG. | |
void | dump () const override |
Public Member Functions inherited from llvm::ScheduleDAGMI | |
ScheduleDAGMI (MachineSchedContext *C, std::unique_ptr< MachineSchedStrategy > S, bool RemoveKillFlags) | |
~ScheduleDAGMI () override | |
bool | doMBBSchedRegionsTopDown () const override |
If this method returns true, handling of the scheduling regions themselves (in case of a scheduling boundary in MBB) will be done beginning with the topmost region of MBB. | |
LiveIntervals * | getLIS () const |
virtual bool | hasVRegLiveness () const |
Return true if this DAG supports VReg liveness and RegPressure. | |
void | addMutation (std::unique_ptr< ScheduleDAGMutation > Mutation) |
Add a postprocessing step to the DAG builder. | |
MachineBasicBlock::iterator | top () const |
MachineBasicBlock::iterator | bottom () const |
void | enterRegion (MachineBasicBlock *bb, MachineBasicBlock::iterator begin, MachineBasicBlock::iterator end, unsigned regioninstrs) override |
Implement the ScheduleDAGInstrs interface for handling the next scheduling region. | |
void | schedule () override |
Implement ScheduleDAGInstrs interface for scheduling a sequence of reorderable instructions. | |
void | startBlock (MachineBasicBlock *bb) override |
Prepares to perform scheduling in the given block. | |
void | finishBlock () override |
Cleans up after scheduling in the given block. | |
void | moveInstruction (MachineInstr *MI, MachineBasicBlock::iterator InsertPos) |
Change the position of an instruction within the basic block and update live ranges and region boundary iterators. | |
const SUnit * | getNextClusterPred () const |
const SUnit * | getNextClusterSucc () const |
void | viewGraph (const Twine &Name, const Twine &Title) override |
viewGraph - Pop up a ghostview window with the reachable parts of the DAG rendered using 'dot'. | |
void | viewGraph () override |
Out-of-line implementation with no arguments is handy for gdb. | |
Public Member Functions inherited from llvm::ScheduleDAGInstrs | |
void | setDumpDirection (DumpDirection D) |
ScheduleDAGInstrs (MachineFunction &mf, const MachineLoopInfo *mli, bool RemoveKillFlags=false) | |
~ScheduleDAGInstrs () override=default | |
const TargetSchedModel * | getSchedModel () const |
Gets the machine model for instruction scheduling. | |
const MCSchedClassDesc * | getSchedClass (SUnit *SU) const |
Resolves and cache a resolved scheduling class for an SUnit. | |
bool | IsReachable (SUnit *SU, SUnit *TargetSU) |
IsReachable - Checks if SU is reachable from TargetSU. | |
MachineBasicBlock::iterator | begin () const |
Returns an iterator to the top of the current scheduling region. | |
MachineBasicBlock::iterator | end () const |
Returns an iterator to the bottom of the current scheduling region. | |
SUnit * | newSUnit (MachineInstr *MI) |
Creates a new SUnit and return a ptr to it. | |
SUnit * | getSUnit (MachineInstr *MI) const |
Returns an existing SUnit for this MI, or nullptr. | |
virtual bool | doMBBSchedRegionsTopDown () const |
If this method returns true, handling of the scheduling regions themselves (in case of a scheduling boundary in MBB) will be done beginning with the topmost region of MBB. | |
virtual void | startBlock (MachineBasicBlock *BB) |
Prepares to perform scheduling in the given block. | |
virtual void | finishBlock () |
Cleans up after scheduling in the given block. | |
virtual void | enterRegion (MachineBasicBlock *bb, MachineBasicBlock::iterator begin, MachineBasicBlock::iterator end, unsigned regioninstrs) |
Initialize the DAG and common scheduler state for a new scheduling region. | |
virtual void | exitRegion () |
Called when the scheduler has finished scheduling the current region. | |
void | buildSchedGraph (AAResults *AA, RegPressureTracker *RPTracker=nullptr, PressureDiffs *PDiffs=nullptr, LiveIntervals *LIS=nullptr, bool TrackLaneMasks=false) |
Builds SUnits for the current region. | |
void | addSchedBarrierDeps () |
Adds dependencies from instructions in the current list of instructions being scheduled to scheduling barrier. | |
virtual void | schedule ()=0 |
Orders nodes according to selected style. | |
virtual void | finalizeSchedule () |
Allow targets to perform final scheduling actions at the level of the whole MachineFunction. | |
void | dumpNode (const SUnit &SU) const override |
void | dump () const override |
std::string | getGraphNodeLabel (const SUnit *SU) const override |
Returns a label for a DAG node that points to an instruction. | |
std::string | getDAGName () const override |
Returns a label for the region of code covered by the DAG. | |
void | fixupKills (MachineBasicBlock &MBB) |
Fixes register kill flags that scheduling has made invalid. | |
bool | canAddEdge (SUnit *SuccSU, SUnit *PredSU) |
True if an edge can be added from PredSU to SuccSU without creating a cycle. | |
bool | addEdge (SUnit *SuccSU, const SDep &PredDep) |
Add a DAG edge to the given SU with the given predecessor dependence data. | |
Public Member Functions inherited from llvm::ScheduleDAG | |
ScheduleDAG (const ScheduleDAG &)=delete | |
ScheduleDAG & | operator= (const ScheduleDAG &)=delete |
ScheduleDAG (MachineFunction &mf) | |
virtual | ~ScheduleDAG () |
void | clearDAG () |
Clears the DAG state (between regions). | |
const MCInstrDesc * | getInstrDesc (const SUnit *SU) const |
Returns the MCInstrDesc of this SUnit. | |
virtual void | viewGraph (const Twine &Name, const Twine &Title) |
Pops up a GraphViz/gv window with the ScheduleDAG rendered using 'dot'. | |
virtual void | viewGraph () |
Out-of-line implementation with no arguments is handy for gdb. | |
virtual void | dumpNode (const SUnit &SU) const =0 |
virtual void | dump () const =0 |
void | dumpNodeName (const SUnit &SU) const |
virtual std::string | getGraphNodeLabel (const SUnit *SU) const =0 |
Returns a label for an SUnit node in a visualization of the ScheduleDAG. | |
virtual std::string | getDAGName () const =0 |
Returns a label for the region of code covered by the DAG. | |
virtual void | addCustomGraphFeatures (GraphWriter< ScheduleDAG * > &) const |
Adds custom features for a visualization of the ScheduleDAG. | |
unsigned | VerifyScheduledDAG (bool isBottomUp) |
Verifies that all SUnits were scheduled and that their state is consistent. | |
Protected Member Functions | |
void | buildDAGWithRegPressure () |
Call ScheduleDAGInstrs::buildSchedGraph with register pressure tracking enabled. | |
void | initQueues (ArrayRef< SUnit * > TopRoots, ArrayRef< SUnit * > BotRoots) |
Release ExitSU predecessors and setup scheduler queues. | |
void | scheduleMI (SUnit *SU, bool IsTopNode) |
Move an instruction and update register pressure. | |
void | initRegPressure () |
void | updatePressureDiffs (ArrayRef< RegisterMaskPair > LiveUses) |
Update the PressureDiff array for liveness after scheduling this instruction. | |
void | updateScheduledPressure (const SUnit *SU, const std::vector< unsigned > &NewMaxPressure) |
void | collectVRegUses (SUnit &SU) |
Protected Member Functions inherited from llvm::ScheduleDAGMI | |
void | postProcessDAG () |
Apply each ScheduleDAGMutation step in order. | |
void | initQueues (ArrayRef< SUnit * > TopRoots, ArrayRef< SUnit * > BotRoots) |
Release ExitSU predecessors and setup scheduler queues. | |
void | updateQueues (SUnit *SU, bool IsTopNode) |
Update scheduler DAG and queues after scheduling an instruction. | |
void | placeDebugValues () |
Reinsert debug_values recorded in ScheduleDAGInstrs::DbgValues. | |
void | dumpSchedule () const |
dump the scheduled Sequence. | |
void | dumpScheduleTraceTopDown () const |
Print execution trace of the schedule top-down or bottom-up. | |
void | dumpScheduleTraceBottomUp () const |
bool | checkSchedLimit () |
void | findRootsAndBiasEdges (SmallVectorImpl< SUnit * > &TopRoots, SmallVectorImpl< SUnit * > &BotRoots) |
void | releaseSucc (SUnit *SU, SDep *SuccEdge) |
ReleaseSucc - Decrement the NumPredsLeft count of a successor. | |
void | releaseSuccessors (SUnit *SU) |
releaseSuccessors - Call releaseSucc on each of SU's successors. | |
void | releasePred (SUnit *SU, SDep *PredEdge) |
ReleasePred - Decrement the NumSuccsLeft count of a predecessor. | |
void | releasePredecessors (SUnit *SU) |
releasePredecessors - Call releasePred on each of SU's predecessors. | |
Protected Member Functions inherited from llvm::ScheduleDAGInstrs | |
void | reduceHugeMemNodeMaps (Value2SUsMap &stores, Value2SUsMap &loads, unsigned N) |
Reduces maps in FIFO order, by N SUs. | |
void | addChainDependency (SUnit *SUa, SUnit *SUb, unsigned Latency=0) |
Adds a chain edge between SUa and SUb, but only if both AAResults and Target fail to deny the dependency. | |
void | addChainDependencies (SUnit *SU, SUList &SUs, unsigned Latency) |
Adds dependencies as needed from all SUs in list to SU. | |
void | addChainDependencies (SUnit *SU, Value2SUsMap &Val2SUsMap) |
Adds dependencies as needed from all SUs in map, to SU. | |
void | addChainDependencies (SUnit *SU, Value2SUsMap &Val2SUsMap, ValueType V) |
Adds dependencies as needed to SU, from all SUs mapped to V. | |
void | addBarrierChain (Value2SUsMap &map) |
Adds barrier chain edges from all SUs in map, and then clear the map. | |
void | insertBarrierChain (Value2SUsMap &map) |
Inserts a barrier chain in a huge region, far below current SU. | |
void | initSUnits () |
Creates an SUnit for each real instruction, numbered in top-down topological order. | |
void | addPhysRegDataDeps (SUnit *SU, unsigned OperIdx) |
MO is an operand of SU's instruction that defines a physical register. | |
void | addPhysRegDeps (SUnit *SU, unsigned OperIdx) |
Adds register dependencies (data, anti, and output) from this SUnit to following instructions in the same scheduling region that depend the physical register referenced at OperIdx. | |
void | addVRegDefDeps (SUnit *SU, unsigned OperIdx) |
Adds register output and data dependencies from this SUnit to instructions that occur later in the same scheduling region if they read from or write to the virtual register defined at OperIdx. | |
void | addVRegUseDeps (SUnit *SU, unsigned OperIdx) |
Adds a register data dependency if the instruction that defines the virtual register used at OperIdx is mapped to an SUnit. | |
LaneBitmask | getLaneMaskForMO (const MachineOperand &MO) const |
Returns a mask for which lanes get read/written by the given (register) machine operand. | |
bool | deadDefHasNoUse (const MachineOperand &MO) |
Returns true if the def register in MO has no uses. | |
Protected Member Functions inherited from llvm::ScheduleDAG | |
void | dumpNodeAll (const SUnit &SU) const |
Protected Attributes | |
RegisterClassInfo * | RegClassInfo |
SchedDFSResult * | DFSResult = nullptr |
Information about DAG subtrees. | |
BitVector | ScheduledTrees |
MachineBasicBlock::iterator | LiveRegionEnd |
VReg2SUnitMultiMap | VRegUses |
Maps vregs to the SUnits of their uses in the current scheduling region. | |
PressureDiffs | SUPressureDiffs |
bool | ShouldTrackPressure = false |
Register pressure in this region computed by initRegPressure. | |
bool | ShouldTrackLaneMasks = false |
IntervalPressure | RegPressure |
RegPressureTracker | RPTracker |
std::vector< PressureChange > | RegionCriticalPSets |
List of pressure sets that exceed the target's pressure limit before scheduling, listed in increasing set ID order. | |
IntervalPressure | TopPressure |
The top of the unscheduled zone. | |
RegPressureTracker | TopRPTracker |
IntervalPressure | BotPressure |
The bottom of the unscheduled zone. | |
RegPressureTracker | BotRPTracker |
Protected Attributes inherited from llvm::ScheduleDAGMI | |
AAResults * | AA |
LiveIntervals * | LIS |
std::unique_ptr< MachineSchedStrategy > | SchedImpl |
std::vector< std::unique_ptr< ScheduleDAGMutation > > | Mutations |
Ordered list of DAG postprocessing steps. | |
MachineBasicBlock::iterator | CurrentTop |
The top of the unscheduled zone. | |
MachineBasicBlock::iterator | CurrentBottom |
The bottom of the unscheduled zone. | |
const SUnit * | NextClusterPred = nullptr |
Record the next node in a scheduled cluster. | |
const SUnit * | NextClusterSucc = nullptr |
Protected Attributes inherited from llvm::ScheduleDAGInstrs | |
const MachineLoopInfo * | MLI = nullptr |
const MachineFrameInfo & | MFI |
TargetSchedModel | SchedModel |
TargetSchedModel provides an interface to the machine model. | |
bool | RemoveKillFlags |
True if the DAG builder should remove kill flags (in preparation for rescheduling). | |
bool | CanHandleTerminators = false |
The standard DAG builder does not normally include terminators as DAG nodes because it does not create the necessary dependencies to prevent reordering. | |
bool | TrackLaneMasks = false |
Whether lane masks should get tracked. | |
MachineBasicBlock * | BB = nullptr |
The block in which to insert instructions. | |
MachineBasicBlock::iterator | RegionBegin |
The beginning of the range to be scheduled. | |
MachineBasicBlock::iterator | RegionEnd |
The end of the range to be scheduled. | |
unsigned | NumRegionInstrs = 0 |
Instructions in this region (distance(RegionBegin, RegionEnd)). | |
DenseMap< MachineInstr *, SUnit * > | MISUnitMap |
After calling BuildSchedGraph, each machine instruction in the current scheduling region is mapped to an SUnit. | |
RegUnit2SUnitsMap | Defs |
Defs, Uses - Remember where defs and uses of each register are as we iterate upward through the instructions. | |
RegUnit2SUnitsMap | Uses |
VReg2SUnitMultiMap | CurrentVRegDefs |
Tracks the last instruction(s) in this region defining each virtual register. | |
VReg2SUnitOperIdxMultiMap | CurrentVRegUses |
Tracks the last instructions in this region using each virtual register. | |
AAResults * | AAForDep = nullptr |
SUnit * | BarrierChain = nullptr |
Remember a generic side-effecting instruction as we proceed. | |
DumpDirection | DumpDir = NotSet |
UndefValue * | UnknownValue |
For an unanalyzable memory access, this Value is used in maps. | |
ScheduleDAGTopologicalSort | Topo |
Topo - A topological ordering for SUnits which permits fast IsReachable and similar queries. | |
DbgValueVector | DbgValues |
Remember instruction that precedes DBG_VALUE. | |
MachineInstr * | FirstDbgValue = nullptr |
LiveRegUnits | LiveRegs |
Set of live physical registers for updating kill flags. | |
Additional Inherited Members | |
Public Types inherited from llvm::ScheduleDAGInstrs | |
enum | DumpDirection { TopDown , BottomUp , Bidirectional , NotSet } |
The direction that should be used to dump the scheduled Sequence. More... | |
using | SUList = std::list< SUnit * > |
A list of SUnits, used in Value2SUsMap, during DAG construction. | |
Public Attributes inherited from llvm::ScheduleDAG | |
const LLVMTargetMachine & | TM |
Target processor. | |
const TargetInstrInfo * | TII |
Target instruction information. | |
const TargetRegisterInfo * | TRI |
Target processor register info. | |
MachineFunction & | MF |
Machine function. | |
MachineRegisterInfo & | MRI |
Virtual/real register map. | |
std::vector< SUnit > | SUnits |
The scheduling units. | |
SUnit | EntrySU |
Special node for the region entry. | |
SUnit | ExitSU |
Special node for the region exit. | |
bool | StressSched |
Protected Types inherited from llvm::ScheduleDAGInstrs | |
using | DbgValueVector = std::vector< std::pair< MachineInstr *, MachineInstr * > > |
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while updating LiveIntervals and tracking regpressure.
Definition at line 398 of file MachineScheduler.h.
|
inline |
Definition at line 437 of file MachineScheduler.h.
|
override |
Definition at line 1189 of file MachineScheduler.cpp.
References DFSResult.
|
protected |
Call ScheduleDAGInstrs::buildSchedGraph with register pressure tracking enabled.
Build the DAG and setup three register pressure trackers.
This sets up three trackers. RPTracker will cover the entire DAG region, TopTracker and BottomTracker will be initialized to the top and bottom of the DAG region without covereing any unscheduled instruction.
Definition at line 1521 of file MachineScheduler.cpp.
References llvm::ScheduleDAGMI::AA, llvm::ScheduleDAGInstrs::BB, llvm::ScheduleDAGInstrs::buildSchedGraph(), llvm::RegPressureTracker::init(), initRegPressure(), llvm::ScheduleDAGMI::LIS, LiveRegionEnd, llvm::ScheduleDAG::MF, llvm::RegPressureTracker::recede(), RegClassInfo, RegionCriticalPSets, llvm::ScheduleDAGInstrs::RegionEnd, llvm::RegPressureTracker::reset(), RPTracker, ShouldTrackLaneMasks, ShouldTrackPressure, and SUPressureDiffs.
Referenced by schedule(), llvm::VLIWMachineScheduler::schedule(), and llvm::SIScheduleDAGMI::schedule().
|
protected |
Definition at line 1193 of file MachineScheduler.cpp.
References llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::end(), llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::find(), llvm::SUnit::getInstr(), llvm::LaneBitmask::getNone(), llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::insert(), MI, llvm::ScheduleDAGInstrs::TrackLaneMasks, and VRegUses.
Referenced by initRegPressure().
unsigned ScheduleDAGMILive::computeCyclicCriticalPath | ( | ) |
Compute the cyclic critical path through the DAG.
Compute the max cyclic critical path through the DAG.
The scheduling DAG only provides the critical path for single block loops. To handle loops that span blocks, we could use the vreg path latencies provided by MachineTraceMetrics instead. However, MachineTraceMetrics is not currently available for use in the scheduler.
The cyclic path estimation identifies a def-use pair that crosses the back edge and considers the depth and height of the nodes. For example, consider the following instruction sequence where each instruction has unit latency and defines an eponymous virtual register:
a->b(a,c)->c(b)->d(c)->exit
The cyclic critical path is a two cycles: b->c->b The acyclic critical path is four cycles: a->b->c->d->exit LiveOutHeight = height(c) = len(c->d->exit) = 2 LiveOutDepth = depth(c) + 1 = len(a->b->c) + 1 = 3 LiveInHeight = height(b) + 1 = len(b->c->d->exit) + 1 = 4 LiveInDepth = depth(b) = len(a->b) = 1
LiveOutDepth - LiveInDepth = 3 - 1 = 2 LiveInHeight - LiveOutHeight = 4 - 2 = 2 CyclicCriticalPath = min(2, 2) = 2
This could be relevant to PostRA scheduling, but is currently implemented assuming LiveIntervals.
Definition at line 1580 of file MachineScheduler.cpp.
References llvm::ScheduleDAGInstrs::BB, llvm::dbgs(), llvm::VNInfo::def, DefMI, llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::end(), llvm::ScheduleDAG::ExitSU, llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::find(), llvm::SUnit::getDepth(), llvm::SUnit::getHeight(), llvm::SUnit::getInstr(), llvm::LiveIntervals::getInstructionFromIndex(), llvm::LiveIntervals::getInstructionIndex(), llvm::LiveIntervals::getInterval(), llvm::LiveIntervals::getMBBEndIdx(), llvm::RegPressureTracker::getPressure(), llvm::ScheduleDAGInstrs::getSUnit(), llvm::LiveRange::getVNInfoBefore(), llvm::VNInfo::isPHIDef(), llvm::MachineBasicBlock::isSuccessor(), llvm::SUnit::Latency, llvm::ScheduleDAGMI::LIS, llvm::RegisterPressure::LiveOutRegs, LLVM_DEBUG, llvm::make_range(), llvm::SUnit::NodeNum, P, llvm::LiveRange::Query(), RPTracker, llvm::LiveQueryResult::valueIn(), and VRegUses.
void ScheduleDAGMILive::computeDFSResult | ( | ) |
Compute a DFSResult after DAG building is complete, and before any queue comparisons.
Definition at line 1544 of file MachineScheduler.cpp.
References llvm::BitVector::clear(), llvm::SchedDFSResult::clear(), llvm::SchedDFSResult::compute(), DFSResult, llvm::SchedDFSResult::getNumSubtrees(), MinSubtreeSize, llvm::BitVector::resize(), llvm::SchedDFSResult::resize(), ScheduledTrees, and llvm::ScheduleDAG::SUnits.
|
overridevirtual |
Implements llvm::ScheduleDAG.
Definition at line 1428 of file MachineScheduler.cpp.
References llvm::dbgs(), llvm::PressureDiff::dump(), llvm::ScheduleDAG::dumpNodeAll(), llvm::ScheduleDAG::EntrySU, llvm::ScheduleDAG::ExitSU, llvm::SUnit::getInstr(), getPressureDiff(), llvm::TargetSchedModel::mustBeginGroup(), llvm::TargetSchedModel::mustEndGroup(), llvm::ScheduleDAGInstrs::SchedModel, ShouldTrackPressure, llvm::ScheduleDAG::SUnits, and llvm::ScheduleDAG::TRI.
Referenced by schedule(), llvm::VLIWMachineScheduler::schedule(), and llvm::SIScheduleDAGMI::schedule().
|
overridevirtual |
Implement the ScheduleDAGInstrs interface for handling the next scheduling region.
enterRegion - Called back from MachineScheduler::runOnMachineFunction after crossing a scheduling boundary.
This covers all instructions in a block, while schedule() may only cover a subset.
[begin, end) includes all instructions in the region, including the boundary itself and single-instruction regions that don't get scheduled.
Reimplemented from llvm::ScheduleDAGMI.
Reimplemented in llvm::GCNIterativeScheduler.
Definition at line 1235 of file MachineScheduler.cpp.
References assert(), llvm::ScheduleDAGInstrs::begin(), llvm::PressureDiffs::clear(), llvm::MachineBasicBlock::end(), llvm::ScheduleDAGInstrs::end(), llvm::ScheduleDAGMI::enterRegion(), LiveRegionEnd, llvm::ScheduleDAGInstrs::RegionEnd, llvm::ScheduleDAGMI::SchedImpl, ShouldTrackLaneMasks, ShouldTrackPressure, and SUPressureDiffs.
Referenced by llvm::GCNIterativeScheduler::enterRegion(), and llvm::GCNSchedStage::initGCNRegion().
|
inline |
Get current register pressure for the bottom scheduled instructions.
Definition at line 456 of file MachineScheduler.h.
References BotPressure.
|
inline |
Definition at line 457 of file MachineScheduler.h.
References BotRPTracker.
Referenced by llvm::ConvergingVLIWScheduler::pickNode(), llvm::GCNSchedStrategy::pickNode(), llvm::GCNSchedStrategy::pickNodeBidirectional(), and llvm::ConvergingVLIWScheduler::pickNodeBidrectional().
|
inline |
Return a non-null DFS result if the scheduling strategy initialized it.
Definition at line 478 of file MachineScheduler.h.
References DFSResult.
|
inline |
Definition at line 466 of file MachineScheduler.h.
References llvm::SUnit::NodeNum, and SUPressureDiffs.
Referenced by dump(), llvm::GCNSchedStrategy::initCandidate(), llvm::ConvergingVLIWScheduler::pressureChange(), updatePressureDiffs(), and updateScheduledPressure().
|
inline |
Definition at line 469 of file MachineScheduler.h.
References llvm::SUnit::NodeNum, and SUPressureDiffs.
|
inline |
Definition at line 462 of file MachineScheduler.h.
References RegionCriticalPSets.
Referenced by llvm::ConvergingVLIWScheduler::pickNodeFromQueue(), and llvm::ConvergingVLIWScheduler::readyQueueVerboseDump().
|
inline |
Get register pressure for the entire scheduling region before scheduling.
Definition at line 460 of file MachineScheduler.h.
References RegPressure.
Referenced by llvm::ConvergingVLIWScheduler::initialize(), llvm::ConvergingVLIWScheduler::pickNodeFromQueue(), and llvm::ConvergingVLIWScheduler::readyQueueVerboseDump().
|
inline |
Definition at line 480 of file MachineScheduler.h.
References ScheduledTrees.
|
inline |
Get current register pressure for the top scheduled instructions.
Definition at line 452 of file MachineScheduler.h.
References TopPressure.
|
inline |
Definition at line 453 of file MachineScheduler.h.
References TopRPTracker.
Referenced by llvm::ConvergingVLIWScheduler::pickNode(), llvm::GCNSchedStrategy::pickNode(), llvm::GCNSchedStrategy::pickNodeBidirectional(), and llvm::ConvergingVLIWScheduler::pickNodeBidrectional().
|
inlineoverridevirtual |
Return true if this DAG supports VReg liveness and RegPressure.
Reimplemented from llvm::ScheduleDAGMI.
Definition at line 446 of file MachineScheduler.h.
|
protected |
Release ExitSU predecessors and setup scheduler queues.
Re-position the Top RP tracker in case the region beginning has changed.
Definition at line 1641 of file MachineScheduler.cpp.
References assert(), llvm::ScheduleDAGMI::CurrentTop, llvm::RegPressureTracker::getPos(), llvm::ScheduleDAGMI::initQueues(), llvm::ScheduleDAGInstrs::RegionBegin, llvm::RegPressureTracker::setPos(), ShouldTrackPressure, and TopRPTracker.
Referenced by schedule(), llvm::VLIWMachineScheduler::schedule(), and llvm::SIScheduleDAGMI::schedule().
|
protected |
Definition at line 1257 of file MachineScheduler.cpp.
References llvm::RegPressureTracker::addLiveRegs(), assert(), llvm::ScheduleDAGInstrs::BB, BotRPTracker, llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::clear(), llvm::RegPressureTracker::closeBottom(), llvm::RegPressureTracker::closeRegion(), llvm::RegPressureTracker::closeTop(), collectVRegUses(), llvm::dbgs(), llvm::RegPressureTracker::dump(), llvm::dumpRegSetPressure(), llvm::ArrayRef< T >::empty(), llvm::RegPressureTracker::getLiveThru(), llvm::MachineRegisterInfo::getNumVirtRegs(), llvm::RegPressureTracker::getPos(), llvm::RegPressureTracker::getPressure(), llvm::RegisterClassInfo::getRegPressureSetLimit(), llvm::TargetRegisterInfo::getRegPressureSetName(), llvm::RegPressureTracker::getRegSetPressureAtPos(), llvm::RegPressureTracker::init(), llvm::RegPressureTracker::initLiveThru(), llvm::ScheduleDAGMI::LIS, llvm::RegisterPressure::LiveInRegs, llvm::RegisterPressure::LiveOutRegs, LiveRegionEnd, LLVM_DEBUG, llvm::RegisterPressure::MaxSetPressure, llvm::ScheduleDAG::MF, llvm::ScheduleDAG::MRI, priorNonDebug(), llvm::RegPressureTracker::recede(), RegClassInfo, llvm::ScheduleDAGInstrs::RegionBegin, RegionCriticalPSets, llvm::ScheduleDAGInstrs::RegionEnd, RPTracker, llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::setUniverse(), ShouldTrackLaneMasks, llvm::ScheduleDAG::SUnits, TopRPTracker, llvm::ScheduleDAG::TRI, updatePressureDiffs(), and VRegUses.
Referenced by buildDAGWithRegPressure().
|
inline |
Return true if register pressure tracking is enabled.
Definition at line 449 of file MachineScheduler.h.
References ShouldTrackPressure.
Referenced by llvm::GCNSchedStrategy::initCandidate(), llvm::GCNSchedStrategy::pickNodeFromQueue(), llvm::GCNMaxILPSchedStrategy::tryCandidate(), and llvm::PPCPreRASchedStrategy::tryCandidate().
|
overridevirtual |
Implement ScheduleDAGInstrs interface for scheduling a sequence of reorderable instructions.
schedule - Called back from MachineScheduler::runOnMachineFunction after setting up the current scheduling region.
[RegionBegin, RegionEnd) only includes instructions that have DAG nodes, not scheduling boundaries.
This is a skeletal driver, with all the functionality pushed into helpers, so that it can be easily extended by experimental schedulers. Generally, implementing MachineSchedStrategy should be sufficient to implement a new scheduling algorithm. However, if a scheduler further subclasses ScheduleDAGMILive then it will want to override this virtual method in order to update any specialized state.
Reimplemented from llvm::ScheduleDAGMI.
Reimplemented in llvm::VLIWMachineScheduler, llvm::GCNIterativeScheduler, llvm::GCNScheduleDAGMILive, and llvm::SIScheduleDAGMI.
Definition at line 1461 of file MachineScheduler.cpp.
References assert(), llvm::ScheduleDAGInstrs::begin(), buildDAGWithRegPressure(), llvm::ScheduleDAGMI::checkSchedLimit(), llvm::ScheduleDAGMI::CurrentBottom, llvm::ScheduleDAGMI::CurrentTop, llvm::dbgs(), DFSResult, dump(), llvm::ScheduleDAGMI::dumpSchedule(), llvm::ScheduleDAGMI::findRootsAndBiasEdges(), getParent(), llvm::SchedDFSResult::getSubtreeID(), initQueues(), llvm::SUnit::isScheduled, LLVM_DEBUG, llvm::ScheduleDAGMI::placeDebugValues(), llvm::ScheduleDAGMI::postProcessDAG(), llvm::PrintDAGs, llvm::printMBBReference(), llvm::ScheduleDAGMI::SchedImpl, ScheduledTrees, scheduleMI(), llvm::SchedDFSResult::scheduleTree(), llvm::BitVector::set(), llvm::BitVector::test(), llvm::ScheduleDAGMI::updateQueues(), llvm::ScheduleDAGMI::viewGraph(), and llvm::ViewMISchedDAGs.
Move an instruction and update register pressure.
Definition at line 1651 of file MachineScheduler.cpp.
References llvm::RegisterOperands::adjustLaneLiveness(), llvm::RegPressureTracker::advance(), assert(), BotRPTracker, llvm::RegisterOperands::collect(), llvm::ScheduleDAGMI::CurrentBottom, llvm::ScheduleDAGMI::CurrentTop, llvm::dbgs(), llvm::RegisterOperands::detectDeadDefs(), llvm::dumpRegSetPressure(), llvm::SUnit::getInstr(), llvm::LiveIntervals::getInstructionIndex(), llvm::RegPressureTracker::getPos(), llvm::RegPressureTracker::getPressure(), llvm::RegPressureTracker::getRegSetPressureAtPos(), llvm::SlotIndex::getRegSlot(), llvm::SUnit::isBottomReady(), llvm::SUnit::isTopReady(), llvm::ScheduleDAGMI::LIS, LLVM_DEBUG, llvm::RegisterPressure::MaxSetPressure, MI, llvm::ScheduleDAGMI::moveInstruction(), llvm::ScheduleDAG::MRI, nextIfDebug(), priorNonDebug(), llvm::RegPressureTracker::recede(), llvm::RegPressureTracker::recedeSkipDebugValues(), llvm::RegPressureTracker::setPos(), ShouldTrackLaneMasks, ShouldTrackPressure, TopRPTracker, llvm::ScheduleDAG::TRI, updatePressureDiffs(), and updateScheduledPressure().
Referenced by schedule(), llvm::VLIWMachineScheduler::schedule(), and llvm::SIScheduleDAGMI::schedule().
|
protected |
Update the PressureDiff array for liveness after scheduling this instruction.
FIXME: Currently assuming single-use physregs.
Definition at line 1360 of file MachineScheduler.cpp.
References llvm::PressureDiff::addPressureChange(), assert(), llvm::ScheduleDAGInstrs::BB, BotRPTracker, llvm::dbgs(), llvm::PressureDiff::dump(), llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::end(), llvm::MachineBasicBlock::end(), llvm::ScheduleDAG::ExitSU, llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::find(), llvm::SUnit::getInstr(), llvm::LiveIntervals::getInstructionIndex(), llvm::LiveIntervals::getInterval(), llvm::LiveIntervals::getMBBEndIdx(), llvm::RegPressureTracker::getPos(), getPressureDiff(), llvm::LiveRange::getVNInfoBefore(), I, llvm::SUnit::isScheduled, llvm::ScheduleDAGMI::LIS, LLVM_DEBUG, llvm::make_range(), llvm::ScheduleDAG::MRI, nextIfDebug(), llvm::SUnit::NodeNum, P, llvm::PrintLaneMask(), llvm::printReg(), llvm::printVRegOrUnit(), llvm::LiveRange::Query(), ShouldTrackLaneMasks, llvm::ScheduleDAG::TRI, llvm::LiveQueryResult::valueIn(), and VRegUses.
Referenced by initRegPressure(), and scheduleMI().
|
protected |
Definition at line 1331 of file MachineScheduler.cpp.
References BotRPTracker, llvm::dbgs(), llvm::RegPressureTracker::getLiveThru(), getPressureDiff(), llvm::RegisterClassInfo::getRegPressureSetLimit(), llvm::TargetRegisterInfo::getRegPressureSetName(), LLVM_DEBUG, RegClassInfo, RegionCriticalPSets, and llvm::ScheduleDAG::TRI.
Referenced by scheduleMI().
|
protected |
The bottom of the unscheduled zone.
Definition at line 433 of file MachineScheduler.h.
Referenced by getBotPressure().
|
protected |
Definition at line 434 of file MachineScheduler.h.
Referenced by getBotRPTracker(), initRegPressure(), scheduleMI(), updatePressureDiffs(), and updateScheduledPressure().
|
protected |
Information about DAG subtrees.
If DFSResult is NULL, then SchedulerTrees will be empty.
Definition at line 404 of file MachineScheduler.h.
Referenced by computeDFSResult(), getDFSResult(), schedule(), and ~ScheduleDAGMILive().
|
protected |
Definition at line 407 of file MachineScheduler.h.
Referenced by buildDAGWithRegPressure(), enterRegion(), and initRegPressure().
|
protected |
Definition at line 400 of file MachineScheduler.h.
Referenced by buildDAGWithRegPressure(), llvm::VLIWMachineScheduler::getRegClassInfo(), initRegPressure(), llvm::SIScheduleDAGMI::initRPTracker(), and updateScheduledPressure().
|
protected |
List of pressure sets that exceed the target's pressure limit before scheduling, listed in increasing set ID order.
Each pressure set is paired with its max pressure in the currently scheduled regions.
Definition at line 426 of file MachineScheduler.h.
Referenced by buildDAGWithRegPressure(), getRegionCriticalPSets(), initRegPressure(), and updateScheduledPressure().
|
protected |
Definition at line 420 of file MachineScheduler.h.
Referenced by getRegPressure().
|
protected |
Definition at line 421 of file MachineScheduler.h.
Referenced by buildDAGWithRegPressure(), computeCyclicCriticalPath(), llvm::SIScheduleDAGMI::getInRegs(), llvm::SIScheduleDAGMI::getOutRegs(), llvm::GCNIterativeScheduler::getSchedulePressure(), initRegPressure(), and llvm::SIScheduleDAGMI::initRPTracker().
|
protected |
Definition at line 405 of file MachineScheduler.h.
Referenced by computeDFSResult(), getScheduledTrees(), and schedule().
|
protected |
Definition at line 419 of file MachineScheduler.h.
Referenced by buildDAGWithRegPressure(), enterRegion(), initRegPressure(), llvm::GCNSchedStage::revertScheduling(), scheduleMI(), and updatePressureDiffs().
|
protected |
Register pressure in this region computed by initRegPressure.
Definition at line 418 of file MachineScheduler.h.
Referenced by buildDAGWithRegPressure(), dump(), enterRegion(), initQueues(), isTrackingPressure(), and scheduleMI().
|
protected |
Definition at line 415 of file MachineScheduler.h.
Referenced by buildDAGWithRegPressure(), enterRegion(), and getPressureDiff().
|
protected |
The top of the unscheduled zone.
Definition at line 429 of file MachineScheduler.h.
Referenced by getTopPressure().
|
protected |
Definition at line 430 of file MachineScheduler.h.
Referenced by getTopRPTracker(), initQueues(), initRegPressure(), llvm::SIScheduleDAGMI::schedule(), and scheduleMI().
|
protected |
Maps vregs to the SUnits of their uses in the current scheduling region.
Definition at line 410 of file MachineScheduler.h.
Referenced by collectVRegUses(), computeCyclicCriticalPath(), initRegPressure(), and updatePressureDiffs().