LLVM  5.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 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)
 
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 isFoldableMemAccessOffset (Instruction *I, int64_t Offset)
 
bool isTruncateFree (Type *Ty1, Type *Ty2)
 
bool isProfitableToHoist (Instruction *I)
 
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)
 
unsigned getIntrinsicCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< Type * > ParamTys)
 
unsigned getEstimatedNumberOfCaseClusters (const SwitchInst &SI, unsigned &JumpTableSize)
 
unsigned getJumpBufAlignment ()
 
unsigned getJumpBufSize ()
 
bool shouldBuildLookupTables ()
 
bool haveFastSqrt (Type *Ty)
 
unsigned getFPOpCost (Type *Ty)
 
unsigned getOperationCost (unsigned Opcode, Type *Ty, Type *OpTy)
 
unsigned getInliningThresholdMultiplier ()
 
void getUnrollingPreferences (Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP)
 
Vector TTI Implementations
unsigned getNumberOfRegisters (bool Vector)
 
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 * >())
 
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, unsigned Alignment, unsigned AddressSpace, const Instruction *I=nullptr)
 
unsigned getInterleavedMemoryOpCost (unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace)
 
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=UINT_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 getReductionCost (unsigned Opcode, Type *Ty, bool IsPairwise)
 Try to calculate arithmetic and shuffle op costs for reduction operations. More...
 
unsigned getVectorSplitCost ()
 
- Public Member Functions inherited from llvm::TargetTransformInfoImplCRTPBase< T >
unsigned getCallCost (const Function *F, int NumArgs)
 
unsigned getCallCost (const Function *F, ArrayRef< const Value * > Arguments)
 
int getGEPCost (Type *PointeeType, const Value *Ptr, ArrayRef< const Value * > Operands)
 
unsigned getIntrinsicCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< const Value * > Arguments)
 
unsigned getUserCost (const User *U, ArrayRef< const Value * > Operands)
 
- 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)
 
int getExtCost (const Instruction *I, const Value *Src)
 
unsigned getCallCost (FunctionType *FTy, int NumArgs)
 
unsigned getInliningThresholdMultiplier ()
 
unsigned getIntrinsicCost (Intrinsic::ID IID, Type *RetTy, ArrayRef< Type * > ParamTys)
 
bool hasBranchDivergence ()
 
bool isSourceOfDivergence (const Value *V)
 
bool isAlwaysUniform (const Value *V)
 
unsigned getFlatAddressSpace ()
 
bool isLoweredToCall (const Function *F)
 
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)
 
bool isLSRCostLess (TTI::LSRCost &C1, TTI::LSRCost &C2)
 
bool isLegalMaskedStore (Type *DataType)
 
bool isLegalMaskedLoad (Type *DataType)
 
bool isLegalMaskedScatter (Type *DataType)
 
bool isLegalMaskedGather (Type *DataType)
 
bool prefersVectorizedAddressing ()
 
int getScalingFactorCost (Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace)
 
bool isFoldableMemAccessOffset (Instruction *I, int64_t Offset)
 
bool isTruncateFree (Type *Ty1, Type *Ty2)
 
bool isProfitableToHoist (Instruction *I)
 
bool isTypeLegal (Type *Ty)
 
unsigned getJumpBufAlignment ()
 
unsigned getJumpBufSize ()
 
bool shouldBuildLookupTables ()
 
bool shouldBuildLookupTablesForConstant (Constant *C)
 
unsigned getScalarizationOverhead (Type *Ty, bool Insert, bool Extract)
 
unsigned getOperandsScalarizationOverhead (ArrayRef< const Value * > Args, unsigned VF)
 
bool supportsEfficientVectorElementLoadStore ()
 
bool enableAggressiveInterleaving (bool LoopHasReductions)
 
bool expandMemCmp (Instruction *I, unsigned &MaxLoadSize)
 
bool enableInterleavedAccessVectorization ()
 
bool isFPVectorizationPotentiallyUnsafe ()
 
bool allowsMisalignedMemoryAccesses (LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace, unsigned Alignment, bool *Fast)
 
TTI::PopcntSupportKind getPopcntSupport (unsigned IntTyWidthInBit)
 
