LLVM  10.0.0
Protected Member Functions | 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 >:
[legend]
Collaboration diagram for llvm::BasicTTIImplBase< T >:
[legend]

Public Member Functions

Scalar TTI Implementations
bool allowsMisalignedMemoryAccesses (LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace, unsigned Alignment, bool *Fast) const
 
bool hasBranchDivergence ()
 
bool isSourceOfDivergence (const Value *V)
 
bool isAlwaysUniform (const Value *V)
 
unsigned getFlatAddressSpace ()
 
bool collectFlatAddressOperands (SmallVectorImpl< int > &OpIndexes, Intrinsic::ID IID) const
 
bool rewriteIntrinsicWithAddressSpace (IntrinsicInst *II, Value *OldV, Value *NewV) const
 
bool isLegalAddImmediate (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)
 
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)
 
int 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)
 
int getGEPCost (Type *PointeeType, const Value *Ptr, ArrayRef< const Value *> Operands)
 
int getExtCost (const Instruction *I, const Value *Src)
 
unsigned getIntrinsicCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< const Value *> Arguments, const User *U)
 
unsigned getIntrinsicCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< Type *> ParamTys, const User *U)
 
unsigned getEstimatedNumberOfCaseClusters (const SwitchInst &SI, unsigned &JumpTableSize, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI)
 
bool shouldBuildLookupTables ()
 
bool haveFastSqrt (Type *Ty)
 
bool isFCmpOrdCheaperThanFCmpZero (Type *Ty)
 
unsigned getFPOpCost (Type *Ty)
 
unsigned getOperationCost (unsigned Opcode, Type *Ty, Type *OpTy)
 
unsigned getInliningThresholdMultiplier ()
 
int getInlinerVectorBonusPercent ()
 
void getUnrollingPreferences (Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP)
 
bool isHardwareLoopProfitable (Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo)
 
bool preferPredicateOverEpilogue (Loop *L, LoopInfo *LI, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *TLI, DominatorTree *DT, const LoopAccessInfo *LAI)
 
int getInstructionLatency (const Instruction *I)
 
virtual Optional< unsigned > getCacheSize (TargetTransformInfo::CacheLevel Level) const
 
virtual Optional< unsigned > getCacheAssociativity (TargetTransformInfo::CacheLevel Level) const
 
virtual unsigned getCacheLineSize () const
 
virtual unsigned getPrefetchDistance () const
 
virtual unsigned getMinPrefetchStride () const
 
virtual unsigned getMaxPrefetchIterationsAhead () const
 
Vector TTI Implementations
unsigned getRegisterBitWidth (bool Vector) const
 
unsigned getScalarizationOverhead (Type *Ty, bool Insert, bool Extract)
 Estimate the overhead of scalarizing an instruction. More...
 
unsigned getOperandsScalarizationOverhead (ArrayRef< const Value *> Args, unsigned VF)
 Estimate the overhead of scalarizing an instructions unique non-constant operands. More...
 
unsigned getScalarizationOverhead (Type *VecTy, ArrayRef< const Value *> Args)
 
unsigned getMaxInterleaveFactor (unsigned VF)
 
unsigned getArithmeticInstrCost (unsigned Opcode, Type *Ty, TTI::OperandValueKind Opd1Info=TTI::OK_AnyValue, TTI::OperandValueKind Opd2Info=TTI::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo=TTI::OP_None, TTI::OperandValueProperties Opd2PropInfo=TTI::OP_None, ArrayRef< const Value *> Args=ArrayRef< const Value *>(), const Instruction *CxtI=nullptr)
 
