LLVM 19.0.0git
Protected Member Functions | Protected Attributes | List of all members
llvm::BasicTTIImplBase< T > Class Template Reference

Base class which can be used to help build a TTI implementation. More...

#include "llvm/CodeGen/BasicTTIImpl.h"

Inheritance diagram for llvm::BasicTTIImplBase< T >:
Inheritance graph
[legend]

Public Member Functions

Scalar TTI Implementations
bool allowsMisalignedMemoryAccesses (LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace, Align Alignment, unsigned *Fast) const
 
bool hasBranchDivergence (const Function *F=nullptr)
 
bool isSourceOfDivergence (const Value *V)
 
bool isAlwaysUniform (const Value *V)
 
bool isValidAddrSpaceCast (unsigned FromAS, unsigned ToAS) const
 
bool addrspacesMayAlias (unsigned AS0, unsigned AS1) const
 
unsigned getFlatAddressSpace ()
 
bool collectFlatAddressOperands (SmallVectorImpl< int > &OpIndexes, Intrinsic::ID IID) const
 
bool isNoopAddrSpaceCast (unsigned FromAS, unsigned ToAS) const
 
unsigned getAssumedAddrSpace (const Value *V) const
 
bool isSingleThreaded () const
 
std::pair< const Value *, unsignedgetPredicatedAddrSpace (const Value *V) const
 
ValuerewriteIntrinsicWithAddressSpace (IntrinsicInst *II, Value *OldV, Value *NewV) const
 
bool isLegalAddImmediate (int64_t imm)
 
bool isLegalAddScalableImmediate (int64_t Imm)
 
bool isLegalICmpImmediate (int64_t imm)
 
bool isLegalAddressingMode (Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace, Instruction *I=nullptr, int64_t ScalableOffset=0)
 
int64_t getPreferredLargeGEPBaseOffset (int64_t MinOffset, int64_t MaxOffset)
 
unsigned getStoreMinimumVF (unsigned VF, Type *ScalarMemTy, Type *ScalarValTy) const
 
bool isIndexedLoadLegal (TTI::MemIndexedMode M, Type *Ty, const DataLayout &DL) const
 
bool isIndexedStoreLegal (TTI::MemIndexedMode M, Type *Ty, const DataLayout &DL) const
 
bool isLSRCostLess (TTI::LSRCost C1, TTI::LSRCost C2)
 
bool isNumRegsMajorCostOfLSR ()
 
bool shouldFoldTerminatingConditionAfterLSR () const
 
bool isProfitableLSRChainElement (Instruction *I)
 
InstructionCost getScalingFactorCost (Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace)
 
bool isTruncateFree (Type *Ty1, Type *Ty2)
 
bool isProfitableToHoist (Instruction *I)
 
bool useAA () const
 
bool isTypeLegal (Type *Ty)
 
unsigned getRegUsageForType (Type *Ty)
 
InstructionCost getGEPCost (Type *PointeeType, const Value *Ptr, ArrayRef< const Value * > Operands, Type *AccessType, TTI::TargetCostKind CostKind)
 
unsigned getEstimatedNumberOfCaseClusters (const SwitchInst &SI, unsigned &JumpTableSize, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI)
 
bool shouldBuildLookupTables ()
 
bool shouldBuildRelLookupTables () const
 
bool haveFastSqrt (Type *Ty)
 
bool isFCmpOrdCheaperThanFCmpZero (Type *Ty)
 
InstructionCost getFPOpCost (Type *Ty)
 
bool preferToKeepConstantsAttached (const Instruction &Inst, const Function &Fn) const
 
unsigned getInliningThresholdMultiplier () const
 
unsigned adjustInliningThreshold (const CallBase *CB)
 
unsigned getCallerAllocaCost (const CallBase *CB, const AllocaInst *AI) const
 
int getInlinerVectorBonusPercent () const
 
void getUnrollingPreferences (Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE)
 
