class BasicTTIImplBase

Declaration

template <typename T>
class BasicTTIImplBase { /* full declaration omitted */ };

Description

Base class which can be used to help build a TTI implementation. This class provides as much implementation of the TTI interface as is possible using the target independent parts of the code generator. In order to subclass it, your class must implement a getST() method to return the subtarget, and a getTLI() method to return the target lowering. We need these methods implemented in the derived class so that this class doesn't have to duplicate storage for them.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:77

Templates

T

Method Overview

  • protected BasicTTIImplBase<T>(const llvm::TargetMachine * TM, const llvm::DataLayout & DL)
  • public unsigned int adjustInliningThreshold(const llvm::CallBase * CB)
  • public bool allowsMisalignedMemoryAccesses(llvm::LLVMContext & Context, unsigned int BitWidth, unsigned int AddressSpace, llvm::Align Alignment, bool * Fast) const
  • public bool collectFlatAddressOperands(SmallVectorImpl<int> & OpIndexes, Intrinsic::ID IID) const
  • public llvm::PredicationStyle emitGetActiveLaneMask()
  • public virtual bool enableWritePrefetching() const
  • public llvm::InstructionCost getAddressComputationCost(llvm::Type * Ty, llvm::ScalarEvolution *, const llvm::SCEV *)
  • public llvm::InstructionCost getArithmeticInstrCost(unsigned int Opcode, llvm::Type * Ty, TTI::TargetCostKind CostKind, TTI::OperandValueKind Opd1Info = TargetTransformInfo::OK_AnyValue, TTI::OperandValueKind Opd2Info = TargetTransformInfo::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo = TargetTransformInfo::OP_None, TTI::OperandValueProperties Opd2PropInfo = TargetTransformInfo::OP_None, ArrayRef<const llvm::Value *> Args = llvm::ArrayRef<const llvm::Value *>(), const llvm::Instruction * CxtI = nullptr)
  • public llvm::InstructionCost getArithmeticReductionCost(unsigned int Opcode, llvm::VectorType * Ty, Optional<llvm::FastMathFlags> FMF, TTI::TargetCostKind CostKind)
  • public unsigned int getAssumedAddrSpace(const llvm::Value * V) const
  • private llvm::InstructionCost getBroadcastShuffleOverhead(llvm::FixedVectorType * VTy)
  • public llvm::InstructionCost getCFInstrCost(unsigned int Opcode, TTI::TargetCostKind CostKind, const llvm::Instruction * I = nullptr)
  • public virtual Optional<unsigned int> getCacheAssociativity(TargetTransformInfo::CacheLevel Level) const
  • public virtual unsigned int getCacheLineSize() const
  • public virtual Optional<unsigned int> getCacheSize(TargetTransformInfo::CacheLevel Level) const
  • public llvm::InstructionCost getCallInstrCost(llvm::Function * F, llvm::Type * RetTy, ArrayRef<llvm::Type *> Tys, TTI::TargetCostKind CostKind)
  • public llvm::InstructionCost getCastInstrCost(unsigned int Opcode, llvm::Type * Dst, llvm::Type * Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const llvm::Instruction * I = nullptr)
  • public llvm::InstructionCost getCmpSelInstrCost(unsigned int Opcode, llvm::Type * ValTy, llvm::Type * CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const llvm::Instruction * I = nullptr)
  • private llvm::InstructionCost getCommonMaskedMemoryOpCost(unsigned int Opcode, llvm::Type * DataTy, llvm::Align Alignment, bool VariableMask, bool IsGatherScatter, TTI::TargetCostKind CostKind)
  • public unsigned int getEstimatedNumberOfCaseClusters(const llvm::SwitchInst & SI, unsigned int & JumpTableSize, llvm::ProfileSummaryInfo * PSI, llvm::BlockFrequencyInfo * BFI)
  • public llvm::InstructionCost getExtendedAddReductionCost(bool IsMLA, bool IsUnsigned, llvm::Type * ResTy, llvm::VectorType * Ty, TTI::TargetCostKind CostKind)
  • private llvm::InstructionCost getExtractSubvectorOverhead(llvm::VectorType * VTy, int Index, llvm::FixedVectorType * SubVTy)
  • public llvm::InstructionCost getExtractWithExtendCost(unsigned int Opcode, llvm::Type * Dst, llvm::VectorType * VecTy, unsigned int Index)
  • public llvm::InstructionCost getFPOpCost(llvm::Type * Ty)
  • public unsigned int getFlatAddressSpace()
  • public llvm::InstructionCost getGEPCost(llvm::Type * PointeeType, const llvm::Value * Ptr, ArrayRef<const llvm::Value *> Operands, TTI::TargetCostKind CostKind)
  • public llvm::InstructionCost getGatherScatterOpCost(unsigned int Opcode, llvm::Type * DataTy, const llvm::Value * Ptr, bool VariableMask, llvm::Align Alignment, TTI::TargetCostKind CostKind, const llvm::Instruction * I = nullptr)
  • private static ISD::MemIndexedMode getISDIndexedMode(TTI::MemIndexedMode M)
  • public int getInlinerVectorBonusPercent()
  • public unsigned int getInliningThresholdMultiplier()
  • private llvm::InstructionCost getInsertSubvectorOverhead(llvm::VectorType * VTy, int Index, llvm::FixedVectorType * SubVTy)
  • public llvm::InstructionCost getInstructionLatency(const llvm::Instruction * I)
  • public llvm::InstructionCost getInterleavedMemoryOpCost(unsigned int Opcode, llvm::Type * VecTy, unsigned int Factor, ArrayRef<unsigned int> Indices, llvm::Align Alignment, unsigned int AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond = false, bool UseMaskForGaps = false)
  • public llvm::InstructionCost getIntrinsicInstrCost(const llvm::IntrinsicCostAttributes & ICA, TTI::TargetCostKind CostKind)
  • public llvm::InstructionCost getMaskedMemoryOpCost(unsigned int Opcode, llvm::Type * DataTy, llvm::Align Alignment, unsigned int AddressSpace, TTI::TargetCostKind CostKind)
  • public unsigned int getMaxInterleaveFactor(unsigned int VF)
  • public virtual unsigned int getMaxPrefetchIterationsAhead() const
  • public Optional<unsigned int> getMaxVScale() const
  • public llvm::InstructionCost getMemoryOpCost(unsigned int Opcode, llvm::Type * Src, llvm::MaybeAlign Alignment, unsigned int AddressSpace, TTI::TargetCostKind CostKind, const llvm::Instruction * I = nullptr)
  • public llvm::InstructionCost getMinMaxReductionCost(llvm::VectorType * Ty, llvm::VectorType * CondTy, bool IsUnsigned, TTI::TargetCostKind CostKind)
  • public virtual unsigned int getMinPrefetchStride(unsigned int NumMemAccesses, unsigned int NumStridedMemAccesses, unsigned int NumPrefetches, bool HasCall) const
  • public unsigned int getNumberOfParts(llvm::Type * Tp)
  • public llvm::InstructionCost getOperandsScalarizationOverhead(ArrayRef<const llvm::Value *> Args, ArrayRef<llvm::Type *> Tys)
  • public llvm::InstructionCost getOrderedReductionCost(unsigned int Opcode, llvm::VectorType * Ty, TTI::TargetCostKind CostKind)
  • public void getPeelingPreferences(llvm::Loop * L, llvm::ScalarEvolution & SE, TTI::PeelingPreferences & PP)
  • private llvm::InstructionCost getPermuteShuffleOverhead(llvm::FixedVectorType * VTy)
  • public std::pair<const Value *, unsigned int> getPredicatedAddrSpace(const llvm::Value * V) const
  • public virtual unsigned int getPrefetchDistance() const
  • public unsigned int getRegUsageForType(llvm::Type * Ty)
  • public llvm::TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
  • public llvm::InstructionCost getReplicationShuffleCost(llvm::Type * EltTy, int ReplicationFactor, int VF, const llvm::APInt & DemandedDstElts, TTI::TargetCostKind CostKind)
  • private const llvm::TargetSubtargetInfo * getST() const
  • public llvm::InstructionCost getScalarizationOverhead(llvm::VectorType * InTy, bool Insert, bool Extract)
  • public llvm::InstructionCost getScalarizationOverhead(llvm::VectorType * InTy, const llvm::APInt & DemandedElts, bool Insert, bool Extract)
  • public llvm::InstructionCost getScalarizationOverhead(llvm::VectorType * RetTy, ArrayRef<const llvm::Value *> Args, ArrayRef<llvm::Type *> Tys)
  • public llvm::InstructionCost getScalingFactorCost(llvm::Type * Ty, llvm::GlobalValue * BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned int AddrSpace)
  • public llvm::InstructionCost getShuffleCost(TTI::ShuffleKind Kind, llvm::VectorType * Tp, ArrayRef<int> Mask, int Index, llvm::VectorType * SubTp, ArrayRef<const llvm::Value *> Args = None)
  • public unsigned int getStoreMinimumVF(unsigned int VF, llvm::Type * ScalarMemTy, llvm::Type * ScalarValTy) const
  • private const llvm::TargetLoweringBase * getTLI() const
  • public llvm::InstructionCost getTreeReductionCost(unsigned int Opcode, llvm::VectorType * Ty, TTI::TargetCostKind CostKind)
  • public llvm::InstructionCost getTypeBasedIntrinsicInstrCost(const llvm::IntrinsicCostAttributes & ICA, TTI::TargetCostKind CostKind)
  • public void getUnrollingPreferences(llvm::Loop * L, llvm::ScalarEvolution & SE, TTI::UnrollingPreferences & UP, llvm::OptimizationRemarkEmitter * ORE)
  • public Optional<unsigned int> getVScaleForTuning() const
  • public llvm::InstructionCost getVectorInstrCost(unsigned int Opcode, llvm::Type * Val, unsigned int Index)
  • public llvm::InstructionCost getVectorSplitCost()
  • public bool hasBranchDivergence()
  • public bool haveFastSqrt(llvm::Type * Ty)
  • public TTI::ShuffleKind improveShuffleKindFromMask(TTI::ShuffleKind Kind, ArrayRef<int> Mask) const
  • public Optional<llvm::Instruction *> instCombineIntrinsic(llvm::InstCombiner & IC, llvm::IntrinsicInst & II)
  • public bool isAlwaysUniform(const llvm::Value * V)
  • public bool isFCmpOrdCheaperThanFCmpZero(llvm::Type * Ty)
  • public bool isHardwareLoopProfitable(llvm::Loop * L, llvm::ScalarEvolution & SE, llvm::AssumptionCache & AC, llvm::TargetLibraryInfo * LibInfo, llvm::HardwareLoopInfo & HWLoopInfo)
  • public bool isIndexedLoadLegal(TTI::MemIndexedMode M, llvm::Type * Ty, const llvm::DataLayout & DL) const
  • public bool isIndexedStoreLegal(TTI::MemIndexedMode M, llvm::Type * Ty, const llvm::DataLayout & DL) const
  • public bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2)
  • public bool isLegalAddImmediate(int64_t imm)
  • public bool isLegalAddressingMode(llvm::Type * Ty, llvm::GlobalValue * BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned int AddrSpace, llvm::Instruction * I = nullptr)
  • public bool isLegalICmpImmediate(int64_t imm)
  • public bool isNoopAddrSpaceCast(unsigned int FromAS, unsigned int ToAS) const
  • public bool isNumRegsMajorCostOfLSR()
  • public bool isProfitableLSRChainElement(llvm::Instruction * I)
  • public bool isProfitableToHoist(llvm::Instruction * I)
  • public bool isSourceOfDivergence(const llvm::Value * V)
  • public bool isTruncateFree(llvm::Type * Ty1, llvm::Type * Ty2)
  • public bool isTypeLegal(llvm::Type * Ty)
  • public bool preferPredicateOverEpilogue(llvm::Loop * L, llvm::LoopInfo * LI, llvm::ScalarEvolution & SE, llvm::AssumptionCache & AC, llvm::TargetLibraryInfo * TLI, llvm::DominatorTree * DT, llvm::LoopVectorizationLegality * LVL)
  • public llvm::Value * rewriteIntrinsicWithAddressSpace(llvm::IntrinsicInst * II, llvm::Value * OldV, llvm::Value * NewV) const
  • public bool shouldBuildLookupTables()
  • public bool shouldBuildRelLookupTables() const
  • public Optional<llvm::Value *> simplifyDemandedUseBitsIntrinsic(llvm::InstCombiner & IC, llvm::IntrinsicInst & II, llvm::APInt DemandedMask, llvm::KnownBits & Known, bool & KnownBitsComputed)
  • public Optional<llvm::Value *> simplifyDemandedVectorEltsIntrinsic(llvm::InstCombiner & IC, llvm::IntrinsicInst & II, llvm::APInt DemandedElts, llvm::APInt & UndefElts, llvm::APInt & UndefElts2, llvm::APInt & UndefElts3, std::function<void (Instruction *, unsigned int, APInt, APInt &)> SimplifyAndSetOp)
  • private T * thisT()
  • public bool useAA() const
  • public bool useGPUDivergenceAnalysis()
  • protected virtual ~BasicTTIImplBase<T>()