unsigned getShuffleCost (TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
 
unsigned getCastInstrCost (unsigned Opcode, Type *Dst, Type *Src, const Instruction *I=nullptr)
 
unsigned getExtractWithExtendCost (unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index)
 
unsigned getCFInstrCost (unsigned Opcode)
 
unsigned getCmpSelInstrCost (unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I)
 
unsigned getVectorInstrCost (unsigned Opcode, Type *Val, unsigned Index)
 
unsigned getMemoryOpCost (unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, const Instruction *I=nullptr)
 
unsigned getInterleavedMemoryOpCost (unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
 
unsigned getIntrinsicInstrCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< Value *> Args, FastMathFlags FMF, unsigned VF=1)
 Get intrinsic cost based on arguments. More...
 
unsigned getIntrinsicInstrCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< Type *> Tys, FastMathFlags FMF, unsigned ScalarizationCostPassed=std::numeric_limits< unsigned >::max())
 Get intrinsic cost based on argument types. More...
 
unsigned getCallInstrCost (Function *F, Type *RetTy, ArrayRef< Type *> Tys)
 Compute a cost of the given call instruction. More...
 
unsigned getNumberOfParts (Type *Tp)
 
unsigned getAddressComputationCost (Type *Ty, ScalarEvolution *, const SCEV *)
 
unsigned getArithmeticReductionCost (unsigned Opcode, Type *Ty, bool IsPairwise)
 Try to calculate arithmetic and shuffle op costs for reduction operations. More...
 
unsigned getMinMaxReductionCost (Type *Ty, Type *CondTy, bool IsPairwise, bool)
 Try to calculate op costs for min/max reduction operations. More...
 
unsigned getVectorSplitCost ()
 
- Public Member Functions inherited from llvm::TargetTransformInfoImplCRTPBase< T >
unsigned getCallCost (const Function *F, int NumArgs, const User *U)
 
unsigned getCallCost (const Function *F, ArrayRef< const Value *> Arguments, const User *U)
 
int getGEPCost (Type *PointeeType, const Value *Ptr, ArrayRef< const Value *> Operands)
 
unsigned getIntrinsicCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< Type *> ParamTys, const User *U)
 
unsigned getIntrinsicCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< const Value *> Arguments, const User *U)
 
unsigned getUserCost (const User *U, ArrayRef< const Value *> Operands)
 
int getInstructionLatency (const Instruction *I)
 
- Public Member Functions inherited from llvm::TargetTransformInfoImplBase
 TargetTransformInfoImplBase (const TargetTransformInfoImplBase &Arg)
 
 TargetTransformInfoImplBase (TargetTransformInfoImplBase &&Arg)
 
const DataLayout & getDataLayout () const
 
unsigned getOperationCost (unsigned Opcode, Type *Ty, Type *OpTy)
 
int getGEPCost (Type *PointeeType, const Value *Ptr, ArrayRef< const Value *> Operands)
 
unsigned getEstimatedNumberOfCaseClusters (const SwitchInst &SI, unsigned &JTSize, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI)
 
int getExtCost (const Instruction *I, const Value *Src)
 
unsigned getCallCost (FunctionType *FTy, int NumArgs, const User *U)
 
unsigned getInliningThresholdMultiplier ()
 
int getInlinerVectorBonusPercent ()
 
unsigned getMemcpyCost (const Instruction *I)
 
bool hasBranchDivergence ()
 
bool isSourceOfDivergence (const Value *V)
 
bool isAlwaysUniform (const Value *V)
 
unsigned getFlatAddressSpace ()
 
bool collectFlatAddressOperands (SmallVectorImpl< int > &OpIndexes, Intrinsic::ID IID) const
 
bool rewriteIntrinsicWithAddressSpace (IntrinsicInst *II, Value *OldV, Value *NewV) const
 
bool isLoweredToCall (const Function *F)
 
bool isHardwareLoopProfitable (Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo)
 
bool preferPredicateOverEpilogue (Loop *L, LoopInfo *LI, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *TLI, DominatorTree *DT, const LoopAccessInfo *LAI) const
 
void getUnrollingPreferences (Loop *, ScalarEvolution &, TTI::UnrollingPreferences &)
 
bool isLegalAddImmediate (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)
 
bool isLSRCostLess (TTI::LSRCost &C1, TTI::LSRCost &C2)
 
bool canMacroFuseCmp ()
 
bool canSaveCmp (Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, DominatorTree *DT, AssumptionCache *AC, TargetLibraryInfo *LibInfo)
 
bool shouldFavorPostInc () const
 
bool shouldFavorBackedgeIndex (const Loop *L) const
 
bool isLegalMaskedStore (Type *DataType, MaybeAlign Alignment)
 
bool isLegalMaskedLoad (Type *DataType, MaybeAlign Alignment)
 
bool isLegalNTStore (Type *DataType, Align Alignment)
 
bool isLegalNTLoad (Type *DataType, Align Alignment)
 
bool isLegalMaskedScatter (Type *DataType, MaybeAlign Alignment)
 
bool isLegalMaskedGather (Type *DataType, MaybeAlign Alignment)
 
bool isLegalMaskedCompressStore (Type *DataType)
 
bool isLegalMaskedExpandLoad (Type *DataType)
 
bool hasDivRemOp (Type *DataType, bool IsSigned)
 
bool hasVolatileVariant (Instruction *I, unsigned AddrSpace)
 
bool prefersVectorizedAddressing ()
 
int getScalingFactorCost (Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace)
 
bool LSRWithInstrQueries ()
 
bool isTruncateFree (Type *Ty1, Type *Ty2)
 
bool isProfitableToHoist (Instruction *I)
 
bool useAA ()
 
bool isTypeLegal (Type *Ty)
 
bool shouldBuildLookupTables ()
 
bool shouldBuildLookupTablesForConstant (Constant *C)
 
bool useColdCCForColdCall (Function &F)
 
unsigned getScalarizationOverhead (Type *Ty, bool Insert, bool Extract)
 
unsigned getOperandsScalarizationOverhead (ArrayRef< const Value *> Args, unsigned VF)
 
bool supportsEfficientVectorElementLoadStore ()
 
bool enableAggressiveInterleaving (bool LoopHasReductions)
 
TTI::MemCmpExpansionOptions enableMemCmpExpansion (bool OptSize, bool IsZeroCmp) const
 
bool enableInterleavedAccessVectorization ()
 
bool enableMaskedInterleavedAccessVectorization ()
 
bool isFPVectorizationPotentiallyUnsafe ()
 
bool allowsMisalignedMemoryAccesses (LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace, unsigned Alignment, bool *Fast)
 
TTI::PopcntSupportKind getPopcntSupport (unsigned IntTyWidthInBit)
 
bool haveFastSqrt (Type *Ty)
 
bool isFCmpOrdCheaperThanFCmpZero (Type *Ty)
 
unsigned getFPOpCost (Type *Ty)
 
int getIntImmCodeSizeCost (unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty)
 
unsigned getIntImmCost (const APInt &Imm, Type *Ty)
 
unsigned getIntImmCostInst (unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty)
 
unsigned getIntImmCostIntrin (Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty)
 
unsigned getNumberOfRegisters (unsigned ClassID) const
 
unsigned getRegisterClassForType (bool Vector, Type *Ty=nullptr) const
 
const char * getRegisterClassName (unsigned ClassID) const
 
unsigned getRegisterBitWidth (bool Vector) const
 
unsigned getMinVectorRegisterBitWidth ()
 
bool shouldMaximizeVectorBandwidth (bool OptSize) const
 
unsigned getMinimumVF (unsigned ElemWidth) const
 
bool shouldConsiderAddressTypePromotion (const Instruction &I, bool &AllowPromotionWithoutCommonHeader)
 
unsigned getCacheLineSize () const
 
llvm::Optional< unsigned > getCacheSize (TargetTransformInfo::CacheLevel Level) const
 
llvm::Optional< unsigned > getCacheAssociativity (TargetTransformInfo::CacheLevel Level) const
 
unsigned getPrefetchDistance () const
 
unsigned getMinPrefetchStride () const
 
unsigned getMaxPrefetchIterationsAhead () const
 
unsigned getMaxInterleaveFactor (unsigned VF)
 
