LLVM API Documentation

Public Member Functions | Protected Member Functions | Protected Attributes
llvm::ScheduleDAGMILive Class Reference

#include <MachineScheduler.h>

Inheritance diagram for llvm::ScheduleDAGMILive:
Inheritance graph
[legend]
Collaboration diagram for llvm::ScheduleDAGMILive:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ScheduleDAGMILive (MachineSchedContext *C, std::unique_ptr< MachineSchedStrategy > S)
virtual ~ScheduleDAGMILive ()
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 IntervalPressuregetTopPressure () const
 Get current register pressure for the top scheduled instructions.
const RegPressureTrackergetTopRPTracker () const
const IntervalPressuregetBotPressure () const
 Get current register pressure for the bottom scheduled instructions.
const RegPressureTrackergetBotRPTracker () const
const IntervalPressuregetRegPressure () const
 Get register pressure for the entire scheduling region before scheduling.
const std::vector
< PressureChange > & 
getRegionCriticalPSets () const
PressureDiffgetPressureDiff (const SUnit *SU)
void computeDFSResult ()
const SchedDFSResultgetDFSResult () const
 Return a non-null DFS result if the scheduling strategy initialized it.
BitVectorgetScheduledTrees ()
void enterRegion (MachineBasicBlock *bb, MachineBasicBlock::iterator begin, MachineBasicBlock::iterator end, unsigned regioninstrs) override
void schedule () override
unsigned computeCyclicCriticalPath ()
 Compute the cyclic critical path through the DAG.

Protected Member Functions

void buildDAGWithRegPressure ()
 Build the DAG and setup three register pressure trackers.
void scheduleMI (SUnit *SU, bool IsTopNode)
 Move an instruction and update register pressure.
void initRegPressure ()
void updatePressureDiffs (ArrayRef< unsigned > LiveUses)
void updateScheduledPressure (const SUnit *SU, const std::vector< unsigned > &NewMaxPressure)

Protected Attributes

RegisterClassInfoRegClassInfo
SchedDFSResultDFSResult
BitVector ScheduledTrees
MachineBasicBlock::iterator LiveRegionEnd
PressureDiffs SUPressureDiffs
bool ShouldTrackPressure
 Register pressure in this region computed by initRegPressure.
IntervalPressure RegPressure
RegPressureTracker RPTracker
std::vector< PressureChangeRegionCriticalPSets
IntervalPressure TopPressure
 The top of the unscheduled zone.
RegPressureTracker TopRPTracker
IntervalPressure BotPressure
 The bottom of the unscheduled zone.
RegPressureTracker BotRPTracker

Detailed Description

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

Definition at line 347 of file MachineScheduler.h.


Constructor & Destructor Documentation

Definition at line 382 of file MachineScheduler.h.

Definition at line 829 of file MachineScheduler.cpp.

References DFSResult.


Member Function Documentation

Build the DAG and setup three register pressure trackers.

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.

Definition at line 1055 of file MachineScheduler.cpp.

References llvm::ScheduleDAGInstrs::BB, llvm::ScheduleDAGInstrs::buildSchedGraph(), llvm::RegPressureTracker::init(), initRegPressure(), LiveRegionEnd, llvm::RegPressureTracker::recede(), RegClassInfo, RegionCriticalPSets, llvm::ScheduleDAGInstrs::RegionEnd, llvm::RegPressureTracker::reset(), RPTracker, ShouldTrackPressure, and SUPressureDiffs.

Referenced by llvm::VLIWMachineScheduler::schedule(), and schedule().

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 epomymous 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 1114 of file MachineScheduler.cpp.

References llvm::ScheduleDAGInstrs::BB, llvm::ArrayRef< T >::begin(), llvm::dbgs(), DEBUG, llvm::VNInfo::def, llvm::ArrayRef< T >::end(), llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::end(), llvm::ScheduleDAG::ExitSU, llvm::SparseMultiSet< ValueT, KeyFunctorT, SparseT >::find(), llvm::SUnit::getDepth(), llvm::SUnit::getHeight(), llvm::RegPressureTracker::getPressure(), llvm::ScheduleDAGInstrs::getSUnit(), llvm::LiveRange::getVNInfoBefore(), llvm::VNInfo::isPHIDef(), llvm::MachineBasicBlock::isSuccessor(), llvm::TargetRegisterInfo::isVirtualRegister(), llvm::SUnit::Latency, LI, llvm::RegisterPressure::LiveOutRegs, llvm::SUnit::NodeNum, llvm::LiveRange::Query(), RPTracker, llvm::ScheduleDAG::TRI, llvm::LiveQueryResult::valueIn(), and llvm::ScheduleDAGInstrs::VRegUses.

