llvm::ScheduleDAGMILive

ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while updating LiveIntervals and tracking regpressure.

Synopsis

Declared in <llvm/CodeGen/MachineScheduler.h>

class ScheduleDAGMILive
    : public ScheduleDAGMI

Base Classes

NameDescription
ScheduleDAGMIScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions according to the given MachineSchedStrategy without much extra book-keeping. This is the common functionality between PreRA and PostRA MachineScheduler.

Type Aliases

NameDescription
SUList A list of SUnits, used in Value2SUsMap, during DAG construction. Note: to gain speed it might be worth investigating an optimized implementation of this data structure, such as a singly linked list with a memory pool (SmallVector was tried but slow and SparseSet is not applicable).

Enums

NameDescription
DumpDirection The direction that should be used to dump the scheduled Sequence.

Member Functions

NameDescription
ScheduleDAGMILive [constructor]
~ScheduleDAGMILive [destructor] [virtual]Destructor
operator= [deleted]Copy assignment operator
IsReachable IsReachable - Checks if SU is reachable from TargetSU.
VerifyScheduledDAG Verifies that all SUnits were scheduled and that their state is consistent. Returns the number of scheduled SUnits.
addCustomGraphFeatures [virtual]Adds custom features for a visualization of the ScheduleDAG.
addEdge Add a DAG edge to the given SU with the given predecessor dependence data.
addMutation Add a postprocessing step to the DAG builder. Mutations are applied in the order that they are added after normal DAG building and before MachineSchedStrategy initialization.
addSchedBarrierDeps Adds dependencies from instructions in the current list of instructions being scheduled to scheduling barrier. We want to make sure instructions which define registers that are either used by the terminator or are live-out are properly scheduled. This is especially important when the definition latency of the return value(s) are too high to be hidden by the branch or when the liveout registers used by instructions in the fallthrough block.
begin Returns an iterator to the top of the current scheduling region.
bottom
buildSchedGraph Builds SUnits for the current region. If RPTracker is non-null, compute register pressure as a side effect. The DAG builder is an efficient place to do it because it already visits operands.
canAddEdge True if an edge can be added from PredSU to SuccSU without creating a cycle.
clearDAG Clears the DAG state (between regions).
computeCyclicCriticalPath Compute the cyclic critical path through the DAG.
computeDFSResult Compute a DFSResult after DAG building is complete, and before any queue comparisons.
doMBBSchedRegionsTopDown [virtual]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.
dump [virtual]
dumpNode [virtual]
dumpNodeName
end Returns an iterator to the bottom of the current scheduling region.
enterRegion [virtual]Implement the ScheduleDAGInstrs interface for handling the next scheduling region. This covers all instructions in a block, while schedule() may only cover a subset.
exitRegion [virtual]Called when the scheduler has finished scheduling the current region.
finalizeSchedule [virtual]Allow targets to perform final scheduling actions at the level of the whole MachineFunction. By default does nothing.
finishBlock [virtual]
fixupKills Fixes register kill flags that scheduling has made invalid.
getBotPressure Get current register pressure for the bottom scheduled instructions.
getBotRPTracker
getCluster Get the specific cluster, return nullptr for InvalidClusterId.
getClusters Returns the array of the clusters.
getDAGName [virtual]Returns a label for the region of code covered by the DAG.
getDFSResult Return a non-null DFS result if the scheduling strategy initialized it.
getGraphNodeLabel [virtual]Returns a label for a DAG node that points to an instruction.
getInstrDesc Returns the MCInstrDesc of this SUnit. Returns NULL for SDNodes without a machine opcode.
getLIS
getPressureDiff
getRegPressure Get register pressure for the entire scheduling region before scheduling.
getRegionCriticalPSets
getSUnit Returns an existing SUnit for this MI, or nullptr.
getSchedClass Resolves and cache a resolved scheduling class for an SUnit.
getSchedModel Gets the machine model for instruction scheduling.
getScheduledTrees
getTopPressure Get current register pressure for the top scheduled instructions.
getTopRPTracker
hasVRegLiveness [virtual]Return true if this DAG supports VReg liveness and RegPressure.
isTrackingPressure Return true if register pressure tracking is enabled.
moveInstruction Change the position of an instruction within the basic block and update live ranges and region boundary iterators.
newSUnit Creates a new SUnit and return a ptr to it.
schedule [virtual]Implement ScheduleDAGInstrs interface for scheduling a sequence of reorderable instructions.
setDumpDirection
shouldScheduleSingleMIRegions Whether regions with a single MI should be scheduled.
startBlock Prepares to perform scheduling in the given block.
top
viewGraph

Data Members

NameDescription
EntrySU Special node for the region entry.
ExitSU Special node for the region exit.
MF Machine function
MRI Virtual/real register map
SUnits The scheduling units.
StressSched
TII Target instruction information
TM Target processor
TRI Target processor register info

Protected Types

NameDescription
Value2SUsMap A map from ValueType to SUList, used during DAG construction, as a means of remembering which SUs depend on which memory locations.

Protected Type Aliases

Name
DbgValueVector

Protected Member Functions