unsigned getArithmeticInstrCost (unsigned Opcode, Type *Ty, TTI::OperandValueKind Opd1Info, TTI::OperandValueKind Opd2Info, TTI::OperandValueProperties Opd1PropInfo, TTI::OperandValueProperties Opd2PropInfo, ArrayRef< const Value *> Args, const Instruction *CxtI=nullptr)
 
unsigned getShuffleCost (TTI::ShuffleKind Kind, Type *Ty, int Index, Type *SubTp)
 
unsigned getCastInstrCost (unsigned Opcode, Type *Dst, Type *Src, const Instruction *I)
 
unsigned getExtractWithExtendCost (unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index)
 
unsigned getCFInstrCost (unsigned Opcode)
 
unsigned getCmpSelInstrCost (unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I)
 
unsigned getVectorInstrCost (unsigned Opcode, Type *Val, unsigned Index)
 
unsigned getMemoryOpCost (unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, const Instruction *I)
 
unsigned getMaskedMemoryOpCost (unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace)
 
unsigned getGatherScatterOpCost (unsigned Opcode, Type *DataTy, Value *Ptr, bool VariableMask, unsigned Alignment)
 
unsigned getInterleavedMemoryOpCost (unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
 
unsigned getIntrinsicInstrCost (Intrinsic::ID ID, Type *RetTy, ArrayRef< Type *> Tys, FastMathFlags FMF, unsigned ScalarizationCostPassed)
 
unsigned getIntrinsicInstrCost (Intrinsic::ID ID, Type *RetTy, ArrayRef< Value *> Args, FastMathFlags FMF, unsigned VF)
 
unsigned getCallInstrCost (Function *F, Type *RetTy, ArrayRef< Type *> Tys)
 
unsigned getNumberOfParts (Type *Tp)
 
unsigned getAddressComputationCost (Type *Tp, ScalarEvolution *, const SCEV *)
 
unsigned getArithmeticReductionCost (unsigned, Type *, bool)
 
unsigned getMinMaxReductionCost (Type *, Type *, bool, bool)
 
unsigned getCostOfKeepingLiveOverCall (ArrayRef< Type *> Tys)
 
bool getTgtMemIntrinsic (IntrinsicInst *Inst, MemIntrinsicInfo &Info)
 
unsigned getAtomicMemIntrinsicMaxElementSize () const
 
Value * getOrCreateResultFromMemIntrinsic (IntrinsicInst *Inst, Type *ExpectedType)
 
Type * getMemcpyLoopLoweringType (LLVMContext &Context, Value *Length, unsigned SrcAlign, unsigned DestAlign) const
 
void getMemcpyLoopResidualLoweringType (SmallVectorImpl< Type *> &OpsOut, LLVMContext &Context, unsigned RemainingBytes, unsigned SrcAlign, unsigned DestAlign) const
 
bool areInlineCompatible (const Function *Caller, const Function *Callee) const
 
bool areFunctionArgsABICompatible (const Function *Caller, const Function *Callee, SmallPtrSetImpl< Argument *> &Args) 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, unsigned Alignment, unsigned AddrSpace) const
 
bool isLegalToVectorizeStoreChain (unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const
 
unsigned getLoadVectorFactor (unsigned VF, unsigned LoadSize, unsigned ChainSizeInBytes, VectorType *VecTy) const
 
unsigned getStoreVectorFactor (unsigned VF, unsigned StoreSize, unsigned ChainSizeInBytes, VectorType *VecTy) const
 
bool useReductionIntrinsic (unsigned Opcode, Type *Ty, TTI::ReductionFlags Flags) const
 
bool shouldExpandReduction (const IntrinsicInst *II) const
 
unsigned getGISelRematGlobalCost () 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)
 
bool isStridedAccess (const SCEV *Ptr)
 
const SCEVConstant * getConstantStrideStep (ScalarEvolution *SE, const SCEV *Ptr)
 