void getPeelingPreferences (Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
 
bool isHardwareLoopProfitable (Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo)
 
bool preferPredicateOverEpilogue (TailFoldingInfo *TFI)
 
TailFoldingStyle getPreferredTailFoldingStyle (bool IVUpdateMayOverflow=true)
 
std::optional< Instruction * > instCombineIntrinsic (InstCombiner &IC, IntrinsicInst &II)
 
std::optional< Value * > simplifyDemandedUseBitsIntrinsic (InstCombiner &IC, IntrinsicInst &II, APInt DemandedMask, KnownBits &Known, bool &KnownBitsComputed)
 
std::optional< Value * > simplifyDemandedVectorEltsIntrinsic (InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts, APInt &UndefElts2, APInt &UndefElts3, std::function< void(Instruction *, unsigned, APInt, APInt &)> SimplifyAndSetOp)
 
virtual std::optional< unsignedgetCacheSize (TargetTransformInfo::CacheLevel Level) const
 
virtual std::optional< unsignedgetCacheAssociativity (TargetTransformInfo::CacheLevel Level) const
 
virtual unsigned getCacheLineSize () const
 
virtual unsigned getPrefetchDistance () const
 
virtual unsigned getMinPrefetchStride (unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const
 
virtual unsigned getMaxPrefetchIterationsAhead () const
 
virtual bool enableWritePrefetching () const
 
virtual bool shouldPrefetchAddressSpace (unsigned AS) const
 
Vector TTI Implementations
TypeSize getRegisterBitWidth (TargetTransformInfo::RegisterKind K) const
 
std::optional< unsignedgetMaxVScale () const
 
std::optional< unsignedgetVScaleForTuning () const
 
bool isVScaleKnownToBeAPowerOfTwo () const
 
InstructionCost getScalarizationOverhead (VectorType *InTy, const APInt &DemandedElts, bool Insert, bool Extract, TTI::TargetCostKind CostKind)
 Estimate the overhead of scalarizing an instruction.
 
InstructionCost getScalarizationOverhead (VectorType *InTy, bool Insert, bool Extract, TTI::TargetCostKind CostKind)
 Helper wrapper for the DemandedElts variant of getScalarizationOverhead.
 
InstructionCost getOperandsScalarizationOverhead (ArrayRef< const Value * > Args, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind)
 Estimate the overhead of scalarizing an instructions unique non-constant operands.
 
InstructionCost getScalarizationOverhead (VectorType *RetTy, ArrayRef< const Value * > Args, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind)
 Estimate the overhead of scalarizing the inputs and outputs of an instruction, with return type RetTy and arguments Args of type Tys.
 
std::pair< InstructionCost, MVTgetTypeLegalizationCost (Type *Ty) const
 Estimate the cost of type-legalization and the legalized type.
 
unsigned getMaxInterleaveFactor (ElementCount VF)
 
InstructionCost getArithmeticInstrCost (unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Opd1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Opd2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
 
TTI::ShuffleKind improveShuffleKindFromMask (TTI::ShuffleKind Kind, ArrayRef< int > Mask, VectorType *Ty, int &Index, VectorType *&SubTy) const
 
InstructionCost getShuffleCost (TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args=std::nullopt, const Instruction *CxtI=nullptr)
 
InstructionCost getCastInstrCost (unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
 
InstructionCost getExtractWithExtendCost (unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index)
 
InstructionCost getCFInstrCost (unsigned Opcode, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
 
InstructionCost getCmpSelInstrCost (unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
 
InstructionCost getVectorInstrCost (unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Op0, Value *Op1)
 
InstructionCost getVectorInstrCost (const Instruction &I, Type *Val, TTI::TargetCostKind CostKind, unsigned Index)
 
InstructionCost getReplicationShuffleCost (Type *EltTy, int ReplicationFactor, int VF, const APInt &DemandedDstElts, TTI::TargetCostKind CostKind)
 
InstructionCost getMemoryOpCost (unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr)
 
InstructionCost getMaskedMemoryOpCost (unsigned Opcode, Type *DataTy, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind)
 
InstructionCost getGatherScatterOpCost (unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
 
InstructionCost getStridedMemoryOpCost (unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I)
 
InstructionCost getInterleavedMemoryOpCost (unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false)
 
InstructionCost getIntrinsicInstrCost (const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
 Get intrinsic cost based on arguments.
 
InstructionCost getTypeBasedIntrinsicInstrCost (const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
 Get intrinsic cost based on argument types.
 
InstructionCost getCallInstrCost (Function *F, Type *RetTy, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind)
 Compute a cost of the given call instruction.
 
unsigned getNumberOfParts (Type *Tp)
 
InstructionCost getAddressComputationCost (Type *Ty, ScalarEvolution *, const SCEV *)
 
InstructionCost getTreeReductionCost (unsigned Opcode, VectorType *Ty, TTI::TargetCostKind CostKind)
 Try to calculate arithmetic and shuffle op costs for reduction intrinsics.
 
InstructionCost getOrderedReductionCost (unsigned Opcode, VectorType *Ty, TTI::TargetCostKind CostKind)
 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.
 
InstructionCost getArithmeticReductionCost (unsigned Opcode, VectorType *Ty, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind)
 
InstructionCost getMinMaxReductionCost (Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind)
 Try to calculate op costs for min/max reduction operations.
 
InstructionCost getExtendedReductionCost (unsigned Opcode, bool IsUnsigned, Type *ResTy, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind)
 
InstructionCost getMulAccReductionCost (bool IsUnsigned, Type *ResTy, VectorType *Ty, TTI::TargetCostKind CostKind)
 
InstructionCost getVectorSplitCost ()
 
- Public Member Functions inherited from llvm::TargetTransformInfoImplCRTPBase< T >
InstructionCost getGEPCost (Type *PointeeType, const Value *Ptr, ArrayRef< const Value * > Operands, Type *AccessType, TTI::TargetCostKind CostKind)
 
InstructionCost getPointersChainCost (ArrayRef< const Value * > Ptrs, const Value *Base, const TTI::PointersChainInfo &Info, Type *AccessTy, TTI::TargetCostKind CostKind)
 
InstructionCost getInstructionCost (const User *U, ArrayRef< const Value * > Operands, TTI::TargetCostKind CostKind)
 
bool isExpensiveToSpeculativelyExecute (const Instruction *I)
 
bool supportsTailCallFor (const CallBase *CB) const
 
InstructionCost getGEPCost (Type *PointeeType, const Value *Ptr, ArrayRef< const Value * > Operands, Type *AccessType, TTI::TargetCostKind CostKind) const
 
- Public Member Functions inherited from llvm::TargetTransformInfoImplBase
 TargetTransformInfoImplBase (const TargetTransformInfoImplBase &Arg)=default
 
 TargetTransformInfoImplBase (TargetTransformInfoImplBase &&Arg)
 
const DataLayoutgetDataLayout () const
 
InstructionCost getGEPCost (Type *PointeeType, const Value *Ptr, ArrayRef< const Value * > Operands, Type *AccessType, TTI::TargetCostKind CostKind) const
 
unsigned getEstimatedNumberOfCaseClusters (const SwitchInst &SI, unsigned &JTSize, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI) const
 
unsigned getInliningThresholdMultiplier () const
 
unsigned getInliningCostBenefitAnalysisSavingsMultiplier () const
 
unsigned getInliningCostBenefitAnalysisProfitableMultiplier () const
 
unsigned adjustInliningThreshold (const CallBase *CB) const
 
unsigned getCallerAllocaCost (const CallBase *CB, const AllocaInst *AI) const
 
int getInlinerVectorBonusPercent () const
 
InstructionCost getMemcpyCost (const Instruction *I) const
 
uint64_t getMaxMemIntrinsicInlineSizeThreshold () const
 
BranchProbability getPredictableBranchThreshold () const
 
bool hasBranchDivergence (const Function *F=nullptr) const
 
bool isSourceOfDivergence (const Value *V) const
 
bool isAlwaysUniform (const Value *V) const
 
bool isValidAddrSpaceCast (unsigned FromAS, unsigned ToAS) const
 
bool addrspacesMayAlias (unsigned AS0, unsigned AS1) const
 
unsigned getFlatAddressSpace () const
 
bool collectFlatAddressOperands (SmallVectorImpl< int > &OpIndexes, Intrinsic::ID IID) const
 
bool isNoopAddrSpaceCast (unsigned, unsigned) const
 
bool canHaveNonUndefGlobalInitializerInAddressSpace (unsigned AS) const
 
unsigned getAssumedAddrSpace (const Value *V) const
 
bool isSingleThreaded () const
 
std::pair< const Value *, unsignedgetPredicatedAddrSpace (const Value *V) const
 
ValuerewriteIntrinsicWithAddressSpace (IntrinsicInst *II, Value *OldV, Value *NewV) const
 
bool isLoweredToCall (const Function *F) const
 
bool isHardwareLoopProfitable (Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo) const
 
bool preferPredicateOverEpilogue (TailFoldingInfo *TFI) const
 
TailFoldingStyle getPreferredTailFoldingStyle (bool IVUpdateMayOverflow=true) const
 
std::optional< Instruction * > instCombineIntrinsic (InstCombiner &IC, IntrinsicInst &II) const
 
std::optional< Value * > simplifyDemandedUseBitsIntrinsic (InstCombiner &IC, IntrinsicInst &II, APInt DemandedMask, KnownBits &Known, bool &KnownBitsComputed) const
 
std::optional< Value * > simplifyDemandedVectorEltsIntrinsic (InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts, APInt &UndefElts2, APInt &UndefElts3, std::function< void(Instruction *, unsigned, APInt, APInt &)> SimplifyAndSetOp) const
 
void getUnrollingPreferences (Loop *, ScalarEvolution &, TTI::UnrollingPreferences &, OptimizationRemarkEmitter *) const
 
void getPeelingPreferences (Loop *, ScalarEvolution &, TTI::PeelingPreferences &) const
 
bool isLegalAddImmediate (int64_t Imm) const
 
bool isLegalAddScalableImmediate (int64_t Imm) const
 
bool isLegalICmpImmediate (int64_t Imm) const
 
bool isLegalAddressingMode (Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace, Instruction *I=nullptr, int64_t ScalableOffset=0) const
 
bool isLSRCostLess (const TTI::LSRCost &C1, const TTI::LSRCost &C2) const
 
bool isNumRegsMajorCostOfLSR () const
 
bool shouldFoldTerminatingConditionAfterLSR () const
 
bool isProfitableLSRChainElement (Instruction *I) const
 
bool canMacroFuseCmp () const
 
bool canSaveCmp (Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, DominatorTree *DT, AssumptionCache *AC, TargetLibraryInfo *LibInfo) const
 
TTI::AddressingModeKind getPreferredAddressingMode (const Loop *L, ScalarEvolution *SE) const
 
bool isLegalMaskedStore (Type *DataType, Align Alignment) const
 
bool isLegalMaskedLoad (Type *DataType, Align Alignment) const
 
bool isLegalNTStore (Type *DataType, Align Alignment) const
 
bool isLegalNTLoad (Type *DataType, Align Alignment) const
 
bool isLegalBroadcastLoad (Type *ElementTy, ElementCount NumElements) const
 
bool isLegalMaskedScatter (Type *DataType, Align Alignment) const
 
bool isLegalMaskedGather (Type *DataType, Align Alignment) const
 
bool forceScalarizeMaskedGather (VectorType *DataType, Align Alignment) const
 
bool forceScalarizeMaskedScatter (VectorType *DataType, Align Alignment) const
 
bool isLegalMaskedCompressStore (Type *DataType, Align Alignment) const
 
bool isLegalAltInstr (VectorType *VecTy, unsigned Opcode0, unsigned Opcode1, const SmallBitVector &OpcodeMask) const
 
bool isLegalMaskedExpandLoad (Type *DataType, Align Alignment) const
 
bool isLegalStridedLoadStore (Type *DataType, Align Alignment) const
 
bool enableOrderedReductions () const
 
bool hasDivRemOp (Type *DataType, bool IsSigned) const
 
bool hasVolatileVariant (Instruction *I, unsigned AddrSpace) const
 
bool prefersVectorizedAddressing () const
 
InstructionCost getScalingFactorCost (Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace) const
 
bool LSRWithInstrQueries () const
 
bool isTruncateFree (Type *Ty1, Type *Ty2) const
 
bool isProfitableToHoist (Instruction *I) const
 
bool useAA () const
 
bool isTypeLegal (Type *Ty) const
 
unsigned getRegUsageForType (Type *Ty) const
 
bool shouldBuildLookupTables () const
 
bool shouldBuildLookupTablesForConstant (Constant *C) const
 
bool shouldBuildRelLookupTables () const
 
bool useColdCCForColdCall (Function &F) const
 
InstructionCost getScalarizationOverhead (VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract, TTI::TargetCostKind CostKind) const
 
InstructionCost getOperandsScalarizationOverhead (ArrayRef< const Value * > Args, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind) const
 
bool supportsEfficientVectorElementLoadStore () const
 
bool supportsTailCalls () const
 
bool enableAggressiveInterleaving (bool LoopHasReductions) const
 
TTI::MemCmpExpansionOptions enableMemCmpExpansion (bool OptSize, bool IsZeroCmp) const
 
bool enableSelectOptimize () const
 
bool shouldTreatInstructionLikeSelect (const Instruction *I)
 
bool enableInterleavedAccessVectorization () const
 
bool enableMaskedInterleavedAccessVectorization () const
 
bool isFPVectorizationPotentiallyUnsafe () const
 
bool allowsMisalignedMemoryAccesses (LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace, Align Alignment, unsigned *Fast) const
 
TTI::PopcntSupportKind getPopcntSupport (unsigned IntTyWidthInBit) const
 
bool haveFastSqrt (Type *Ty) const
 
bool isExpensiveToSpeculativelyExecute (const Instruction *I)
 
bool isFCmpOrdCheaperThanFCmpZero (Type *Ty) const
 
InstructionCost getFPOpCost (Type *Ty) const
 
InstructionCost getIntImmCodeSizeCost (unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty) const
 
InstructionCost getIntImmCost (const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const
 
InstructionCost getIntImmCostInst (unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr) const
 
InstructionCost getIntImmCostIntrin (Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind) const
 
bool preferToKeepConstantsAttached (const Instruction &Inst, const Function &Fn) const
 
unsigned getNumberOfRegisters (unsigned ClassID) const
 
unsigned getRegisterClassForType (bool Vector, Type *Ty=nullptr) const
 
const chargetRegisterClassName (unsigned ClassID) const
 
TypeSize getRegisterBitWidth (TargetTransformInfo::RegisterKind K) const
 
unsigned getMinVectorRegisterBitWidth () const
 
std::optional< unsignedgetMaxVScale () const
 
std::optional< unsignedgetVScaleForTuning () const
 
bool isVScaleKnownToBeAPowerOfTwo () const
 
bool shouldMaximizeVectorBandwidth (TargetTransformInfo::RegisterKind K) const
 
ElementCount getMinimumVF (unsigned ElemWidth, bool IsScalable) const
 
unsigned getMaximumVF (unsigned ElemWidth, unsigned Opcode) const
 
unsigned getStoreMinimumVF (unsigned VF, Type *, Type *) const
 
bool shouldConsiderAddressTypePromotion (const Instruction &I, bool &AllowPromotionWithoutCommonHeader) const
 
unsigned getCacheLineSize () const
 
std::optional< unsignedgetCacheSize (TargetTransformInfo::CacheLevel Level) const
 
std::optional< unsignedgetCacheAssociativity (TargetTransformInfo::CacheLevel Level) const
 
std::optional< unsignedgetMinPageSize () const
 
unsigned getPrefetchDistance () const
 
unsigned getMinPrefetchStride (unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const
 
unsigned getMaxPrefetchIterationsAhead () const
 
bool enableWritePrefetching () const
 
bool shouldPrefetchAddressSpace (unsigned AS) const
 
unsigned getMaxInterleaveFactor (ElementCount VF) const
 
InstructionCost getArithmeticInstrCost (unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Opd1Info, TTI::OperandValueInfo Opd2Info, ArrayRef< const Value * > Args, const Instruction *CxtI=nullptr) const
 
InstructionCost getAltInstrCost (VectorType *VecTy, unsigned Opcode0, unsigned Opcode1, const SmallBitVector &OpcodeMask, TTI::TargetCostKind CostKind) const
 
InstructionCost getShuffleCost (TTI::ShuffleKind Kind, VectorType *Ty, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args=std::nullopt, const Instruction *CxtI=nullptr) const
 
InstructionCost getCastInstrCost (unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I) const
 
InstructionCost getExtractWithExtendCost (unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index) const
 
InstructionCost getCFInstrCost (unsigned Opcode, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const
 
InstructionCost getCmpSelInstrCost (unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I) const
 
InstructionCost getVectorInstrCost (unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Op0, Value *Op1) const
 
InstructionCost getVectorInstrCost (const Instruction &I, Type *Val, TTI::TargetCostKind CostKind, unsigned Index) const
 
unsigned getReplicationShuffleCost (Type *EltTy, int ReplicationFactor, int VF, const APInt &DemandedDstElts, TTI::TargetCostKind CostKind)
 
InstructionCost getMemoryOpCost (unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo, const Instruction *I) const
 
InstructionCost getVPMemoryOpCost (unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, const Instruction *I) const
 
InstructionCost getMaskedMemoryOpCost (unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind) const
 
InstructionCost getGatherScatterOpCost (unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const
 
InstructionCost getStridedMemoryOpCost (unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const
 
unsigned getInterleavedMemoryOpCost (unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond, bool UseMaskForGaps) const
 
InstructionCost getIntrinsicInstrCost (const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) const
 
InstructionCost getCallInstrCost (Function *F, Type *RetTy, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind) const
 
unsigned getNumberOfParts (Type *Tp) const
 
InstructionCost getAddressComputationCost (Type *Tp, ScalarEvolution *, const SCEV *) const
 
InstructionCost getArithmeticReductionCost (unsigned, VectorType *, std::optional< FastMathFlags > FMF, TTI::TargetCostKind) const
 
InstructionCost getMinMaxReductionCost (Intrinsic::ID IID, VectorType *, FastMathFlags, TTI::TargetCostKind) const
 
InstructionCost getExtendedReductionCost (unsigned Opcode, bool IsUnsigned, Type *ResTy, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind) const
 
InstructionCost getMulAccReductionCost (bool IsUnsigned, Type *ResTy, VectorType *Ty, TTI::TargetCostKind CostKind) const
 
InstructionCost getCostOfKeepingLiveOverCall (ArrayRef< Type * > Tys) const
 
bool getTgtMemIntrinsic (IntrinsicInst *Inst, MemIntrinsicInfo &Info) const
 
unsigned getAtomicMemIntrinsicMaxElementSize () const
 
ValuegetOrCreateResultFromMemIntrinsic (IntrinsicInst *Inst, Type *ExpectedType) const
 
TypegetMemcpyLoopLoweringType (LLVMContext &Context, Value *Length, unsigned SrcAddrSpace, unsigned DestAddrSpace, unsigned SrcAlign, unsigned DestAlign, std::optional< uint32_t > AtomicElementSize) const
 
void getMemcpyLoopResidualLoweringType (SmallVectorImpl< Type * > &OpsOut, LLVMContext &Context, unsigned RemainingBytes, unsigned SrcAddrSpace, unsigned DestAddrSpace, unsigned SrcAlign, unsigned DestAlign, std::optional< uint32_t > AtomicCpySize) const
 
bool areInlineCompatible (const Function *Caller, const Function *Callee) const
 
unsigned getInlineCallPenalty (const Function *F, const CallBase &Call, unsigned DefaultCallPenalty) const
 
bool areTypesABICompatible (const Function *Caller, const Function *Callee, const ArrayRef< Type * > &Types) const
 
bool isIndexedLoadLegal (TTI::MemIndexedMode Mode, Type *Ty, const DataLayout &DL) const
 
bool isIndexedStoreLegal (TTI::MemIndexedMode Mode, Type *Ty, const DataLayout &DL) const
 
unsigned getLoadStoreVecRegBitWidth (unsigned AddrSpace) const
 
bool isLegalToVectorizeLoad (LoadInst *LI) const
 
bool isLegalToVectorizeStore (StoreInst *SI) const
 
bool isLegalToVectorizeLoadChain (unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const
 
bool isLegalToVectorizeStoreChain (unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const
 
bool isLegalToVectorizeReduction (const RecurrenceDescriptor &RdxDesc, ElementCount VF) const
 
bool isElementTypeLegalForScalableVector (Type *Ty) const
 
unsigned getLoadVectorFactor (unsigned VF, unsigned LoadSize, unsigned ChainSizeInBytes, VectorType *VecTy) const
 
unsigned getStoreVectorFactor (unsigned VF, unsigned StoreSize, unsigned ChainSizeInBytes, VectorType *VecTy) const
 
bool preferInLoopReduction (unsigned Opcode, Type *Ty, TTI::ReductionFlags Flags) const
 
bool preferPredicatedReductionSelect (unsigned Opcode, Type *Ty, TTI::ReductionFlags Flags) const
 
bool preferEpilogueVectorization () const
 
bool shouldExpandReduction (const IntrinsicInst *II) const
 
unsigned getGISelRematGlobalCost () const
 
unsigned getMinTripCountTailFoldingThreshold () const
 
bool supportsScalableVectors () const
 
bool enableScalableVectorization () const
 
bool hasActiveVectorLength (unsigned Opcode, Type *DataType, Align Alignment) const
 
TargetTransformInfo::VPLegalization getVPLegalizationStrategy (const VPIntrinsic &PI) const
 
bool hasArmWideBranch (bool) const
 
unsigned getMaxNumArgs () const
 

Protected Member Functions

 BasicTTIImplBase (const TargetMachine *TM, const DataLayout &DL)
 
virtual ~BasicTTIImplBase ()=default
 
- Protected Member Functions inherited from llvm::TargetTransformInfoImplCRTPBase< T >
 TargetTransformInfoImplCRTPBase (const DataLayout &DL)
 
- Protected Member Functions inherited from llvm::TargetTransformInfoImplBase
 TargetTransformInfoImplBase (const DataLayout &DL)
 
unsigned minRequiredElementSize (const Value *Val, bool &isSigned) const
 
bool isStridedAccess (const SCEV *Ptr) const
 
const SCEVConstantgetConstantStrideStep (ScalarEvolution *SE, const SCEV *Ptr) const
 
bool isConstantStridedAccessLessThan (ScalarEvolution *SE, const SCEV *Ptr, int64_t MergeDistance) const
 

Protected Attributes

const DataLayoutDL
 
- Protected Attributes inherited from llvm::TargetTransformInfoImplBase
const DataLayoutDL
 

Additional Inherited Members

- Protected Types inherited from llvm::TargetTransformInfoImplBase
typedef TargetTransformInfo TTI
 

Detailed Description

template<typename T>
class llvm::BasicTTIImplBase< T >

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.

Definition at line 80 of file BasicTTIImpl.h.

Constructor & Destructor Documentation

◆ BasicTTIImplBase()

template<typename T >
llvm::BasicTTIImplBase< T >::BasicTTIImplBase ( const TargetMachine TM,
const DataLayout DL 
)
inlineexplicitprotected

Definition at line 263 of file BasicTTIImpl.h.

◆ ~BasicTTIImplBase()

template<typename T >
virtual llvm::BasicTTIImplBase< T >::~BasicTTIImplBase ( )
protectedvirtualdefault

Member Function Documentation

◆ addrspacesMayAlias()

template<typename T >
bool llvm::BasicTTIImplBase< T >::addrspacesMayAlias ( unsigned  AS0,
unsigned  AS1 
) const
inline

Definition at line 290 of file BasicTTIImpl.h.

◆ adjustInliningThreshold()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::adjustInliningThreshold ( const CallBase CB)
inline

Definition at line 575 of file BasicTTIImpl.h.

◆ allowsMisalignedMemoryAccesses()

template<typename T >
bool llvm::BasicTTIImplBase< T >::allowsMisalignedMemoryAccesses ( LLVMContext Context,
unsigned  BitWidth,
unsigned  AddressSpace,
Align  Alignment,
unsigned Fast 
) const
inline

◆ collectFlatAddressOperands()

template<typename T >
bool llvm::BasicTTIImplBase< T >::collectFlatAddressOperands ( SmallVectorImpl< int > &  OpIndexes,
Intrinsic::ID  IID 
) const
inline

Definition at line 299 of file BasicTTIImpl.h.

◆ enableWritePrefetching()

template<typename T >
virtual bool llvm::BasicTTIImplBase< T >::enableWritePrefetching ( ) const
inlinevirtual

Reimplemented in llvm::SystemZTTIImpl.

Definition at line 738 of file BasicTTIImpl.h.

References llvm::MCSubtargetInfo::enableWritePrefetching().

◆ getAddressComputationCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getAddressComputationCost ( Type Ty,
ScalarEvolution ,
const SCEV  
)
inline

Definition at line 2362 of file BasicTTIImpl.h.

◆ getArithmeticInstrCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getArithmeticInstrCost ( unsigned  Opcode,
Type Ty,
TTI::TargetCostKind  CostKind,
TTI::OperandValueInfo  Opd1Info = {TTI::OK_AnyValueTTI::OP_None},
TTI::OperandValueInfo  Opd2Info = {TTI::OK_AnyValueTTI::OP_None},
ArrayRef< const Value * >  Args = ArrayRef<const Value *>(),
const Instruction CxtI = nullptr 
)
inline

◆ getArithmeticReductionCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getArithmeticReductionCost ( unsigned  Opcode,
VectorType Ty,
std::optional< FastMathFlags FMF,
TTI::TargetCostKind  CostKind 
)
inline

◆ getAssumedAddrSpace()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getAssumedAddrSpace ( const Value V) const
inline

◆ getCacheAssociativity()

template<typename T >
virtual std::optional< unsigned > llvm::BasicTTIImplBase< T >::getCacheAssociativity ( TargetTransformInfo::CacheLevel  Level) const
inlinevirtual

◆ getCacheLineSize()

template<typename T >
virtual unsigned llvm::BasicTTIImplBase< T >::getCacheLineSize ( ) const
inlinevirtual

◆ getCacheSize()

template<typename T >
virtual std::optional< unsigned > llvm::BasicTTIImplBase< T >::getCacheSize ( TargetTransformInfo::CacheLevel  Level) const
inlinevirtual

◆ getCallerAllocaCost()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getCallerAllocaCost ( const CallBase CB,
const AllocaInst AI 
) const
inline

Definition at line 576 of file BasicTTIImpl.h.

◆ getCallInstrCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getCallInstrCost ( Function F,
Type RetTy,
ArrayRef< Type * >  Tys,
TTI::TargetCostKind  CostKind 
)
inline

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.

Parameters
FCalled function, might be nullptr.
RetTyReturn value types.
TysArgument types.
Returns
The cost of Call instruction.

Definition at line 2351 of file BasicTTIImpl.h.

◆ getCastInstrCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getCastInstrCost ( unsigned  Opcode,
Type Dst,
Type Src,
TTI::CastContextHint  CCH,
TTI::TargetCostKind  CostKind,
const Instruction I = nullptr 
)
inline

◆ getCFInstrCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getCFInstrCost ( unsigned  Opcode,
TTI::TargetCostKind  CostKind,
const Instruction I = nullptr 
)
inline

Definition at line 1216 of file BasicTTIImpl.h.

References CostKind, llvm::TargetTransformInfoImplBase::getCFInstrCost(), and I.

◆ getCmpSelInstrCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getCmpSelInstrCost ( unsigned  Opcode,
Type ValTy,
Type CondTy,
CmpInst::Predicate  VecPred,
TTI::TargetCostKind  CostKind,
const Instruction I = nullptr 
)
inline

◆ getEstimatedNumberOfCaseClusters()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getEstimatedNumberOfCaseClusters ( const SwitchInst SI,
unsigned JumpTableSize,
ProfileSummaryInfo PSI,
BlockFrequencyInfo BFI 
)
inline

Try to find the estimated number of clusters. Note that the number of clusters identified in this function could be different from the actual numbers found in lowering. This function ignore switches that are lowered with a mix of jump table / bit test / BTree. This function was initially intended to be used when estimating the cost of switch in inline cost heuristic, but it's a generic cost model to be used in other places (e.g., in loop unrolling).

Definition at line 444 of file BasicTTIImpl.h.

References llvm::TargetLoweringBase::areJTsAllowed(), llvm::BasicTTIImplBase< T >::DL, llvm::TargetTransformInfoImplBase::getDataLayout(), llvm::DataLayout::getIndexSizeInBits(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::TargetLoweringBase::isSuitableForBitTests(), llvm::TargetLoweringBase::isSuitableForJumpTable(), N, llvm::APInt::sgt(), llvm::SmallPtrSetImplBase::size(), and llvm::APInt::slt().

◆ getExtendedReductionCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getExtendedReductionCost ( unsigned  Opcode,
bool  IsUnsigned,
Type ResTy,
VectorType Ty,
FastMathFlags  FMF,
TTI::TargetCostKind  CostKind 
)
inline

◆ getExtractWithExtendCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getExtractWithExtendCost ( unsigned  Opcode,
Type Dst,
VectorType VecTy,
unsigned  Index 
)
inline

◆ getFlatAddressSpace()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getFlatAddressSpace ( )
inline

Definition at line 294 of file BasicTTIImpl.h.

◆ getFPOpCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getFPOpCost ( Type Ty)
inline

◆ getGatherScatterOpCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getGatherScatterOpCost ( unsigned  Opcode,
Type DataTy,
const Value Ptr,
bool  VariableMask,
Align  Alignment,
TTI::TargetCostKind  CostKind,
const Instruction I = nullptr 
)
inline

Definition at line 1378 of file BasicTTIImpl.h.

References CostKind.

◆ getGEPCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getGEPCost ( Type PointeeType,
const Value Ptr,
ArrayRef< const Value * >  Operands,
Type AccessType,
TTI::TargetCostKind  CostKind 
)
inline

◆ getInlinerVectorBonusPercent()

template<typename T >
int llvm::BasicTTIImplBase< T >::getInlinerVectorBonusPercent ( ) const
inline

Definition at line 580 of file BasicTTIImpl.h.

◆ getInliningThresholdMultiplier()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getInliningThresholdMultiplier ( ) const
inline

Definition at line 574 of file BasicTTIImpl.h.

◆ getInterleavedMemoryOpCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getInterleavedMemoryOpCost ( unsigned  Opcode,
Type VecTy,
unsigned  Factor,
ArrayRef< unsigned Indices,
Align  Alignment,
unsigned  AddressSpace,
TTI::TargetCostKind  CostKind,
bool  UseMaskForCond = false,
bool  UseMaskForGaps = false 
)
inline

◆ getIntrinsicInstrCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost ( const IntrinsicCostAttributes ICA,
TTI::TargetCostKind  CostKind 
)
inline

Get intrinsic cost based on arguments.

Definition at line 1543 of file BasicTTIImpl.h.

References assert(), CostKind, llvm::Data, llvm::BasicTTIImplBase< T >::DL, llvm::ArrayRef< T >::drop_back(), llvm::ArrayRef< T >::drop_front(), llvm::Exponent, llvm::VectorType::get(), llvm::IntrinsicCostAttributes::getArgs(), llvm::IntrinsicCostAttributes::getArgTypes(), llvm::ElementCount::getFixed(), llvm::IntrinsicCostAttributes::getFlags(), llvm::VPIntrinsic::getFunctionalIntrinsicIDForVP(), llvm::VPIntrinsic::getFunctionalOpcodeForVP(), llvm::IntrinsicCostAttributes::getID(), llvm::IntrinsicCostAttributes::getInst(), llvm::TargetTransformInfoImplBase::getIntrinsicInstrCost(), llvm::InstructionCost::getInvalid(), llvm::TargetTransformInfo::getOperandInfo(), llvm::BasicTTIImplBase< T >::getOperandsScalarizationOverhead(), llvm::IntrinsicCostAttributes::getReturnType(), llvm::BasicTTIImplBase< T >::getScalarizationOverhead(), getType(), llvm::BasicTTIImplBase< T >::getTypeBasedIntrinsicInstrCost(), llvm::BasicTTIImplBase< T >::getTypeLegalizationCost(), llvm::TargetLoweringBase::getValueType(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_ULT, llvm::TargetLoweringBase::isBeneficialToExpandPowI(), llvm::TargetLoweringBase::isCheapToSpeculateCtlz(), llvm::TargetLoweringBase::isCheapToSpeculateCttz(), llvm::TargetTransformInfo::OperandValueInfo::isConstant(), llvm::isPowerOf2_32(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isScalable(), llvm::ElementCount::isScalar(), llvm::Function::isTargetIntrinsic(), llvm::IntrinsicCostAttributes::isTypeBasedOnly(), llvm::ElementCount::isVector(), llvm::VPBinOpIntrinsic::isVPBinOp(), llvm::VPIntrinsic::isVPIntrinsic(), llvm::VPReductionIntrinsic::isVPReduction(), llvm::TargetTransformInfo::OperandValueInfo::Kind, llvm::TargetTransformInfo::OK_UniformConstantValue, llvm::TargetTransformInfo::OP_None, llvm::TargetTransformInfo::OP_PowerOf2, Ptr, RetTy, llvm::SmallVectorBase< Size_T >::size(), llvm::TargetTransformInfo::SK_ExtractSubvector, llvm::TargetTransformInfo::SK_InsertSubvector, llvm::TargetTransformInfo::SK_Reverse, llvm::TargetTransformInfo::SK_Splice, llvm::TargetTransformInfo::TCC_Basic, X, and Y.

Referenced by llvm::BasicTTIImplBase< T >::getMinMaxReductionCost().

◆ getMaskedMemoryOpCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getMaskedMemoryOpCost ( unsigned  Opcode,
Type DataTy,
Align  Alignment,
unsigned  AddressSpace,
TTI::TargetCostKind  CostKind 
)
inline

Definition at line 1370 of file BasicTTIImpl.h.

References CostKind.

◆ getMaxInterleaveFactor()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getMaxInterleaveFactor ( ElementCount  VF)
inline

Definition at line 889 of file BasicTTIImpl.h.

◆ getMaxPrefetchIterationsAhead()

template<typename T >
virtual unsigned llvm::BasicTTIImplBase< T >::getMaxPrefetchIterationsAhead ( ) const
inlinevirtual

◆ getMaxVScale()

template<typename T >
std::optional< unsigned > llvm::BasicTTIImplBase< T >::getMaxVScale ( ) const
inline

Definition at line 755 of file BasicTTIImpl.h.

◆ getMemoryOpCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getMemoryOpCost ( unsigned  Opcode,
Type Src,
MaybeAlign  Alignment,
unsigned  AddressSpace,
TTI::TargetCostKind  CostKind,
TTI::OperandValueInfo  OpInfo = {TTI::OK_AnyValueTTI::OP_None},
const Instruction I = nullptr 
)
inline

◆ getMinMaxReductionCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getMinMaxReductionCost ( Intrinsic::ID  IID,
VectorType Ty,
FastMathFlags  FMF,
TTI::TargetCostKind  CostKind 
)
inline

◆ getMinPrefetchStride()

template<typename T >
virtual unsigned llvm::BasicTTIImplBase< T >::getMinPrefetchStride ( unsigned  NumMemAccesses,
unsigned  NumStridedMemAccesses,
unsigned  NumPrefetches,
bool  HasCall 
) const
inlinevirtual

Reimplemented in llvm::SystemZTTIImpl.

Definition at line 726 of file BasicTTIImpl.h.

References llvm::MCSubtargetInfo::getMinPrefetchStride().

◆ getMulAccReductionCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getMulAccReductionCost ( bool  IsUnsigned,
Type ResTy,
VectorType Ty,
TTI::TargetCostKind  CostKind 
)
inline

◆ getNumberOfParts()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getNumberOfParts ( Type Tp)
inline

◆ getOperandsScalarizationOverhead()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getOperandsScalarizationOverhead ( ArrayRef< const Value * >  Args,
ArrayRef< Type * >  Tys,
TTI::TargetCostKind  CostKind 
)
inline

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.

Definition at line 808 of file BasicTTIImpl.h.

References A, assert(), CostKind, E, llvm::BasicTTIImplBase< T >::getScalarizationOverhead(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::Type::isFPOrFPVectorTy(), llvm::Type::isIntOrIntVectorTy(), llvm::Type::isPtrOrPtrVectorTy(), and llvm::ArrayRef< T >::size().

Referenced by llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost(), and llvm::BasicTTIImplBase< T >::getScalarizationOverhead().

◆ getOrderedReductionCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getOrderedReductionCost ( unsigned  Opcode,
VectorType Ty,
TTI::TargetCostKind  CostKind 
)
inline

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.

Definition at line 2465 of file BasicTTIImpl.h.

References CostKind, llvm::VectorType::getElementType(), llvm::InstructionCost::getInvalid(), llvm::FixedVectorType::getNumElements(), and llvm::BasicTTIImplBase< T >::getScalarizationOverhead().

Referenced by llvm::BasicTTIImplBase< T >::getArithmeticReductionCost().

◆ getPeelingPreferences()

template<typename T >
void llvm::BasicTTIImplBase< T >::getPeelingPreferences ( Loop L,
ScalarEvolution SE,
TTI::PeelingPreferences PP 
)
inline

◆ getPredicatedAddrSpace()

template<typename T >
std::pair< const Value *, unsigned > llvm::BasicTTIImplBase< T >::getPredicatedAddrSpace ( const Value V) const
inline

◆ getPreferredLargeGEPBaseOffset()

template<typename T >
int64_t llvm::BasicTTIImplBase< T >::getPreferredLargeGEPBaseOffset ( int64_t  MinOffset,
int64_t  MaxOffset 
)
inline

◆ getPreferredTailFoldingStyle()

template<typename T >
TailFoldingStyle llvm::BasicTTIImplBase< T >::getPreferredTailFoldingStyle ( bool  IVUpdateMayOverflow = true)
inline

◆ getPrefetchDistance()

template<typename T >
virtual unsigned llvm::BasicTTIImplBase< T >::getPrefetchDistance ( ) const
inlinevirtual

◆ getRegisterBitWidth()

template<typename T >
TypeSize llvm::BasicTTIImplBase< T >::getRegisterBitWidth ( TargetTransformInfo::RegisterKind  K) const
inline

Definition at line 751 of file BasicTTIImpl.h.

References llvm::TypeSize::getFixed().

◆ getRegUsageForType()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getRegUsageForType ( Type Ty)
inline

◆ getReplicationShuffleCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getReplicationShuffleCost ( Type EltTy,
int  ReplicationFactor,
int  VF,
const APInt DemandedDstElts,
TTI::TargetCostKind  CostKind 
)
inline

◆ getScalarizationOverhead() [1/3]

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getScalarizationOverhead ( VectorType InTy,
bool  Insert,
bool  Extract,
TTI::TargetCostKind  CostKind 
)
inline

Helper wrapper for the DemandedElts variant of getScalarizationOverhead.

Definition at line 792 of file BasicTTIImpl.h.

References CostKind, llvm::APInt::getAllOnes(), and llvm::InstructionCost::getInvalid().

◆ getScalarizationOverhead() [2/3]

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getScalarizationOverhead ( VectorType InTy,
const APInt DemandedElts,
bool  Insert,
bool  Extract,
TTI::TargetCostKind  CostKind 
)
inline

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.

FIXME: a bitfield is not a reasonable abstraction for talking about which elements are needed from a scalable vector

Definition at line 762 of file BasicTTIImpl.h.

References assert(), CostKind, llvm::APInt::getBitWidth(), and llvm::InstructionCost::getInvalid().

Referenced by llvm::BasicTTIImplBase< T >::getCastInstrCost(), llvm::BasicTTIImplBase< T >::getCmpSelInstrCost(), llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost(), llvm::BasicTTIImplBase< T >::getOperandsScalarizationOverhead(), llvm::BasicTTIImplBase< T >::getOrderedReductionCost(), llvm::BasicTTIImplBase< T >::getScalarizationOverhead(), and llvm::BasicTTIImplBase< T >::getTypeBasedIntrinsicInstrCost().

◆ getScalarizationOverhead() [3/3]

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getScalarizationOverhead ( VectorType RetTy,
ArrayRef< const Value * >  Args,
ArrayRef< Type * >  Tys,
TTI::TargetCostKind  CostKind 
)
inline

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.

Definition at line 837 of file BasicTTIImpl.h.

References CostKind, llvm::BasicTTIImplBase< T >::getOperandsScalarizationOverhead(), llvm::BasicTTIImplBase< T >::getScalarizationOverhead(), and RetTy.

◆ getScalingFactorCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getScalingFactorCost ( Type Ty,
GlobalValue BaseGV,
int64_t  BaseOffset,
bool  HasBaseReg,
int64_t  Scale,
unsigned  AddrSpace 
)
inline

◆ getShuffleCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getShuffleCost ( TTI::ShuffleKind  Kind,
VectorType Tp,
ArrayRef< int >  Mask,
TTI::TargetCostKind  CostKind,
int  Index,
VectorType SubTp,
ArrayRef< const Value * >  Args = std::nullopt,
const Instruction CxtI = nullptr 
)
inline

◆ getStoreMinimumVF()

template<typename T >
unsigned llvm::BasicTTIImplBase< T >::getStoreMinimumVF ( unsigned  VF,
Type ScalarMemTy,
Type ScalarValTy 
) const
inline

◆ getStridedMemoryOpCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getStridedMemoryOpCost ( unsigned  Opcode,
Type DataTy,
const Value Ptr,
bool  VariableMask,
Align  Alignment,
TTI::TargetCostKind  CostKind,
const Instruction I 
)
inline

Definition at line 1387 of file BasicTTIImpl.h.

References CostKind, I, and Ptr.

◆ getTreeReductionCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getTreeReductionCost ( unsigned  Opcode,
VectorType Ty,
TTI::TargetCostKind  CostKind 
)
inline

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.

Definition at line 2388 of file BasicTTIImpl.h.

References llvm::CmpInst::BAD_ICMP_PREDICATE, CostKind, llvm::IntegerType::get(), llvm::FixedVectorType::get(), llvm::Type::getContext(), llvm::VectorType::getElementType(), llvm::Type::getInt1Ty(), llvm::InstructionCost::getInvalid(), llvm::Log2_32(), llvm::CmpInst::makeCmpResultType(), llvm::TargetTransformInfo::None, llvm::TargetTransformInfo::SK_ExtractSubvector, and llvm::TargetTransformInfo::SK_PermuteSingleSrc.

Referenced by llvm::BasicTTIImplBase< T >::getArithmeticReductionCost().

◆ getTypeBasedIntrinsicInstrCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getTypeBasedIntrinsicInstrCost ( const IntrinsicCostAttributes ICA,
TTI::TargetCostKind  CostKind 
)
inline

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.

Definition at line 1849 of file BasicTTIImpl.h.

References llvm::any_of(), assert(), llvm::CmpInst::BAD_ICMP_PREDICATE, llvm::ISD::BITREVERSE, llvm::ISD::BSWAP, CostKind, llvm::StructType::create(), llvm::ISD::CTLZ, llvm::ISD::CTPOP, llvm::ISD::CTTZ, llvm::SmallVectorBase< Size_T >::empty(), llvm::ISD::FABS, llvm::ISD::FCANONICALIZE, llvm::ISD::FCEIL, llvm::CmpInst::FCMP_UNO, llvm::ISD::FCOPYSIGN, llvm::ISD::FCOS, llvm::ISD::FEXP, llvm::ISD::FEXP10, llvm::ISD::FEXP2, llvm::ISD::FFLOOR, llvm::ISD::FLOG, llvm::ISD::FLOG10, llvm::ISD::FLOG2, llvm::ISD::FMA, llvm::ISD::FMAXIMUM, llvm::ISD::FMAXNUM, llvm::ISD::FMINIMUM, llvm::ISD::FMINNUM, llvm::ISD::FNEARBYINT, llvm::ISD::FPOW, llvm::ISD::FRINT, llvm::ISD::FROUND, llvm::ISD::FROUNDEVEN, llvm::ISD::FSIN, llvm::ISD::FSQRT, llvm::ISD::FTRUNC, llvm::IntrinsicCostAttributes::getArgTypes(), llvm::getArithmeticReductionInstruction(), llvm::IntrinsicCostAttributes::getFlags(), llvm::IntrinsicCostAttributes::getID(), llvm::InstructionCost::getInvalid(), llvm::getMinMaxReductionIntrinsicOp(), llvm::IntrinsicCostAttributes::getReturnType(), llvm::IntrinsicCostAttributes::getScalarizationCost(), llvm::BasicTTIImplBase< T >::getScalarizationOverhead(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::BasicTTIImplBase< T >::getTypeLegalizationCost(), llvm::Type::getWithNewBitWidth(), llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::TargetLoweringBase::isFAbsFree(), llvm::TargetLoweringBase::isOperationExpand(), llvm::TargetLoweringBase::isOperationLegalOrPromote(), llvm::Type::isVectorTy(), llvm::ISD::LLRINT, llvm::ISD::LRINT, llvm::TargetTransformInfo::None, llvm::TargetTransformInfo::OK_AnyValue, llvm::TargetTransformInfo::OK_UniformConstantValue, llvm::TargetTransformInfo::OP_None, llvm::SmallVectorTemplateBase< T, bool >::push_back(), RetTy, llvm::SmallVectorBase< Size_T >::size(), llvm::IntrinsicCostAttributes::skipScalarizationCost(), llvm::ISD::STRICT_FMA, llvm::TargetTransformInfo::TCC_Expensive, and llvm::TargetTransformInfo::TCK_CodeSize.

Referenced by llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost().

◆ getTypeLegalizationCost()

template<typename T >
std::pair< InstructionCost, MVT > llvm::BasicTTIImplBase< T >::getTypeLegalizationCost ( Type Ty) const
inline

◆ getUnrollingPreferences()

template<typename T >
void llvm::BasicTTIImplBase< T >::getUnrollingPreferences ( Loop L,
ScalarEvolution SE,
TTI::UnrollingPreferences UP,
OptimizationRemarkEmitter ORE 
)
inline

◆ getVectorInstrCost() [1/2]

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getVectorInstrCost ( const Instruction I,
Type Val,
TTI::TargetCostKind  CostKind,
unsigned  Index 
)
inline

Definition at line 1279 of file BasicTTIImpl.h.

References CostKind, and I.

◆ getVectorInstrCost() [2/2]

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getVectorInstrCost ( unsigned  Opcode,
Type Val,
TTI::TargetCostKind  CostKind,
unsigned  Index,
Value Op0,
Value Op1 
)
inline

◆ getVectorSplitCost()

template<typename T >
InstructionCost llvm::BasicTTIImplBase< T >::getVectorSplitCost ( )
inline

Definition at line 2577 of file BasicTTIImpl.h.

◆ getVScaleForTuning()

template<typename T >
std::optional< unsigned > llvm::BasicTTIImplBase< T >::getVScaleForTuning ( ) const
inline

Definition at line 756 of file BasicTTIImpl.h.

◆ hasBranchDivergence()

template<typename T >
bool llvm::BasicTTIImplBase< T >::hasBranchDivergence ( const Function F = nullptr)
inline

Definition at line 280 of file BasicTTIImpl.h.

◆ haveFastSqrt()

template<typename T >
bool llvm::BasicTTIImplBase< T >::haveFastSqrt ( Type Ty)
inline

◆ improveShuffleKindFromMask()

template<typename T >
TTI::ShuffleKind llvm::BasicTTIImplBase< T >::improveShuffleKindFromMask ( TTI::ShuffleKind  Kind,
ArrayRef< int >  Mask,
VectorType Ty,
int &  Index,
VectorType *&  SubTy 
) const
inline

◆ instCombineIntrinsic()

template<typename T >
std::optional< Instruction * > llvm::BasicTTIImplBase< T >::instCombineIntrinsic ( InstCombiner IC,
IntrinsicInst II 
)
inline

◆ isAlwaysUniform()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isAlwaysUniform ( const Value V)
inline

Definition at line 284 of file BasicTTIImpl.h.

◆ isFCmpOrdCheaperThanFCmpZero()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isFCmpOrdCheaperThanFCmpZero ( Type Ty)
inline

Definition at line 541 of file BasicTTIImpl.h.

◆ isHardwareLoopProfitable()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isHardwareLoopProfitable ( Loop L,
ScalarEvolution SE,
AssumptionCache AC,
TargetLibraryInfo LibInfo,
HardwareLoopInfo HWLoopInfo 
)
inline

◆ isIndexedLoadLegal()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isIndexedLoadLegal ( TTI::MemIndexedMode  M,
Type Ty,
const DataLayout DL 
) const
inline

◆ isIndexedStoreLegal()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isIndexedStoreLegal ( TTI::MemIndexedMode  M,
Type Ty,
const DataLayout DL 
) const
inline

◆ isLegalAddImmediate()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isLegalAddImmediate ( int64_t  imm)
inline

Definition at line 327 of file BasicTTIImpl.h.

References llvm::TargetLoweringBase::isLegalAddImmediate().

◆ isLegalAddressingMode()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isLegalAddressingMode ( Type Ty,
GlobalValue BaseGV,
int64_t  BaseOffset,
bool  HasBaseReg,
int64_t  Scale,
unsigned  AddrSpace,
Instruction I = nullptr,
int64_t  ScalableOffset = 0 
)
inline

◆ isLegalAddScalableImmediate()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isLegalAddScalableImmediate ( int64_t  Imm)
inline

◆ isLegalICmpImmediate()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isLegalICmpImmediate ( int64_t  imm)
inline

Definition at line 335 of file BasicTTIImpl.h.

References llvm::TargetLoweringBase::isLegalICmpImmediate().

◆ isLSRCostLess()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isLSRCostLess ( TTI::LSRCost  C1,
TTI::LSRCost  C2 
)
inline

◆ isNoopAddrSpaceCast()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isNoopAddrSpaceCast ( unsigned  FromAS,
unsigned  ToAS 
) const
inline

◆ isNumRegsMajorCostOfLSR()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isNumRegsMajorCostOfLSR ( )
inline

◆ isProfitableLSRChainElement()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isProfitableLSRChainElement ( Instruction I)
inline

◆ isProfitableToHoist()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isProfitableToHoist ( Instruction I)
inline

Definition at line 422 of file BasicTTIImpl.h.

References I, and llvm::TargetLoweringBase::isProfitableToHoist().

◆ isSingleThreaded()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isSingleThreaded ( ) const
inline

◆ isSourceOfDivergence()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isSourceOfDivergence ( const Value V)
inline

Definition at line 282 of file BasicTTIImpl.h.

◆ isTruncateFree()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isTruncateFree ( Type Ty1,
Type Ty2 
)
inline

Definition at line 418 of file BasicTTIImpl.h.

References llvm::TargetLoweringBase::isTruncateFree().

◆ isTypeLegal()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isTypeLegal ( Type Ty)
inline

◆ isValidAddrSpaceCast()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isValidAddrSpaceCast ( unsigned  FromAS,
unsigned  ToAS 
) const
inline

Definition at line 286 of file BasicTTIImpl.h.

◆ isVScaleKnownToBeAPowerOfTwo()

template<typename T >
bool llvm::BasicTTIImplBase< T >::isVScaleKnownToBeAPowerOfTwo ( ) const
inline

Definition at line 757 of file BasicTTIImpl.h.

◆ preferPredicateOverEpilogue()

template<typename T >
bool llvm::BasicTTIImplBase< T >::preferPredicateOverEpilogue ( TailFoldingInfo TFI)
inline

◆ preferToKeepConstantsAttached()

template<typename T >
bool llvm::BasicTTIImplBase< T >::preferToKeepConstantsAttached ( const Instruction Inst,
const Function Fn 
) const
inline

◆ rewriteIntrinsicWithAddressSpace()

template<typename T >
Value * llvm::BasicTTIImplBase< T >::rewriteIntrinsicWithAddressSpace ( IntrinsicInst II,
Value OldV,
Value NewV 
) const
inline

Definition at line 322 of file BasicTTIImpl.h.

◆ shouldBuildLookupTables()

template<typename T >
bool llvm::BasicTTIImplBase< T >::shouldBuildLookupTables ( )
inline

◆ shouldBuildRelLookupTables()

template<typename T >
bool llvm::BasicTTIImplBase< T >::shouldBuildRelLookupTables ( ) const
inline

Relative lookup table entries consist of 32-bit offsets. Do not generate relative lookup tables for large code models in 64-bit achitectures where 32-bit offsets might not be enough.

Definition at line 509 of file BasicTTIImpl.h.

References llvm::Triple::aarch64, llvm::Triple::getArch(), llvm::TargetLoweringBase::getTargetMachine(), llvm::Triple::isArch64Bit(), llvm::Triple::isOSDarwin(), llvm::CodeModel::Large, llvm::CodeModel::Medium, and TM.

◆ shouldFoldTerminatingConditionAfterLSR()

template<typename T >
bool llvm::BasicTTIImplBase< T >::shouldFoldTerminatingConditionAfterLSR ( ) const
inline

◆ shouldPrefetchAddressSpace()

template<typename T >
virtual bool llvm::BasicTTIImplBase< T >::shouldPrefetchAddressSpace ( unsigned  AS) const
inlinevirtual

Reimplemented in llvm::GCNTTIImpl.

Definition at line 742 of file BasicTTIImpl.h.

References llvm::MCSubtargetInfo::shouldPrefetchAddressSpace().

◆ simplifyDemandedUseBitsIntrinsic()

template<typename T >
std::optional< Value * > llvm::BasicTTIImplBase< T >::simplifyDemandedUseBitsIntrinsic ( InstCombiner IC,
IntrinsicInst II,
APInt  DemandedMask,
KnownBits Known,
bool KnownBitsComputed 
)
inline

◆ simplifyDemandedVectorEltsIntrinsic()

template<typename T >
std::optional< Value * > llvm::BasicTTIImplBase< T >::simplifyDemandedVectorEltsIntrinsic ( InstCombiner IC,
IntrinsicInst II,
APInt  DemandedElts,
APInt UndefElts,
APInt UndefElts2,
APInt UndefElts3,
std::function< void(Instruction *, unsigned, APInt, APInt &)>  SimplifyAndSetOp 
)
inline

◆ useAA()

template<typename T >
bool llvm::BasicTTIImplBase< T >::useAA ( ) const
inline

Definition at line 426 of file BasicTTIImpl.h.

References llvm::TargetSubtargetInfo::useAA().

Member Data Documentation

◆ DL

template<typename T >
const DataLayout& llvm::TargetTransformInfoImplBase::DL
protected

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