NameDescription
addBarrierChain Adds barrier chain edges from all SUs in map, and then clear the map. This is equivalent to insertBarrierChain(), but optimized for the common case where the new BarrierChain (a global memory object) has a higher NodeNum than all SUs in map. It is assumed BarrierChain has been set before calling this.
addChainDependencies addChainDependencies overloads
addChainDependency Adds a chain edge between SUa and SUb, but only if both AAResults and Target fail to deny the dependency.
addPhysRegDataDeps
addPhysRegDeps
addVRegDefDeps
addVRegUseDeps
buildDAGWithRegPressure Call ScheduleDAGInstrs::buildSchedGraph with register pressure tracking enabled. 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.
checkSchedLimit
collectVRegUses
deadDefHasNoUse Returns true if the def register in MO has no uses.
dumpNodeAll
dumpSchedule dump the scheduled Sequence.
dumpScheduleTraceBottomUp
dumpScheduleTraceTopDown Print execution trace of the schedule top-down or bottom-up.
findRootsAndBiasEdges
getAAForDep Returns a (possibly null) pointer to the current BatchAAResults.
getLaneMaskForMO Returns a mask for which lanes get read/written by the given (register) machine operand.
initQueues Release ExitSU predecessors and setup scheduler queues. Re-position the Top RP tracker in case the region beginning has changed.
initRegPressure
initSUnits
placeDebugValues Reinsert debug_values recorded in ScheduleDAGInstrs::DbgValues.
postProcessDAG Apply each ScheduleDAGMutation step in order. This allows different instances of ScheduleDAGMI to perform custom DAG postprocessing.
releasePred
releasePredecessors
releaseSucc
releaseSuccessors
scheduleMI Move an instruction and update register pressure.
updatePressureDiffs
updateQueues Update scheduler DAG and queues after scheduling an instruction.
updateScheduledPressure

Protected Data Members

NameDescription
AA
AAForDep
BB The block in which to insert instructions
BarrierChain Remember a generic side-effecting instruction as we proceed. No other SU ever gets scheduled around it (except in the special case of a huge region that gets reduced).
BotPressure The bottom of the unscheduled zone.
BotRPTracker
CanHandleTerminators The standard DAG builder does not normally include terminators as DAG nodes because it does not create the necessary dependencies to prevent reordering. A specialized scheduler can override TargetInstrInfo::isSchedulingBoundary then enable this flag to indicate it has taken responsibility for scheduling the terminator correctly.
Clusters
CurrentBottom The bottom of the unscheduled zone.
CurrentTop The top of the unscheduled zone.
CurrentVRegDefs Tracks the last instruction(s) in this region defining each virtual register. There may be multiple current definitions for a register with disjunct lanemasks.
CurrentVRegUses Tracks the last instructions in this region using each virtual register.
DFSResult Information about DAG subtrees. If DFSResult is NULL, then SchedulerTrees will be empty.
DbgValues Remember instruction that precedes DBG_VALUE. These are generated by buildSchedGraph but persist so they can be referenced when emitting the final schedule.
Defs Defs, Uses - Remember where defs and uses of each register are as we iterate upward through the instructions. This is allocated here instead of inside BuildSchedGraph to avoid the need for it to be initialized and destructed for each block.
DumpDir
FirstDbgValue
LIS
LiveRegionEnd
LiveRegs Set of live physical registers for updating kill flags.
MBFI
MFI
MISUnitMap After calling BuildSchedGraph, each machine instruction in the current scheduling region is mapped to an SUnit.
MLI
MemOpsProcessed
Mutations Ordered list of DAG postprocessing steps.
NumRegionInstrs Instructions in this region (distance(RegionBegin, RegionEnd)).
RPTracker
RegClassInfo
RegPressure
RegionBegin The beginning of the range to be scheduled.
RegionCriticalPSets 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.
RegionEnd The end of the range to be scheduled.
RemoveKillFlags True if the DAG builder should remove kill flags (in preparation for rescheduling).
SUPressureDiffs
SchedImpl
SchedModel TargetSchedModel provides an interface to the machine model.
ScheduleSingleMIRegions True if regions with a single MI should be scheduled.
ScheduledTrees
ShouldTrackLaneMasks
ShouldTrackPressure Register pressure in this region computed by initRegPressure.
TopPressure The top of the unscheduled zone.
TopRPTracker
Topo Topo - A topological ordering for SUnits which permits fast IsReachable and similar queries.
TrackLaneMasks Whether lane masks should get tracked.
UnknownValue For an unanalyzable memory access, this Value is used in maps.
Uses
VRegUses Maps vregs to the SUnits of their uses in the current scheduling region.

Non-Member Functions

NameDescription
createSchedLiveCreate the standard converging machine scheduler. This will be used as the default scheduler if the target does not set a default. Adds default DAG mutations.
fuseInstructionPairCreate an artificial edge between FirstSU and SecondSU. Make data dependencies from the FirstSU also dependent on the SecondSU to prevent them from being scheduled between the FirstSU and the SecondSU and vice-versa. Fusing more than 2 instructions is not currently supported.

Derived Classes

NameDescription
VLIWMachineScheduler Extend the standard ScheduleDAGMILive to provide more context and override the top-level schedule() driver.