bool isConstantStridedAccessLessThan (ScalarEvolution *SE, const SCEV *Ptr, int64_t MergeDistance)
 

Additional Inherited Members

- Protected Types inherited from llvm::TargetTransformInfoImplBase
typedef TargetTransformInfo TTI
 
- Protected Attributes inherited from llvm::TargetTransformInfoImplBase
const DataLayout & DL
 

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 77 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 191 of file BasicTTIImpl.h.

◆ ~BasicTTIImplBase()

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

Member Function Documentation

◆ allowsMisalignedMemoryAccesses()

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

Definition at line 200 of file BasicTTIImpl.h.

◆ collectFlatAddressOperands()

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

Definition at line 219 of file BasicTTIImpl.h.

◆ getAddressComputationCost()

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

Definition at line 1566 of file BasicTTIImpl.h.

◆ getArithmeticInstrCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getArithmeticInstrCost ( unsigned  Opcode,
Type *  Ty,
TTI::OperandValueKind  Opd1Info = TTI::OK_AnyValue,
TTI::OperandValueKind  Opd2Info = TTI::OK_AnyValue,
TTI::OperandValueProperties  Opd1PropInfo = TTI::OP_None,
TTI::OperandValueProperties  Opd2PropInfo = TTI::OP_None,
ArrayRef< const Value *>  Args = ArrayRef<const Value *>(),
const Instruction *  CxtI = nullptr 
)
inline

◆ getArithmeticReductionCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getArithmeticReductionCost ( unsigned  Opcode,
Type *  Ty,
bool  IsPairwise 
)
inline

Try to calculate arithmetic and shuffle op costs for reduction operations.

We're assuming that reduction operation are performing the following way:

  1. Non-pairwise reduction 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.
  2. Pairwise reduction: Everything is the same except for an additional shuffle operation which is used to produce operands for pairwise kind of reductions. val1 = shufflevector<n x t> val, <n x="" t>=""> undef, <n x="" i32>=""> <i32 0, i32 2, ..., i32 n-2, i32 undef, ..., i32 undef> ----------—v-------—/ -------—v---------—/ n/2 elements n/2 elements val2 = shufflevector<n x t> val, <n x="" t>=""> undef, <n x="" i32>=""> <i32 1, i32 3, ..., i32 n-1, i32 undef, ..., i32 undef> ----------—v-------—/ -------—v---------—/ n/2 elements n/2 elements red1 = op <n x="" t>=""> val1, <n x="" t>=""> val2 Again, the operation is performed on <n x="" t>=""> vector, but the resulting vector red1 is <n/2 x t> vector.

The cost model should take into account that the actual length of the vector is reduced on each iteration.

Definition at line 1606 of file BasicTTIImpl.h.

◆ getCacheAssociativity()

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

Reimplemented in llvm::X86TTIImpl.

Definition at line 534 of file BasicTTIImpl.h.

◆ getCacheLineSize()

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

Reimplemented in llvm::PPCTTIImpl, llvm::HexagonTTIImpl, and llvm::SystemZTTIImpl.

Definition at line 544 of file BasicTTIImpl.h.

◆ getCacheSize()

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

Reimplemented in llvm::X86TTIImpl.

Definition at line 528 of file BasicTTIImpl.h.

◆ getCallInstrCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getCallInstrCost ( Function *  F,
Type *  RetTy,
ArrayRef< Type *>  Tys 
)
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 1557 of file BasicTTIImpl.h.

◆ getCastInstrCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getCastInstrCost ( unsigned  Opcode,
Type *  Dst,
Type *  Src,
const Instruction *  I = nullptr 
)
inline

◆ getCFInstrCost()

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

Definition at line 831 of file BasicTTIImpl.h.

◆ getCmpSelInstrCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getCmpSelInstrCost ( unsigned  Opcode,
Type *  ValTy,
Type *  CondTy,
const Instruction *  I 
)
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 328 of file BasicTTIImpl.h.

◆ getExtCost()

template<typename T>
int llvm::BasicTTIImplBase< T >::getExtCost ( const Instruction *  I,
const Value *  Src 
)
inline

Definition at line 294 of file BasicTTIImpl.h.

◆ getExtractWithExtendCost()

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

Definition at line 823 of file BasicTTIImpl.h.

◆ getFlatAddressSpace()

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

Definition at line 214 of file BasicTTIImpl.h.

◆ getFPOpCost()

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

Definition at line 404 of file BasicTTIImpl.h.

◆ getGEPCost()

template<typename T>
int llvm::BasicTTIImplBase< T >::getGEPCost ( Type *  PointeeType,
const Value *  Ptr,
ArrayRef< const Value *>  Operands 
)
inline

Definition at line 289 of file BasicTTIImpl.h.

◆ getInlinerVectorBonusPercent()

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

Definition at line 439 of file BasicTTIImpl.h.

◆ getInliningThresholdMultiplier()

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

Definition at line 437 of file BasicTTIImpl.h.

◆ getInstructionLatency()

template<typename T>
int llvm::BasicTTIImplBase< T >::getInstructionLatency ( const Instruction *  I)
inline

Definition at line 520 of file BasicTTIImpl.h.

◆ getInterleavedMemoryOpCost()

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

Definition at line 915 of file BasicTTIImpl.h.

◆ getIntrinsicCost() [1/2]

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getIntrinsicCost ( Intrinsic::ID  IID,
Type *  RetTy,
ArrayRef< const Value *>  Arguments,
const User *  U 
)
inline

Definition at line 306 of file BasicTTIImpl.h.

◆ getIntrinsicCost() [2/2]

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getIntrinsicCost ( Intrinsic::ID  IID,
Type *  RetTy,
ArrayRef< Type *>  ParamTys,
const User *  U 
)
inline

Definition at line 311 of file BasicTTIImpl.h.

◆ getIntrinsicInstrCost() [1/2]

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost ( Intrinsic::ID  IID,
Type *  RetTy,
ArrayRef< Value *>  Args,
FastMathFlags  FMF,
unsigned  VF = 1 
)
inline

Get intrinsic cost based on arguments.

Definition at line 1071 of file BasicTTIImpl.h.

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

◆ getIntrinsicInstrCost() [2/2]

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost ( Intrinsic::ID  IID,
Type *  RetTy,
ArrayRef< Type *>  Tys,
FastMathFlags  FMF,
unsigned  ScalarizationCostPassed = std::numeric_limits<unsigned>::max() 
)
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 1179 of file BasicTTIImpl.h.

◆ getMaxInterleaveFactor()

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

Definition at line 628 of file BasicTTIImpl.h.

◆ getMaxPrefetchIterationsAhead()

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

Definition at line 556 of file BasicTTIImpl.h.

◆ getMemoryOpCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getMemoryOpCost ( unsigned  Opcode,
Type *  Src,
MaybeAlign  Alignment,
unsigned  AddressSpace,
const Instruction *  I = nullptr 
)
inline

◆ getMinMaxReductionCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getMinMaxReductionCost ( Type *  Ty,
Type *  CondTy,
bool  IsPairwise,
bool   
)
inline

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

Parameters
CondTyConditional type for the Select instruction.

Definition at line 1656 of file BasicTTIImpl.h.

◆ getMinPrefetchStride()

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

Reimplemented in llvm::SystemZTTIImpl.

Definition at line 552 of file BasicTTIImpl.h.

◆ getNumberOfParts()

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

Definition at line 1561 of file BasicTTIImpl.h.

◆ getOperandsScalarizationOverhead()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getOperandsScalarizationOverhead ( ArrayRef< const Value *>  Args,
unsigned  VF 
)
inline

Estimate the overhead of scalarizing an instructions unique non-constant operands.

The types of the arguments are ordinarily scalar, in which case the costs are multiplied with VF.

Definition at line 588 of file BasicTTIImpl.h.

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

