LLVM API Documentation

Public Types | Public Member Functions
llvm::TargetSchedModel Class Reference

Provide an instruction scheduling machine model to CodeGen passes. More...

#include <TargetSchedule.h>

List of all members.

Public Types

typedef const MCWriteProcResEntryProcResIter

Public Member Functions

 TargetSchedModel ()
void init (const MCSchedModel &sm, const TargetSubtargetInfo *sti, const TargetInstrInfo *tii)
 Initialize the machine model for instruction scheduling.
const MCSchedClassDescresolveSchedClass (const MachineInstr *MI) const
 Return the MCSchedClassDesc for this instruction.
const TargetInstrInfogetInstrInfo () const
 TargetInstrInfo getter.
bool hasInstrSchedModel () const
 Return true if this machine model includes an instruction-level scheduling model.
const MCSchedModelgetMCSchedModel () const
bool hasInstrItineraries () const
 Return true if this machine model includes cycle-to-cycle itinerary data.
const InstrItineraryDatagetInstrItineraries () const
unsigned getProcessorID () const
 Identify the processor corresponding to the current subtarget.
unsigned getIssueWidth () const
 Maximum number of micro-ops that may be scheduled per cycle.
unsigned getNumMicroOps (const MachineInstr *MI, const MCSchedClassDesc *SC=nullptr) const
 Return the number of issue slots required for this MI.
unsigned getNumProcResourceKinds () const
 Get the number of kinds of resources for this target.
const MCProcResourceDescgetProcResource (unsigned PIdx) const
 Get a processor resource by ID for convenience.
const char * getResourceName (unsigned PIdx) const
ProcResIter getWriteProcResBegin (const MCSchedClassDesc *SC) const
ProcResIter getWriteProcResEnd (const MCSchedClassDesc *SC) const
unsigned getResourceFactor (unsigned ResIdx) const
 Multiply the number of units consumed for a resource by this factor to normalize it relative to other resources.
unsigned getMicroOpFactor () const
 Multiply number of micro-ops by this factor to normalize it relative to other resources.
unsigned getLatencyFactor () const
 Multiply cycle count by this factor to normalize it relative to other resources. This is the number of resource units per cycle.
unsigned getMicroOpBufferSize () const
 Number of micro-ops that may be buffered for OOO execution.
int getResourceBufferSize (unsigned PIdx) const
 Number of resource units that may be buffered for OOO execution.
unsigned computeOperandLatency (const MachineInstr *DefMI, unsigned DefOperIdx, const MachineInstr *UseMI, unsigned UseOperIdx) const
 Compute operand latency based on the available machine model.
unsigned computeInstrLatency (const MachineInstr *MI, bool UseDefaultDefLatency=true) const
 Compute the instruction latency based on the available machine model.
unsigned computeInstrLatency (unsigned Opcode) const
unsigned computeOutputLatency (const MachineInstr *DefMI, unsigned DefIdx, const MachineInstr *DepMI) const
 Output dependency latency of a pair of defs of the same register.

Detailed Description

Provide an instruction scheduling machine model to CodeGen passes.

Definition at line 32 of file TargetSchedule.h.


Member Typedef Documentation

Definition at line 109 of file TargetSchedule.h.


Constructor & Destructor Documentation

Definition at line 44 of file TargetSchedule.h.


Member Function Documentation

unsigned TargetSchedModel::computeInstrLatency ( const MachineInstr MI,
bool  UseDefaultDefLatency = true 
) const

Compute the instruction latency based on the available machine model.

Compute and return the expected latency of this instruction independent of a particular use. computeOperandLatency is the preferred API, but this is occasionally useful to help estimate instruction cost.

If UseDefaultDefLatency is false and no new machine sched model is present this method falls back to TII->getInstrLatency with an empty instruction itinerary (this is so we preserve the previous behavior of the if converter after moving it to TargetSchedModel).

Definition at line 251 of file TargetSchedule.cpp.