Methods

BasicTTIImplBase<T>(const llvm::TargetMachine* TM,
                    const llvm::DataLayout& DL)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:247

Parameters

const llvm::TargetMachine* TM
const llvm::DataLayout& DL

unsigned int adjustInliningThreshold(
    const llvm::CallBase* CB)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:512

Parameters

const llvm::CallBase* CB

bool allowsMisalignedMemoryAccesses(
    llvm::LLVMContext& Context,
    unsigned int BitWidth,
    unsigned int AddressSpace,
    llvm::Align Alignment,
    bool* Fast) const

Description

@ {

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:256

Parameters

llvm::LLVMContext& Context
unsigned int BitWidth
unsigned int AddressSpace
llvm::Align Alignment
bool* Fast

bool collectFlatAddressOperands(
    SmallVectorImpl<int>& OpIndexes,
    Intrinsic::ID IID) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:277

Parameters

SmallVectorImpl<int>& OpIndexes
Intrinsic::ID IID

llvm::PredicationStyle emitGetActiveLaneMask()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:610

virtual bool enableWritePrefetching() const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:682

llvm::InstructionCost getAddressComputationCost(
    llvm::Type* Ty,
    llvm::ScalarEvolution*,
    const llvm::SCEV*)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2126

Parameters

llvm::Type* Ty
llvm::ScalarEvolution*
const llvm::SCEV*

llvm::InstructionCost getArithmeticInstrCost(
    unsigned int Opcode,
    llvm::Type* Ty,
    TTI::TargetCostKind CostKind,
    TTI::OperandValueKind Opd1Info =
        TargetTransformInfo::OK_AnyValue,
    TTI::OperandValueKind Opd2Info =
        TargetTransformInfo::OK_AnyValue,
    TTI::OperandValueProperties Opd1PropInfo =
        TargetTransformInfo::OP_None,
    TTI::OperandValueProperties Opd2PropInfo =
        TargetTransformInfo::OP_None,
    ArrayRef<const llvm::Value*> Args =
        llvm::ArrayRef<const llvm::Value*>(),
    const llvm::Instruction* CxtI = nullptr)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:784

Parameters

unsigned int Opcode
llvm::Type* Ty
TTI::TargetCostKind CostKind
TTI::OperandValueKind Opd1Info = TargetTransformInfo::OK_AnyValue
TTI::OperandValueKind Opd2Info = TargetTransformInfo::OK_AnyValue
TTI::OperandValueProperties Opd1PropInfo = TargetTransformInfo::OP_None
TTI::OperandValueProperties Opd2PropInfo = TargetTransformInfo::OP_None
ArrayRef<const llvm::Value*> Args = llvm::ArrayRef<const llvm::Value *>()
const llvm::Instruction* CxtI = nullptr

llvm::InstructionCost getArithmeticReductionCost(
    unsigned int Opcode,
    llvm::VectorType* Ty,
    Optional<llvm::FastMathFlags> FMF,
    TTI::TargetCostKind CostKind)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2244

Parameters

unsigned int Opcode
llvm::VectorType* Ty
Optional<llvm::FastMathFlags> FMF
TTI::TargetCostKind CostKind

unsigned int getAssumedAddrSpace(
    const llvm::Value* V) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:286

Parameters

const llvm::Value* V

llvm::InstructionCost getBroadcastShuffleOverhead(
    llvm::FixedVectorType* VTy)

Description

Estimate a cost of Broadcast as an extract and sequence of insert operations.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:87

Parameters

llvm::FixedVectorType* VTy

llvm::InstructionCost getCFInstrCost(
    unsigned int Opcode,
    TTI::TargetCostKind CostKind,
    const llvm::Instruction* I = nullptr)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1093

Parameters

unsigned int Opcode
TTI::TargetCostKind CostKind
const llvm::Instruction* I = nullptr

virtual Optional<unsigned int>
getCacheAssociativity(
    TargetTransformInfo::CacheLevel Level) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:652

Parameters

TargetTransformInfo::CacheLevel Level

virtual unsigned int getCacheLineSize() const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:662

virtual Optional<unsigned int> getCacheSize(
    TargetTransformInfo::CacheLevel Level) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:646

Parameters

TargetTransformInfo::CacheLevel Level

llvm::InstructionCost getCallInstrCost(
    llvm::Function* F,
    llvm::Type* RetTy,
    ArrayRef<llvm::Type*> Tys,
    TTI::TargetCostKind CostKind)

Description

Compute a cost of the given call instruction. Compute the cost of calling function F with return type RetTy and argument types Tys. F might be nullptr, in this case the cost of an arbitrary call with the specified signature will be returned. This is used, for instance, when we estimate call of a vector counterpart of the given function.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2114

Parameters

llvm::Function* F
Called function, might be nullptr.
llvm::Type* RetTy
Return value types.
ArrayRef<llvm::Type*> Tys
Argument types.
TTI::TargetCostKind CostKind

Returns

The cost of Call instruction.

llvm::InstructionCost getCastInstrCost(
    unsigned int Opcode,
    llvm::Type* Dst,
    llvm::Type* Src,
    TTI::CastContextHint CCH,
    TTI::TargetCostKind CostKind,
    const llvm::Instruction* I = nullptr)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:928

Parameters

unsigned int Opcode
llvm::Type* Dst
llvm::Type* Src
TTI::CastContextHint CCH
TTI::TargetCostKind CostKind
const llvm::Instruction* I = nullptr

llvm::InstructionCost getCmpSelInstrCost(
    unsigned int Opcode,
    llvm::Type* ValTy,
    llvm::Type* CondTy,
    CmpInst::Predicate VecPred,
    TTI::TargetCostKind CostKind,
    const llvm::Instruction* I = nullptr)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1098

Parameters

unsigned int Opcode
llvm::Type* ValTy
llvm::Type* CondTy
CmpInst::Predicate VecPred
TTI::TargetCostKind CostKind
const llvm::Instruction* I = nullptr

llvm::InstructionCost getCommonMaskedMemoryOpCost(
    unsigned int Opcode,
    llvm::Type* DataTy,
    llvm::Align Alignment,
    bool VariableMask,
    bool IsGatherScatter,
    TTI::TargetCostKind CostKind)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:193

Parameters

unsigned int Opcode
llvm::Type* DataTy
llvm::Align Alignment
bool VariableMask
bool IsGatherScatter
TTI::TargetCostKind CostKind

unsigned int getEstimatedNumberOfCaseClusters(
    const llvm::SwitchInst& SI,
    unsigned int& JumpTableSize,
    llvm::ProfileSummaryInfo* PSI,
    llvm::BlockFrequencyInfo* BFI)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:400

Parameters

const llvm::SwitchInst& SI
unsigned int& JumpTableSize
llvm::ProfileSummaryInfo* PSI
llvm::BlockFrequencyInfo* BFI

llvm::InstructionCost getExtendedAddReductionCost(
    bool IsMLA,
    bool IsUnsigned,
    llvm::Type* ResTy,
    llvm::VectorType* Ty,
    TTI::TargetCostKind CostKind)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2317

Parameters

bool IsMLA
bool IsUnsigned
llvm::Type* ResTy
llvm::VectorType* Ty
TTI::TargetCostKind CostKind

llvm::InstructionCost getExtractSubvectorOverhead(
    llvm::VectorType* VTy,
    int Index,
    llvm::FixedVectorType* SubVTy)

Description

Estimate a cost of subvector extraction as a sequence of extract and insert operations.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:119

Parameters

llvm::VectorType* VTy
int Index
llvm::FixedVectorType* SubVTy

llvm::InstructionCost getExtractWithExtendCost(
    unsigned int Opcode,
    llvm::Type* Dst,
    llvm::VectorType* VecTy,
    unsigned int Index)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1084

Parameters

unsigned int Opcode
llvm::Type* Dst
llvm::VectorType* VecTy
unsigned int Index

llvm::InstructionCost getFPOpCost(llvm::Type* Ty)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:501

Parameters

llvm::Type* Ty

unsigned int getFlatAddressSpace()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:272

llvm::InstructionCost getGEPCost(
    llvm::Type* PointeeType,
    const llvm::Value* Ptr,
    ArrayRef<const llvm::Value*> Operands,
    TTI::TargetCostKind CostKind)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:394

Parameters

llvm::Type* PointeeType
const llvm::Value* Ptr
ArrayRef<const llvm::Value*> Operands
TTI::TargetCostKind CostKind

llvm::InstructionCost getGatherScatterOpCost(
    unsigned int Opcode,
    llvm::Type* DataTy,
    const llvm::Value* Ptr,
    bool VariableMask,
    llvm::Align Alignment,
    TTI::TargetCostKind CostKind,
    const llvm::Instruction* I = nullptr)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1242

Parameters

unsigned int Opcode
llvm::Type* DataTy
const llvm::Value* Ptr
bool VariableMask
llvm::Align Alignment
TTI::TargetCostKind CostKind
const llvm::Instruction* I = nullptr

static ISD::MemIndexedMode getISDIndexedMode(
    TTI::MemIndexedMode M)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:177

Parameters

TTI::MemIndexedMode M

int getInlinerVectorBonusPercent()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:514

unsigned int getInliningThresholdMultiplier()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:511

llvm::InstructionCost getInsertSubvectorOverhead(
    llvm::VectorType* VTy,
    int Index,
    llvm::FixedVectorType* SubVTy)

Description

Estimate a cost of subvector insertion as a sequence of extract and insert operations.

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

Parameters

llvm::VectorType* VTy
int Index
llvm::FixedVectorType* SubVTy

llvm::InstructionCost getInstructionLatency(
    const llvm::Instruction* I)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:638

Parameters

const llvm::Instruction* I

llvm::InstructionCost getInterleavedMemoryOpCost(
    unsigned int Opcode,
    llvm::Type* VecTy,
    unsigned int Factor,
    ArrayRef<unsigned int> Indices,
    llvm::Align Alignment,
    unsigned int AddressSpace,
    TTI::TargetCostKind CostKind,
    bool UseMaskForCond = false,
    bool UseMaskForGaps = false)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1251

Parameters

unsigned int Opcode
llvm::Type* VecTy
unsigned int Factor
ArrayRef<unsigned int> Indices
llvm::Align Alignment
unsigned int AddressSpace
TTI::TargetCostKind CostKind
bool UseMaskForCond = false
bool UseMaskForGaps = false

llvm::InstructionCost getIntrinsicInstrCost(
    const llvm::IntrinsicCostAttributes& ICA,
    TTI::TargetCostKind CostKind)

Description

Get intrinsic cost based on arguments.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1395

Parameters

const llvm::IntrinsicCostAttributes& ICA
TTI::TargetCostKind CostKind

llvm::InstructionCost getMaskedMemoryOpCost(
    unsigned int Opcode,
    llvm::Type* DataTy,
    llvm::Align Alignment,
    unsigned int AddressSpace,
    TTI::TargetCostKind CostKind)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1235

Parameters

unsigned int Opcode
llvm::Type* DataTy
llvm::Align Alignment
unsigned int AddressSpace
TTI::TargetCostKind CostKind

unsigned int getMaxInterleaveFactor(
    unsigned int VF)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:782

Parameters

unsigned int VF

virtual unsigned int
getMaxPrefetchIterationsAhead() const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:678

Optional<unsigned int> getMaxVScale() const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:695

llvm::InstructionCost getMemoryOpCost(
    unsigned int Opcode,
    llvm::Type* Src,
    llvm::MaybeAlign Alignment,
    unsigned int AddressSpace,
    TTI::TargetCostKind CostKind,
    const llvm::Instruction* I = nullptr)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1190

Parameters

unsigned int Opcode
llvm::Type* Src
llvm::MaybeAlign Alignment
unsigned int AddressSpace
TTI::TargetCostKind CostKind
const llvm::Instruction* I = nullptr

llvm::InstructionCost getMinMaxReductionCost(
    llvm::VectorType* Ty,
    llvm::VectorType* CondTy,
    bool IsUnsigned,
    TTI::TargetCostKind CostKind)

Description

Try to calculate op costs for min/max reduction operations.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2254

Parameters

llvm::VectorType* Ty
llvm::VectorType* CondTy
Conditional type for the Select instruction.
bool IsUnsigned
TTI::TargetCostKind CostKind

virtual unsigned int getMinPrefetchStride(
    unsigned int NumMemAccesses,
    unsigned int NumStridedMemAccesses,
    unsigned int NumPrefetches,
    bool HasCall) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:670

Parameters

unsigned int NumMemAccesses
unsigned int NumStridedMemAccesses
unsigned int NumPrefetches
bool HasCall

unsigned int getNumberOfParts(llvm::Type* Tp)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2120

Parameters

llvm::Type* Tp

llvm::InstructionCost
getOperandsScalarizationOverhead(
    ArrayRef<const llvm::Value*> Args,
    ArrayRef<llvm::Type*> Tys)

Description

Estimate the overhead of scalarizing an instructions unique non-constant operands. The (potentially vector) types to use for each of argument are passes via Tys.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:741

Parameters

ArrayRef<const llvm::Value*> Args
ArrayRef<llvm::Type*> Tys

llvm::InstructionCost getOrderedReductionCost(
    unsigned int Opcode,
    llvm::VectorType* Ty,
    TTI::TargetCostKind CostKind)

Description

Try to calculate the cost of performing strict (in-order) reductions, which involves doing a sequence of floating point additions in lane order, starting with an initial value. For example, consider a scalar initial value 'InitVal' of type float and a vector of type < 4 x float>: Vector = <float %v0, float %v1, float %v2, float %v3> %add1 = %InitVal + %v0 %add2 = %add1 + %v1 %add3 = %add2 + %v2 %add4 = %add3 + %v3 As a simple estimate we can say the cost of such a reduction is 4 times the cost of a scalar FP addition. We can only estimate the costs for fixed-width vectors here because for scalable vectors we do not know the runtime number of operations.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2227

Parameters

unsigned int Opcode
llvm::VectorType* Ty
TTI::TargetCostKind CostKind

void getPeelingPreferences(
    llvm::Loop* L,
    llvm::ScalarEvolution& SE,
    TTI::PeelingPreferences& PP)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:588

Parameters

llvm::Loop* L
llvm::ScalarEvolution& SE
TTI::PeelingPreferences& PP

llvm::InstructionCost getPermuteShuffleOverhead(
    llvm::FixedVectorType* VTy)

Description

Estimate a cost of shuffle as a sequence of extract and insert operations.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:101

Parameters

llvm::FixedVectorType* VTy

std::pair<const Value*, unsigned int>
getPredicatedAddrSpace(const llvm::Value* V) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:291

Parameters

const llvm::Value* V

virtual unsigned int getPrefetchDistance() const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:666

unsigned int getRegUsageForType(llvm::Type* Ty)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:389

Parameters

llvm::Type* Ty

llvm::TypeSize getRegisterBitWidth(
    TargetTransformInfo::RegisterKind K) const

Description

@ {

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:691

Parameters

TargetTransformInfo::RegisterKind K

llvm::InstructionCost getReplicationShuffleCost(
    llvm::Type* EltTy,
    int ReplicationFactor,
    int VF,
    const llvm::APInt& DemandedDstElts,
    TTI::TargetCostKind CostKind)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1157

Parameters

llvm::Type* EltTy
int ReplicationFactor
int VF
const llvm::APInt& DemandedDstElts
TTI::TargetCostKind CostKind

const llvm::TargetSubtargetInfo* getST() const

Description

Local query method delegates up to T which *must* implement this!

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:168

llvm::InstructionCost getScalarizationOverhead(
    llvm::VectorType* InTy,
    bool Insert,
    bool Extract)

Description

Helper wrapper for the DemandedElts variant of getScalarizationOverhead.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:728

Parameters

llvm::VectorType* InTy
bool Insert
bool Extract

llvm::InstructionCost getScalarizationOverhead(
    llvm::VectorType* InTy,
    const llvm::APInt& DemandedElts,
    bool Insert,
    bool Extract)

Description

Estimate the overhead of scalarizing an instruction. Insert and Extract are set if the demanded result elements need to be inserted and/or extracted from vectors.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:701

Parameters

llvm::VectorType* InTy
const llvm::APInt& DemandedElts
bool Insert
bool Extract

llvm::InstructionCost getScalarizationOverhead(
    llvm::VectorType* RetTy,
    ArrayRef<const llvm::Value*> Args,
    ArrayRef<llvm::Type*> Tys)

Description

Estimate the overhead of scalarizing the inputs and outputs of an instruction, with return type RetTy and arguments Args of type Tys. If Args are unknown (empty), then the cost associated with one argument is added as a heuristic.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:768

Parameters

llvm::VectorType* RetTy
ArrayRef<const llvm::Value*> Args
ArrayRef<llvm::Type*> Tys

llvm::InstructionCost getScalingFactorCost(
    llvm::Type* Ty,
    llvm::GlobalValue* BaseGV,
    int64_t BaseOffset,
    bool HasBaseReg,
    int64_t Scale,
    unsigned int AddrSpace)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:363

Parameters

llvm::Type* Ty
llvm::GlobalValue* BaseGV
int64_t BaseOffset
bool HasBaseReg
int64_t Scale
unsigned int AddrSpace

llvm::InstructionCost getShuffleCost(
    TTI::ShuffleKind Kind,
    llvm::VectorType* Tp,
    ArrayRef<int> Mask,
    int Index,
    llvm::VectorType* SubTp,
    ArrayRef<const llvm::Value*> Args = None)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:899

Parameters

TTI::ShuffleKind Kind
llvm::VectorType* Tp
ArrayRef<int> Mask
int Index
llvm::VectorType* SubTp
ArrayRef<const llvm::Value*> Args = None

unsigned int getStoreMinimumVF(
    unsigned int VF,
    llvm::Type* ScalarMemTy,
    llvm::Type* ScalarValTy) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:319

Parameters

unsigned int VF
llvm::Type* ScalarMemTy
llvm::Type* ScalarValTy

const llvm::TargetLoweringBase* getTLI() const

Description

Local query method delegates up to T which *must* implement this!

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:173

llvm::InstructionCost getTreeReductionCost(
    unsigned int Opcode,
    llvm::VectorType* Ty,
    TTI::TargetCostKind CostKind)

Description

Try to calculate arithmetic and shuffle op costs for reduction intrinsics. We're assuming that reduction operation are performing the following way: %val1 = shufflevector <n x t> %val, <n x t> %undef, <n x i32> <i32 n/2, i32 n/2 + 1, ..., i32 n, i32 undef, ..., i32 undef> \ ----------------v-------------/ \ ----------v------------/ n/2 elements n/2 elements %red1 = op <n x t> %val, <n x t> val1 After this operation we have a vector %red1 where only the first n/2 elements are meaningful, the second n/2 elements are undefined and can be dropped. All other operations are actually working with the vector of length n/2, not n, though the real vector length is still n. %val2 = shufflevector <n x t> %red1, <n x t> %undef, <n x i32> <i32 n/4, i32 n/4 + 1, ..., i32 n/2, i32 undef, ..., i32 undef> \ ----------------v-------------/ \ ----------v------------/ n/4 elements 3*n/4 elements %red2 = op <n x t> %red1, <n x t> val2 - working with the vector of length n/2, the resulting vector has length n/4 etc. The cost model should take into account that the actual length of the vector is reduced on each iteration.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2152

Parameters

unsigned int Opcode
llvm::VectorType* Ty
TTI::TargetCostKind CostKind

llvm::InstructionCost
getTypeBasedIntrinsicInstrCost(
    const llvm::IntrinsicCostAttributes& ICA,
    TTI::TargetCostKind CostKind)

Description

Get intrinsic cost based on argument types. If ScalarizationCostPassed is std::numeric_limits <unsigned >::max(), the cost of scalarizing the arguments and the return value will be computed based on types.

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1617

Parameters

const llvm::IntrinsicCostAttributes& ICA
TTI::TargetCostKind CostKind

void getUnrollingPreferences(
    llvm::Loop* L,
    llvm::ScalarEvolution& SE,
    TTI::UnrollingPreferences& UP,
    llvm::OptimizationRemarkEmitter* ORE)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:516

Parameters

llvm::Loop* L
llvm::ScalarEvolution& SE
TTI::UnrollingPreferences& UP
llvm::OptimizationRemarkEmitter* ORE

Optional<unsigned int> getVScaleForTuning() const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:696

llvm::InstructionCost getVectorInstrCost(
    unsigned int Opcode,
    llvm::Type* Val,
    unsigned int Index)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1149

Parameters

unsigned int Opcode
llvm::Type* Val
unsigned int Index

llvm::InstructionCost getVectorSplitCost()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:2338

bool hasBranchDivergence()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:264

bool haveFastSqrt(llvm::Type* Ty)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:490

Parameters

llvm::Type* Ty

TTI::ShuffleKind improveShuffleKindFromMask(
    TTI::ShuffleKind Kind,
    ArrayRef<int> Mask) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:866

Parameters

TTI::ShuffleKind Kind
ArrayRef<int> Mask

Optional<llvm::Instruction*> instCombineIntrinsic(
    llvm::InstCombiner& IC,
    llvm::IntrinsicInst& II)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:614

Parameters

llvm::InstCombiner& IC
llvm::IntrinsicInst& II

bool isAlwaysUniform(const llvm::Value* V)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:270

Parameters

const llvm::Value* V

bool isFCmpOrdCheaperThanFCmpZero(llvm::Type* Ty)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:497

Parameters

llvm::Type* Ty

bool isHardwareLoopProfitable(
    llvm::Loop* L,
    llvm::ScalarEvolution& SE,
    llvm::AssumptionCache& AC,
    llvm::TargetLibraryInfo* LibInfo,
    llvm::HardwareLoopInfo& HWLoopInfo)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:596

Parameters

llvm::Loop* L
llvm::ScalarEvolution& SE
llvm::AssumptionCache& AC
llvm::TargetLibraryInfo* LibInfo
llvm::HardwareLoopInfo& HWLoopInfo

bool isIndexedLoadLegal(
    TTI::MemIndexedMode M,
    llvm::Type* Ty,
    const llvm::DataLayout& DL) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:339

Parameters

TTI::MemIndexedMode M
llvm::Type* Ty
const llvm::DataLayout& DL

bool isIndexedStoreLegal(
    TTI::MemIndexedMode M,
    llvm::Type* Ty,
    const llvm::DataLayout& DL) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:345

Parameters

TTI::MemIndexedMode M
llvm::Type* Ty
const llvm::DataLayout& DL

bool isLSRCostLess(TTI::LSRCost C1,
                   TTI::LSRCost C2)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:351

Parameters

TTI::LSRCost C1
TTI::LSRCost C2

bool isLegalAddImmediate(int64_t imm)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:300

Parameters

int64_t imm

bool isLegalAddressingMode(
    llvm::Type* Ty,
    llvm::GlobalValue* BaseGV,
    int64_t BaseOffset,
    bool HasBaseReg,
    int64_t Scale,
    unsigned int AddrSpace,
    llvm::Instruction* I = nullptr)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:308

Parameters

llvm::Type* Ty
llvm::GlobalValue* BaseGV
int64_t BaseOffset
bool HasBaseReg
int64_t Scale
unsigned int AddrSpace
llvm::Instruction* I = nullptr

bool isLegalICmpImmediate(int64_t imm)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:304

Parameters

int64_t imm

bool isNoopAddrSpaceCast(unsigned int FromAS,
                         unsigned int ToAS) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:282

Parameters

unsigned int FromAS
unsigned int ToAS

bool isNumRegsMajorCostOfLSR()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:355

bool isProfitableLSRChainElement(
    llvm::Instruction* I)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:359

Parameters

llvm::Instruction* I

bool isProfitableToHoist(llvm::Instruction* I)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:378

Parameters

llvm::Instruction* I

bool isSourceOfDivergence(const llvm::Value* V)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:268

Parameters

const llvm::Value* V

bool isTruncateFree(llvm::Type* Ty1,
                    llvm::Type* Ty2)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:374

Parameters

llvm::Type* Ty1
llvm::Type* Ty2

bool isTypeLegal(llvm::Type* Ty)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:384

Parameters

llvm::Type* Ty

bool preferPredicateOverEpilogue(
    llvm::Loop* L,
    llvm::LoopInfo* LI,
    llvm::ScalarEvolution& SE,
    llvm::AssumptionCache& AC,
    llvm::TargetLibraryInfo* TLI,
    llvm::DominatorTree* DT,
    llvm::LoopVectorizationLegality* LVL)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:603

Parameters

llvm::Loop* L
llvm::LoopInfo* LI
llvm::ScalarEvolution& SE
llvm::AssumptionCache& AC
llvm::TargetLibraryInfo* TLI
llvm::DominatorTree* DT
llvm::LoopVectorizationLegality* LVL

llvm::Value* rewriteIntrinsicWithAddressSpace(
    llvm::IntrinsicInst* II,
    llvm::Value* OldV,
    llvm::Value* NewV) const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:295

Parameters

llvm::IntrinsicInst* II
llvm::Value* OldV
llvm::Value* NewV

bool shouldBuildLookupTables()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:459

bool shouldBuildRelLookupTables() const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:465

Optional<llvm::Value*>
simplifyDemandedUseBitsIntrinsic(
    llvm::InstCombiner& IC,
    llvm::IntrinsicInst& II,
    llvm::APInt DemandedMask,
    llvm::KnownBits& Known,
    bool& KnownBitsComputed)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:619

Parameters

llvm::InstCombiner& IC
llvm::IntrinsicInst& II
llvm::APInt DemandedMask
llvm::KnownBits& Known
bool& KnownBitsComputed

Optional<llvm::Value*>
simplifyDemandedVectorEltsIntrinsic(
    llvm::InstCombiner& IC,
    llvm::IntrinsicInst& II,
    llvm::APInt DemandedElts,
    llvm::APInt& UndefElts,
    llvm::APInt& UndefElts2,
    llvm::APInt& UndefElts3,
    std::function<void(Instruction*,
                       unsigned int,
                       APInt,
                       APInt&)> SimplifyAndSetOp)

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:628

Parameters

llvm::InstCombiner& IC
llvm::IntrinsicInst& II
llvm::APInt DemandedElts
llvm::APInt& UndefElts
llvm::APInt& UndefElts2
llvm::APInt& UndefElts3
std::function<void(Instruction*, unsigned int, APInt, APInt&)> SimplifyAndSetOp

T* thisT()

Description

Helper function to access this as a T.

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

bool useAA() const

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:382

bool useGPUDivergenceAnalysis()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:266

virtual ~BasicTTIImplBase<T>()

Declared at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:249