class TargetSchedModel

Declaration

class TargetSchedModel { /* full declaration omitted */ };

Description

Provide an instruction scheduling machine model to CodeGen passes.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:31

Method Overview

Methods

TargetSchedModel()

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:50

unsigned int computeInstrLatency(
    const llvm::MachineInstr* MI,
    bool UseDefaultDefLatency = true) const

Description

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

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:189

Parameters

const llvm::MachineInstr* MI
bool UseDefaultDefLatency = true

unsigned int computeInstrLatency(
    const llvm::MCInst& Inst) const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:191

Parameters

const llvm::MCInst& Inst

unsigned int computeInstrLatency(
    unsigned int Opcode) const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:192

Parameters

unsigned int Opcode

unsigned int computeOperandLatency(
    const llvm::MachineInstr* DefMI,
    unsigned int DefOperIdx,
    const llvm::MachineInstr* UseMI,
    unsigned int UseOperIdx) const

Description

Compute operand latency based on the available machine model. Compute and return the latency of the given data dependent def and use when the operand indices are already known. UseMI may be NULL for an unknown user.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:174

Parameters

const llvm::MachineInstr* DefMI
unsigned int DefOperIdx
const llvm::MachineInstr* UseMI
unsigned int UseOperIdx

unsigned int computeOutputLatency(
    const llvm::MachineInstr* DefMI,
    unsigned int DefOperIdx,
    const llvm::MachineInstr* DepMI) const

Description

Output dependency latency of a pair of defs of the same register. This is typically one cycle.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:198

Parameters

const llvm::MachineInstr* DefMI
unsigned int DefOperIdx
const llvm::MachineInstr* DepMI

double computeReciprocalThroughput(
    unsigned int Opcode) const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:204

Parameters

unsigned int Opcode

double computeReciprocalThroughput(
    const llvm::MachineInstr* MI) const

Description

Compute the reciprocal throughput of the given instruction.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:202

Parameters

const llvm::MachineInstr* MI

double computeReciprocalThroughput(
    const llvm::MCInst& MI) const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:203

Parameters

const llvm::MCInst& MI

const llvm::TargetInstrInfo* getInstrInfo() const

Description

TargetInstrInfo getter.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:66

const llvm::InstrItineraryData*
getInstrItineraries() const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:83

unsigned int getIssueWidth() const

Description

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

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:99

unsigned int getLatencyFactor() const

Description

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

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:156

const llvm::MCSchedModel* getMCSchedModel() const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:75

unsigned int getMicroOpBufferSize() const

Description

Number of micro-ops that may be buffered for OOO execution.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:161

unsigned int getMicroOpFactor() const

Description

Multiply number of micro-ops by this factor to normalize it relative to other resources.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:150

unsigned int getNumMicroOps(
    const llvm::MachineInstr* MI,
    const llvm::MCSchedClassDesc* SC =
        nullptr) const

Description

Return the number of issue slots required for this MI.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:109

Parameters

const llvm::MachineInstr* MI
const llvm::MCSchedClassDesc* SC = nullptr

unsigned int getNumProcResourceKinds() const

Description

Get the number of kinds of resources for this target.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:113

const llvm::MCProcResourceDesc* getProcResource(
    unsigned int PIdx) const

Description

Get a processor resource by ID for convenience.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:118

Parameters

unsigned int PIdx

unsigned int getProcessorID() const

Description

Identify the processor corresponding to the current subtarget.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:96

int getResourceBufferSize(unsigned int PIdx) const

Description

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

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:165

Parameters

unsigned int PIdx

Returns

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

unsigned int getResourceFactor(
    unsigned int ResIdx) const

Description

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

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:144

Parameters

unsigned int ResIdx

const char* getResourceName(
    unsigned int PIdx) const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:123

Parameters

unsigned int PIdx

const llvm::TargetSubtargetInfo*
getSubtargetInfo() const

Description

TargetSubtargetInfo getter.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:63

llvm::TargetSchedModel::ProcResIter
getWriteProcResBegin(
    const llvm::MCSchedClassDesc* SC) const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:134

Parameters

const llvm::MCSchedClassDesc* SC

llvm::TargetSchedModel::ProcResIter
getWriteProcResEnd(
    const llvm::MCSchedClassDesc* SC) const

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:138

Parameters

const llvm::MCSchedClassDesc* SC

bool hasInstrItineraries() const

Description

Return true if this machine model includes cycle-to-cycle itinerary data. This models scheduling at each stage in the processor pipeline.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:81

bool hasInstrSchedModel() const

Description

Return true if this machine model includes an instruction-level scheduling model. This is more detailed than the course grain IssueWidth and default latency properties, but separate from the per-cycle itinerary data.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:73

bool hasInstrSchedModelOrItineraries() const

Description

Return true if this machine model includes an instruction-level scheduling model or cycle-to-cycle itinerary data.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:91

void init(const llvm::TargetSubtargetInfo* TSInfo)

Description

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.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:57

Parameters

const llvm::TargetSubtargetInfo* TSInfo

bool mustBeginGroup(const llvm::MachineInstr* MI,
                    const llvm::MCSchedClassDesc*
                        SC = nullptr) const

Description

Return true if new group must begin.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:102

Parameters

const llvm::MachineInstr* MI
const llvm::MCSchedClassDesc* SC = nullptr

bool mustEndGroup(const llvm::MachineInstr* MI,
                  const llvm::MCSchedClassDesc*
                      SC = nullptr) const

Description

Return true if current group must end.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:105

Parameters

const llvm::MachineInstr* MI
const llvm::MCSchedClassDesc* SC = nullptr

const llvm::MCSchedClassDesc* resolveSchedClass(
    const llvm::MachineInstr* MI) const

Description

Return the MCSchedClassDesc for this instruction.

Declared at: llvm/include/llvm/CodeGen/TargetSchedule.h:60

Parameters

const llvm::MachineInstr* MI