References capLatency(), llvm::MCWriteLatencyEntry::Cycles, llvm::TargetInstrInfo::defaultDefLatency(), llvm::TargetInstrInfo::getInstrLatency(), llvm::MCSubtargetInfo::getWriteLatencyEntry(), hasInstrItineraries(), hasInstrSchedModel(), llvm::MachineInstr::isBundle(), llvm::MCSchedClassDesc::isValid(), llvm::MCSchedClassDesc::NumWriteLatencyEntries, and resolveSchedClass().

Referenced by computeOutputLatency(), and llvm::ScheduleDAGInstrs::initSUnits().

unsigned TargetSchedModel::computeOperandLatency ( const MachineInstr DefMI,
unsigned  DefOperIdx,
const MachineInstr UseMI,
unsigned  UseOperIdx 
) const

TargetInstrInfo getter.

Definition at line 58 of file TargetSchedule.h.

Maximum number of micro-ops that may be scheduled per cycle.

Definition at line 85 of file TargetSchedule.h.

References llvm::MCSchedModel::IssueWidth.

Referenced by llvm::SchedBoundary::bumpCycle(), llvm::SchedBoundary::bumpNode(), llvm::SchedBoundary::checkHazard(), and llvm::VLIWResourceModel::reserveResources().

Multiply cycle count by this factor to normalize it relative to other resources. This is the number of resource units per cycle.

Definition at line 135 of file TargetSchedule.h.

Referenced by llvm::SchedBoundary::bumpCycle(), llvm::SchedBoundary::bumpNode(), llvm::GenericScheduler::checkAcyclicLatency(), llvm::SchedBoundary::countResource(), llvm::SchedBoundary::dumpScheduledState(), llvm::SchedBoundary::getExecutedCount(), and llvm::GenericSchedulerBase::setPolicy().

Definition at line 67 of file TargetSchedule.h.

Identify the processor corresponding to the current subtarget.

Definition at line 82 of file TargetSchedule.h.

References llvm::MCSchedModel::getProcessorID().

Number of resource units that may be buffered for OOO execution.

Returns:
The buffer size in resource units or -1 for unlimited.

Definition at line 144 of file TargetSchedule.h.

References llvm::MCProcResourceDesc::BufferSize, and llvm::MCSchedModel::getProcResource().

Multiply the number of units consumed for a resource by this factor to normalize it relative to other resources.

Definition at line 123 of file TargetSchedule.h.

Referenced by llvm::SchedBoundary::countResource(), llvm::SchedBoundary::dumpScheduledState(), llvm::SchedBoundary::getOtherResourceCount(), llvm::MachineTraceMetrics::getResources(), and llvm::SchedRemainder::init().

const char* llvm::TargetSchedModel::getResourceName ( unsigned  PIdx) const [inline]

Return true if this machine model includes cycle-to-cycle itinerary data.

This models scheduling at each stage in the processor pipeline.

Definition at line 35 of file TargetSchedule.cpp.

References EnableSchedItins, and llvm::InstrItineraryData::isEmpty().

Referenced by computeInstrLatency(), computeOperandLatency(), getInstrItineraries(), and getNumMicroOps().

Initialize the machine model for instruction scheduling.

The machine model API keeps a copy of the top-level MCSchedModel table indices and may query TargetSubtargetInfo and TargetInstrInfo to resolve dynamic properties.

Definition at line 54 of file TargetSchedule.cpp.

References llvm::MCSchedModel::getNumProcResourceKinds(), llvm::MCSchedModel::getProcResource(), llvm::MCSubtargetInfo::initInstrItins(), llvm::MCSchedModel::IssueWidth, lcm(), llvm::MCProcResourceDesc::NumUnits, and llvm::SmallVectorImpl< T >::resize().

Referenced by llvm::MachineTraceMetrics::runOnMachineFunction(), and llvm::ScheduleDAGInstrs::ScheduleDAGInstrs().


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