◆ getOperationCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getOperationCost ( unsigned  Opcode,
Type *  Ty,
Type *  OpTy 
)
inline

Definition at line 414 of file BasicTTIImpl.h.

◆ getPrefetchDistance()

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

Reimplemented in llvm::PPCTTIImpl, llvm::HexagonTTIImpl, and llvm::SystemZTTIImpl.

Definition at line 548 of file BasicTTIImpl.h.

◆ getRegisterBitWidth()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getRegisterBitWidth ( bool  Vector) const
inline

Definition at line 565 of file BasicTTIImpl.h.

◆ getScalarizationOverhead() [1/2]

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getScalarizationOverhead ( Type *  Ty,
bool  Insert,
bool  Extract 
)
inline

◆ getScalarizationOverhead() [2/2]

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getScalarizationOverhead ( Type *  VecTy,
ArrayRef< const Value *>  Args 
)
inline

Definition at line 611 of file BasicTTIImpl.h.

◆ getScalingFactorCost()

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

Definition at line 264 of file BasicTTIImpl.h.

◆ getShuffleCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getShuffleCost ( TTI::ShuffleKind  Kind,
Type *  Tp,
int  Index,
Type *  SubTp 
)
inline

Definition at line 678 of file BasicTTIImpl.h.

◆ getUnrollingPreferences()

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

Definition at line 441 of file BasicTTIImpl.h.

Referenced by llvm::ARMTTIImpl::getUnrollingPreferences().

◆ getVectorInstrCost()

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getVectorInstrCost ( unsigned  Opcode,
Type *  Val,
unsigned  Index 
)
inline

◆ getVectorSplitCost()

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

Definition at line 1723 of file BasicTTIImpl.h.

◆ hasBranchDivergence()

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

Definition at line 208 of file BasicTTIImpl.h.

◆ haveFastSqrt()

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

Definition at line 393 of file BasicTTIImpl.h.

◆ isAlwaysUniform()

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

Definition at line 212 of file BasicTTIImpl.h.

◆ isFCmpOrdCheaperThanFCmpZero()

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

Definition at line 400 of file BasicTTIImpl.h.

◆ isHardwareLoopProfitable()

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

Definition at line 506 of file BasicTTIImpl.h.

◆ isIndexedLoadLegal()

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

Definition at line 248 of file BasicTTIImpl.h.

◆ isIndexedStoreLegal()

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

Definition at line 254 of file BasicTTIImpl.h.

◆ isLegalAddImmediate()

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

Definition at line 229 of file BasicTTIImpl.h.

◆ 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 
)
inline

Definition at line 237 of file BasicTTIImpl.h.

◆ isLegalICmpImmediate()

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

Definition at line 233 of file BasicTTIImpl.h.

◆ isLSRCostLess()

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

Definition at line 260 of file BasicTTIImpl.h.

◆ isProfitableToHoist()

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

Definition at line 278 of file BasicTTIImpl.h.

◆ isSourceOfDivergence()

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

Definition at line 210 of file BasicTTIImpl.h.

◆ isTruncateFree()

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

Definition at line 274 of file BasicTTIImpl.h.

◆ isTypeLegal()

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

Definition at line 284 of file BasicTTIImpl.h.

◆ preferPredicateOverEpilogue()

template<typename T>
bool llvm::BasicTTIImplBase< T >::preferPredicateOverEpilogue ( Loop *  L,
LoopInfo *  LI,
ScalarEvolution &  SE,
AssumptionCache &  AC,
TargetLibraryInfo *  TLI,
DominatorTree *  DT,
const LoopAccessInfo *  LAI 
)
inline

Definition at line 513 of file BasicTTIImpl.h.

◆ rewriteIntrinsicWithAddressSpace()

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

Definition at line 224 of file BasicTTIImpl.h.

◆ shouldBuildLookupTables()

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

Definition at line 387 of file BasicTTIImpl.h.

◆ useAA()

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

Definition at line 282 of file BasicTTIImpl.h.


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