void ScheduleDAGMILive::enterRegion ( MachineBasicBlock bb,
MachineBasicBlock::iterator  begin,
MachineBasicBlock::iterator  end,
unsigned  regioninstrs 
) [override, 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.

enterRegion - Called back from MachineScheduler::runOnMachineFunction after crossing a scheduling boundary. [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.

Definition at line 837 of file MachineScheduler.cpp.

References llvm::PressureDiffs::clear(), llvm::MachineBasicBlock::end(), LiveRegionEnd, llvm::ScheduleDAGInstrs::RegionEnd, llvm::ScheduleDAGMI::SchedImpl, ShouldTrackPressure, and SUPressureDiffs.

Get current register pressure for the bottom scheduled instructions.

Definition at line 402 of file MachineScheduler.h.

References BotPressure.

Return a non-null DFS result if the scheduling strategy initialized it.

Definition at line 421 of file MachineScheduler.h.

References DFSResult.

Definition at line 412 of file MachineScheduler.h.

References llvm::SUnit::NodeNum, and SUPressureDiffs.

Referenced by updatePressureDiffs(), and updateScheduledPressure().

Definition at line 408 of file MachineScheduler.h.

References RegionCriticalPSets.

Referenced by llvm::ConvergingVLIWScheduler::pickNodeFromQueue().

Get register pressure for the entire scheduling region before scheduling.

Definition at line 406 of file MachineScheduler.h.

References RegPressure.

Referenced by llvm::ConvergingVLIWScheduler::pickNodeFromQueue().

Definition at line 423 of file MachineScheduler.h.

References ScheduledTrees.

Get current register pressure for the top scheduled instructions.

Definition at line 398 of file MachineScheduler.h.

References TopPressure.

bool llvm::ScheduleDAGMILive::hasVRegLiveness ( ) const [inline, override, virtual]

Return true if this DAG supports VReg liveness and RegPressure.

Reimplemented from llvm::ScheduleDAGMI.

Definition at line 392 of file MachineScheduler.h.

void ScheduleDAGMILive::initRegPressure ( ) [protected]

Return true if register pressure tracking is enabled.

Definition at line 395 of file MachineScheduler.h.

References ShouldTrackPressure.

void ScheduleDAGMILive::schedule ( ) [override, virtual]

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 easilly 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.

Definition at line 994 of file MachineScheduler.cpp.

References llvm::ScheduleDAGInstrs::begin(), buildDAGWithRegPressure(), llvm::ScheduleDAGMI::checkSchedLimit(), llvm::ScheduleDAGMI::CurrentBottom, llvm::ScheduleDAGMI::CurrentTop, llvm::dbgs(), DEBUG, DFSResult, llvm::ScheduleDAGMI::dumpSchedule(), llvm::ScheduleDAGMI::findRootsAndBiasEdges(), llvm::RegPressureTracker::getPos(), llvm::SchedDFSResult::getSubtreeID(), llvm::ScheduleDAGTopologicalSort::InitDAGTopologicalSorting(), llvm::ScheduleDAGMI::initQueues(), llvm::ScheduleDAGMI::placeDebugValues(), llvm::ScheduleDAGMI::postprocessDAG(), llvm::ScheduleDAGInstrs::RegionBegin, llvm::ScheduleDAGMI::SchedImpl, ScheduledTrees, scheduleMI(), llvm::SchedDFSResult::scheduleTree(), llvm::BitVector::set(), llvm::RegPressureTracker::setPos(), ShouldTrackPressure, llvm::ScheduleDAG::SUnits, llvm::BitVector::test(), llvm::ScheduleDAGMI::Topo, TopRPTracker, llvm::ScheduleDAGMI::updateQueues(), llvm::ScheduleDAGMI::viewGraph(), and ViewMISchedDAGs.

void ScheduleDAGMILive::scheduleMI ( SUnit SU,
bool  IsTopNode 
) [protected]
void ScheduleDAGMILive::updatePressureDiffs ( ArrayRef< unsigned LiveUses) [protected]
void ScheduleDAGMILive::updateScheduledPressure ( const SUnit SU,
const std::vector< unsigned > &  NewMaxPressure 
) [protected]

Member Data Documentation

The bottom of the unscheduled zone.

Definition at line 378 of file MachineScheduler.h.

Referenced by getBotPressure().

Information about DAG subtrees. If DFSResult is NULL, then SchedulerTrees will be empty.

Definition at line 353 of file MachineScheduler.h.

Referenced by computeDFSResult(), getDFSResult(), schedule(), and ~ScheduleDAGMILive().

Definition at line 356 of file MachineScheduler.h.

Referenced by buildDAGWithRegPressure(), enterRegion(), and initRegPressure().

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 371 of file MachineScheduler.h.

Referenced by buildDAGWithRegPressure(), getRegionCriticalPSets(), initRegPressure(), and updateScheduledPressure().

Definition at line 365 of file MachineScheduler.h.

Referenced by getRegPressure().

Definition at line 354 of file MachineScheduler.h.

Referenced by computeDFSResult(), getScheduledTrees(), and schedule().

Register pressure in this region computed by initRegPressure.

Definition at line 364 of file MachineScheduler.h.

Referenced by buildDAGWithRegPressure(), enterRegion(), isTrackingPressure(), schedule(), and scheduleMI().

Definition at line 361 of file MachineScheduler.h.

Referenced by buildDAGWithRegPressure(), enterRegion(), and getPressureDiff().

The top of the unscheduled zone.

Definition at line 374 of file MachineScheduler.h.

Referenced by getTopPressure().

Definition at line 375 of file MachineScheduler.h.

Referenced by getTopRPTracker(), initRegPressure(), schedule(), and scheduleMI().


The documentation for this class was generated from the following files: