LLVM API Documentation

Public Types | Public Member Functions | Public Attributes
llvm::SchedBoundary Class Reference

#include <MachineScheduler.h>

Collaboration diagram for llvm::SchedBoundary:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { TopQID = 1, BotQID = 2, LogMaxQID = 2 }
 SUnit::NodeQueueId: 0 (none), 1 (top), 2 (bot), 3 (both) More...

Public Member Functions

 SchedBoundary (unsigned ID, const Twine &Name)
 ~SchedBoundary ()
void reset ()
void init (ScheduleDAGMI *dag, const TargetSchedModel *smodel, SchedRemainder *rem)
bool isTop () const
unsigned getCurrCycle () const
 Number of cycles to issue the instructions scheduled in this zone.
unsigned getCurrMOps () const
 Micro-ops issued in the current cycle.
bool isNextSU (const SUnit *SU) const
unsigned getDependentLatency () const
unsigned getScheduledLatency () const
unsigned getUnscheduledLatency (SUnit *SU) const
unsigned getResourceCount (unsigned ResIdx) const
unsigned getCriticalCount () const
unsigned getExecutedCount () const
unsigned getZoneCritResIdx () const
bool isResourceLimited () const
unsigned getLatencyStallCycles (SUnit *SU)
unsigned getNextResourceCycle (unsigned PIdx, unsigned Cycles)
bool checkHazard (SUnit *SU)
unsigned findMaxLatency (ArrayRef< SUnit * > ReadySUs)
unsigned getOtherResourceCount (unsigned &OtherCritIdx)
void releaseNode (SUnit *SU, unsigned ReadyCycle)
void releaseTopNode (SUnit *SU)
void releaseBottomNode (SUnit *SU)
void bumpCycle (unsigned NextCycle)
 Move the boundary of scheduled code by one cycle.
void incExecutedResources (unsigned PIdx, unsigned Count)
unsigned countResource (unsigned PIdx, unsigned Cycles, unsigned ReadyCycle)
void bumpNode (SUnit *SU)
 Move the boundary of scheduled code by one SUnit.
void releasePending ()
void removeReady (SUnit *SU)
 Remove SU from the ready set for this boundary.
SUnitpickOnlyChoice ()
void dumpScheduledState ()

Public Attributes

ScheduleDAGMIDAG
const TargetSchedModelSchedModel
SchedRemainderRem
ReadyQueue Available
ReadyQueue Pending
ScheduleHazardRecognizerHazardRec

Detailed Description

Each Scheduling boundary is associated with ready queues. It tracks the current cycle in the direction of movement, and maintains the state of "hazards" and other interlocks at the current cycle.

Definition at line 554 of file MachineScheduler.h.


Member Enumeration Documentation

anonymous enum

SUnit::NodeQueueId: 0 (none), 1 (top), 2 (bot), 3 (both)

Enumerator:
TopQID 
BotQID 
LogMaxQID 

Definition at line 557 of file MachineScheduler.h.


Constructor & Destructor Documentation

llvm::SchedBoundary::SchedBoundary ( unsigned  ID,
const Twine Name 
) [inline]

Pending queues extend the ready queues with the same ID and the PendingFlag set.

Definition at line 633 of file MachineScheduler.h.

References reset().

Definition at line 1569 of file MachineScheduler.cpp.

References HazardRec.


Member Function Documentation

void SchedBoundary::bumpCycle ( unsigned  NextCycle)

Does this SU have a hazard within the current instruction group.

The scheduler supports two modes of hazard recognition. The first is the ScheduleHazardRecognizer API. It is a fully general hazard recognizer that supports highly complicated in-order reservation tables (ScoreboardHazardRecognizer) and arbitraty target-specific logic.

The second is a streamlined mechanism that checks for hazards based on simple counters that the scheduler itself maintains. It explicitly checks for instruction dispatch limitations, including the number of micro-ops that can dispatch per cycle.

TODO: Also check whether the SU must start a new group.

Definition at line 1681 of file MachineScheduler.cpp.

References llvm::dbgs(), DEBUG, llvm::ScheduleHazardRecognizer::getHazardType(), llvm::SUnit::getInstr(), llvm::TargetSchedModel::getIssueWidth(), getNextResourceCycle(), llvm::TargetSchedModel::getNumMicroOps(), llvm::TargetSchedModel::getResourceName(), llvm::ScheduleDAGInstrs::getSchedClass(), llvm::TargetSchedModel::getWriteProcResBegin(), llvm::TargetSchedModel::getWriteProcResEnd(), llvm::TargetSchedModel::hasInstrSchedModel(), llvm::SUnit::hasReservedResource, HazardRec, llvm::ScheduleHazardRecognizer::isEnabled(), llvm::SUnit::NodeNum, llvm::ScheduleHazardRecognizer::NoHazard, llvm::PPCISD::SC, and SchedModel.

Referenced by pickOnlyChoice(), releaseNode(), and releasePending().

unsigned SchedBoundary::countResource ( unsigned  PIdx,
unsigned  Cycles,
unsigned  NextCycle 
)

Add the given processor resource to this scheduled zone.

Parameters:
Cyclesindicates the number of consecutive (non-pipelined) cycles during which this resource is consumed.
Returns:
the next cycle at which the instruction may execute without oversubscribing resources.

Definition at line 1854 of file MachineScheduler.cpp.

References llvm::dbgs(), DEBUG, getCriticalCount(), llvm::TargetSchedModel::getLatencyFactor(), getNextResourceCycle(), llvm::TargetSchedModel::getProcResource(), getResourceCount(), llvm::TargetSchedModel::getResourceFactor(), llvm::TargetSchedModel::getResourceName(), incExecutedResources(), llvm::MCProcResourceDesc::Name, Rem, llvm::SchedRemainder::RemainingCounts, and SchedModel.

Referenced by bumpNode().

Get the scaled count of scheduled micro-ops and resources, including executed resources.

Definition at line 681 of file MachineScheduler.h.

References llvm::TargetSchedModel::getMicroOpFactor(), getResourceCount(), and SchedModel.

Referenced by bumpCycle(), bumpNode(), and countResource().

Number of cycles to issue the instructions scheduled in this zone.

Definition at line 652 of file MachineScheduler.h.

Referenced by llvm::GenericSchedulerBase::setPolicy().

Micro-ops issued in the current cycle.

Definition at line 655 of file MachineScheduler.h.

Referenced by llvm::GenericScheduler::tryCandidate().

Definition at line 662 of file MachineScheduler.h.

Referenced by llvm::GenericSchedulerBase::setPolicy().

Get a scaled count for the minimum execution time of the scheduled micro-ops that are ready to execute by getExecutedCount. Notice the feedback loop.

Definition at line 690 of file MachineScheduler.h.

References llvm::TargetSchedModel::getLatencyFactor(), and SchedModel.

Referenced by dumpScheduledState().

Get the difference between the given SUnit's ready time and the current cycle.

Compute the stall cycles based on this SUnit's ready time. Heuristics treat these "soft stalls" differently than the hard stall cycles based on CPU resources and computed by checkHazard(). A fully in-order model (MicroOpBufferSize==0) will not make use of this since instructions are not available for scheduling until they are ready. However, a weaker in-order model may use this for heuristics. For example, if a processor has in-order behavior when reading certain resources, this may come into play.

Definition at line 1644 of file MachineScheduler.cpp.

References llvm::SUnit::BotReadyCycle, isTop(), llvm::SUnit::isUnbuffered, and llvm::SUnit::TopReadyCycle.

Referenced by llvm::GenericScheduler::tryCandidate().

Compute the next cycle at which the given processor resource can be scheduled.

Definition at line 1657 of file MachineScheduler.cpp.

References InvalidCycle, and isTop().

Referenced by bumpNode(), checkHazard(), and countResource().

Get the number of latency cycles "covered" by the scheduled instructions. This is the larger of the critical path within the zone and the number of cycles required to issue the instructions.

Definition at line 667 of file MachineScheduler.h.

Referenced by bumpCycle(), bumpNode(), and tryLatency().

Definition at line 671 of file MachineScheduler.h.

References llvm::SUnit::getDepth(), llvm::SUnit::getHeight(), and isTop().

Referenced by findMaxLatency().

Definition at line 695 of file MachineScheduler.h.

Referenced by llvm::GenericSchedulerBase::setPolicy().

Definition at line 1840 of file MachineScheduler.cpp.

Referenced by countResource().

void SchedBoundary::init ( ScheduleDAGMI dag,
const TargetSchedModel smodel,
SchedRemainder rem 
)
bool llvm::SchedBoundary::isNextSU ( const SUnit SU) const [inline]

Return true if the given SU is used by the most recently scheduled instruction.

Definition at line 659 of file MachineScheduler.h.

References llvm::SmallPtrSetImpl< PtrType >::count().

Referenced by llvm::GenericScheduler::tryCandidate().

Definition at line 698 of file MachineScheduler.h.

Referenced by llvm::GenericSchedulerBase::setPolicy().

bool llvm::SchedBoundary::isTop ( ) const [inline]

Call this before applying any other heuristics to the Available queue. Updates the Available/Pending Q's if necessary and returns the single available instruction, or NULL if there are multiple candidates.

If this queue only has one ready candidate, return it. As a side effect, defer any nodes that now hit a hazard, and advance the cycle until at least one node is ready. If multiple instructions are ready, return NULL.

Definition at line 2056 of file MachineScheduler.cpp.

References Available, llvm::ReadyQueue::begin(), bumpCycle(), checkHazard(), llvm::ReadyQueue::empty(), llvm::ReadyQueue::end(), I, Pending, llvm::ReadyQueue::push(), releasePending(), llvm::ReadyQueue::remove(), and llvm::ReadyQueue::size().

void SchedBoundary::releaseNode ( SUnit SU,
unsigned  ReadyCycle 
)

Remove SU from the ready set for this boundary.

Definition at line 2044 of file MachineScheduler.cpp.

References Available, llvm::ReadyQueue::find(), llvm::ReadyQueue::isInQueue(), Pending, and llvm::ReadyQueue::remove().


Member Data Documentation

Definition at line 563 of file MachineScheduler.h.

Definition at line 570 of file MachineScheduler.h.

Referenced by bumpCycle(), bumpNode(), checkHazard(), reset(), and ~SchedBoundary().

Definition at line 565 of file MachineScheduler.h.

Referenced by bumpNode(), countResource(), getOtherResourceCount(), and init().


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