bool haveFastSqrt (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 getIntImmCost (unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty)
 
unsigned getIntImmCost (Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty)
 
unsigned getNumberOfRegisters (bool Vector)
 
unsigned getRegisterBitWidth (bool Vector) const
 
unsigned getMinVectorRegisterBitWidth ()
 
bool shouldConsiderAddressTypePromotion (const Instruction &I, bool &AllowPromotionWithoutCommonHeader)
 
unsigned getCacheLineSize ()
 
unsigned getPrefetchDistance ()
 
unsigned getMinPrefetchStride ()
 
unsigned getMaxPrefetchIterationsAhead ()
 
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)
 
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, unsigned 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)
 
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 getReductionCost (unsigned, Type *, 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
 
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
 

Protected Member Functions

 BasicTTIImplBase (const TargetMachine *TM, const DataLayout &DL)
 
- 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 40 of file BasicTTIImpl.h.

Constructor & Destructor Documentation

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

Definition at line 77 of file BasicTTIImpl.h.

Member Function Documentation

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

Definition at line 85 of file BasicTTIImpl.h.

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

Definition at line 1097 of file BasicTTIImpl.h.

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 *>() 
)
inline
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 1088 of file BasicTTIImpl.h.

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

Definition at line 620 of file BasicTTIImpl.h.

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getCmpSelInstrCost ( unsigned  Opcode,
Type *  ValTy,
Type *  CondTy,
const Instruction *  I 
)
inline
template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getEstimatedNumberOfCaseClusters ( const SwitchInst &  SI,
unsigned &  JumpTableSize 
)
inline

Try to find the estimated number of clusters. Note that the number of clusters identified in this function could be different from the actural 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 192 of file BasicTTIImpl.h.

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

Definition at line 158 of file BasicTTIImpl.h.

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

Definition at line 612 of file BasicTTIImpl.h.

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

Definition at line 98 of file BasicTTIImpl.h.

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

Definition at line 265 of file BasicTTIImpl.h.

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

Definition at line 153 of file BasicTTIImpl.h.

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

Definition at line 290 of file BasicTTIImpl.h.

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

Definition at line 703 of file BasicTTIImpl.h.

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

Definition at line 170 of file BasicTTIImpl.h.

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

Definition at line 175 of file BasicTTIImpl.h.

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

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

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getIntrinsicInstrCost ( Intrinsic::ID  IID,
Type *  RetTy,
ArrayRef< Type * >  Tys,
FastMathFlags  FMF,
unsigned  ScalarizationCostPassed = UINT_MAX 
)
inline

Get intrinsic cost based on argument types.

If ScalarizationCostPassed is UINT_MAX, the cost of scalarizing the arguments and the return value will be computed based on types.

Definition at line 880 of file BasicTTIImpl.h.

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

Definition at line 248 of file BasicTTIImpl.h.

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

Definition at line 250 of file BasicTTIImpl.h.

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

Definition at line 427 of file BasicTTIImpl.h.

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

Definition at line 1092 of file BasicTTIImpl.h.

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

Definition at line 362 of file BasicTTIImpl.h.

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

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

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

Definition at line 271 of file BasicTTIImpl.h.

template<typename T>
unsigned llvm::BasicTTIImplBase< T >::getReductionCost ( 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 1137 of file BasicTTIImpl.h.

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

Definition at line 364 of file BasicTTIImpl.h.

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

Definition at line 410 of file BasicTTIImpl.h.

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

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

Definition at line 476 of file BasicTTIImpl.h.

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

Definition at line 292 of file BasicTTIImpl.h.

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

Definition at line 1172 of file BasicTTIImpl.h.

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

Definition at line 92 of file BasicTTIImpl.h.

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

Definition at line 258 of file BasicTTIImpl.h.

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

Definition at line 96 of file BasicTTIImpl.h.

template<typename T>
bool llvm::BasicTTIImplBase< T >::isFoldableMemAccessOffset ( Instruction *  I,
int64_t  Offset 
)
inline

Definition at line 136 of file BasicTTIImpl.h.

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

Definition at line 103 of file BasicTTIImpl.h.

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

Definition at line 111 of file BasicTTIImpl.h.

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

Definition at line 107 of file BasicTTIImpl.h.

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

Definition at line 122 of file BasicTTIImpl.h.

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

Definition at line 144 of file BasicTTIImpl.h.

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

Definition at line 94 of file BasicTTIImpl.h.

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

Definition at line 140 of file BasicTTIImpl.h.

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

Definition at line 148 of file BasicTTIImpl.h.

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

Definition at line 252 of file BasicTTIImpl.h.


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