class TargetTransformInfo
Declaration
class TargetTransformInfo { /* full declaration omitted */ };
Description
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:111
Method Overview
- public bool LSRWithInstrQueries() const
- public TargetTransformInfo(llvm::TargetTransformInfo && Arg)
- public template <typename T> TargetTransformInfo(T Impl)
- public TargetTransformInfo(const llvm::DataLayout & DL)
- public bool allowsMisalignedMemoryAccesses(llvm::LLVMContext & Context, unsigned int BitWidth, unsigned int AddressSpace = 0, unsigned int Alignment = 1, bool * Fast = nullptr) const
- public bool areFunctionArgsABICompatible(const llvm::Function * Caller, const llvm::Function * Callee, SmallPtrSetImpl<llvm::Argument *> & Args) const
- public bool areInlineCompatible(const llvm::Function * Caller, const llvm::Function * Callee) const
- public bool canMacroFuseCmp() const
- public bool canSaveCmp(llvm::Loop * L, llvm::BranchInst ** BI, llvm::ScalarEvolution * SE, llvm::LoopInfo * LI, llvm::DominatorTree * DT, llvm::AssumptionCache * AC, llvm::TargetLibraryInfo * LibInfo) const
- public bool collectFlatAddressOperands(SmallVectorImpl<int> & OpIndexes, Intrinsic::ID IID) const
- public bool enableAggressiveInterleaving(bool LoopHasReductions) const
- public bool enableInterleavedAccessVectorization() const
- public bool enableMaskedInterleavedAccessVectorization() const
- public llvm::TargetTransformInfo::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const
- public int getAddressComputationCost(llvm::Type * Ty, llvm::ScalarEvolution * SE = nullptr, const llvm::SCEV * Ptr = nullptr) const
- public int getArithmeticInstrCost(unsigned int Opcode, llvm::Type * Ty, llvm::TargetTransformInfo::OperandValueKind Opd1Info = OK_AnyValue, llvm::TargetTransformInfo::OperandValueKind Opd2Info = OK_AnyValue, llvm::TargetTransformInfo::OperandValueProperties Opd1PropInfo = OP_None, llvm::TargetTransformInfo::OperandValueProperties Opd2PropInfo = OP_None, ArrayRef<const llvm::Value *> Args = llvm::ArrayRef<const llvm::Value *>(), const llvm::Instruction * CxtI = nullptr) const
- public int getArithmeticReductionCost(unsigned int Opcode, llvm::Type * Ty, bool IsPairwiseForm) const
- public unsigned int getAtomicMemIntrinsicMaxElementSize() const
- public int getCFInstrCost(unsigned int Opcode) const
- public llvm::Optional<unsigned int> getCacheAssociativity(llvm::TargetTransformInfo::CacheLevel Level) const
- public unsigned int getCacheLineSize() const
- public llvm::Optional<unsigned int> getCacheSize(llvm::TargetTransformInfo::CacheLevel Level) const
- public int getCallCost(const llvm::Function * F, ArrayRef<const llvm::Value *> Arguments, const llvm::User * U = nullptr) const
- public int getCallCost(llvm::FunctionType * FTy, int NumArgs = -1, const llvm::User * U = nullptr) const
- public int getCallCost(const llvm::Function * F, int NumArgs = -1, const llvm::User * U = nullptr) const
- public int getCallInstrCost(llvm::Function * F, llvm::Type * RetTy, ArrayRef<llvm::Type *> Tys) const
- public int getCastInstrCost(unsigned int Opcode, llvm::Type * Dst, llvm::Type * Src, const llvm::Instruction * I = nullptr) const
- public int getCmpSelInstrCost(unsigned int Opcode, llvm::Type * ValTy, llvm::Type * CondTy = nullptr, const llvm::Instruction * I = nullptr) const
- public unsigned int getCostOfKeepingLiveOverCall(ArrayRef<llvm::Type *> Tys) const
- public unsigned int getEstimatedNumberOfCaseClusters(const llvm::SwitchInst & SI, unsigned int & JTSize, llvm::ProfileSummaryInfo * PSI, llvm::BlockFrequencyInfo * BFI) const
- public int getExtCost(const llvm::Instruction * I, const llvm::Value * Src) const
- public int getExtractWithExtendCost(unsigned int Opcode, llvm::Type * Dst, llvm::VectorType * VecTy, unsigned int Index = -1) const
- public int getFPOpCost(llvm::Type * Ty) const
- public unsigned int getFlatAddressSpace() const
- public int getGEPCost(llvm::Type * PointeeType, const llvm::Value * Ptr, ArrayRef<const llvm::Value *> Operands) const
- public unsigned int getGISelRematGlobalCost() const
- public int getGatherScatterOpCost(unsigned int Opcode, llvm::Type * DataTy, llvm::Value * Ptr, bool VariableMask, unsigned int Alignment) const
- public int getInlinerVectorBonusPercent() const
- public unsigned int getInliningThresholdMultiplier() const
- public int getInstructionCost(const llvm::Instruction * I, enum TargetCostKind kind) const
- public int getIntImmCodeSizeCost(unsigned int Opc, unsigned int Idx, const llvm::APInt & Imm, llvm::Type * Ty) const
- public int getIntImmCost(const llvm::APInt & Imm, llvm::Type * Ty) const
- public int getIntImmCostInst(unsigned int Opc, unsigned int Idx, const llvm::APInt & Imm, llvm::Type * Ty) const
- public int getIntImmCostIntrin(Intrinsic::ID IID, unsigned int Idx, const llvm::APInt & Imm, llvm::Type * Ty) const
- public int getInterleavedMemoryOpCost(unsigned int Opcode, llvm::Type * VecTy, unsigned int Factor, ArrayRef<unsigned int> Indices, unsigned int Alignment, unsigned int AddressSpace, bool UseMaskForCond = false, bool UseMaskForGaps = false) const
- public int getIntrinsicCost(Intrinsic::ID IID, llvm::Type * RetTy, ArrayRef<llvm::Type *> ParamTys, const llvm::User * U = nullptr) const
- public int getIntrinsicCost(Intrinsic::ID IID, llvm::Type * RetTy, ArrayRef<const llvm::Value *> Arguments, const llvm::User * U = nullptr) const
- public int getIntrinsicInstrCost(Intrinsic::ID ID, llvm::Type * RetTy, ArrayRef<llvm::Value *> Args, llvm::FastMathFlags FMF, unsigned int VF = 1) const
- public int getIntrinsicInstrCost(Intrinsic::ID ID, llvm::Type * RetTy, ArrayRef<llvm::Type *> Tys, llvm::FastMathFlags FMF, unsigned int ScalarizationCostPassed = (2147483647 * 2U + 1U)) const
- public unsigned int getLoadStoreVecRegBitWidth(unsigned int AddrSpace) const
- public unsigned int getLoadVectorFactor(unsigned int VF, unsigned int LoadSize, unsigned int ChainSizeInBytes, llvm::VectorType * VecTy) const
- public int getMaskedMemoryOpCost(unsigned int Opcode, llvm::Type * Src, unsigned int Alignment, unsigned int AddressSpace) const
- public unsigned int getMaxInterleaveFactor(unsigned int VF) const
- public unsigned int getMaxPrefetchIterationsAhead() const
- public int getMemcpyCost(const llvm::Instruction * I) const
- public llvm::Type * getMemcpyLoopLoweringType(llvm::LLVMContext & Context, llvm::Value * Length, unsigned int SrcAlign, unsigned int DestAlign) const
- public void getMemcpyLoopResidualLoweringType(SmallVectorImpl<llvm::Type *> & OpsOut, llvm::LLVMContext & Context, unsigned int RemainingBytes, unsigned int SrcAlign, unsigned int DestAlign) const
- public int getMemoryOpCost(unsigned int Opcode, llvm::Type * Src, llvm::MaybeAlign Alignment, unsigned int AddressSpace, const llvm::Instruction * I = nullptr) const
- public int getMinMaxReductionCost(llvm::Type * Ty, llvm::Type * CondTy, bool IsPairwiseForm, bool IsUnsigned) const
- public unsigned int getMinPrefetchStride() const
- public unsigned int getMinVectorRegisterBitWidth() const
- public unsigned int getMinimumVF(unsigned int ElemWidth) const
- public unsigned int getNumberOfParts(llvm::Type * Tp) const
- public unsigned int getNumberOfRegisters(unsigned int ClassID) const
- public static llvm::TargetTransformInfo::OperandValueKind getOperandInfo(llvm::Value * V, llvm::TargetTransformInfo::OperandValueProperties & OpProps)
- public unsigned int getOperandsScalarizationOverhead(ArrayRef<const llvm::Value *> Args, unsigned int VF) const
- public int getOperationCost(unsigned int Opcode, llvm::Type * Ty, llvm::Type * OpTy = nullptr) const
- public llvm::Value * getOrCreateResultFromMemIntrinsic(llvm::IntrinsicInst * Inst, llvm::Type * ExpectedType) const
- public llvm::TargetTransformInfo::PopcntSupportKind getPopcntSupport(unsigned int IntTyWidthInBit) const
- public unsigned int getPrefetchDistance() const
- public unsigned int getRegisterBitWidth(bool Vector) const
- public unsigned int getRegisterClassForType(bool Vector, llvm::Type * Ty = nullptr) const
- public const char * getRegisterClassName(unsigned int ClassID) const
- public unsigned int getScalarizationOverhead(llvm::Type * Ty, bool Insert, bool Extract) const
- public int getScalingFactorCost(llvm::Type * Ty, llvm::GlobalValue * BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned int AddrSpace = 0) const
- public int getShuffleCost(llvm::TargetTransformInfo::ShuffleKind Kind, llvm::Type * Tp, int Index = 0, llvm::Type * SubTp = nullptr) const
- public unsigned int getStoreVectorFactor(unsigned int VF, unsigned int StoreSize, unsigned int ChainSizeInBytes, llvm::VectorType * VecTy) const
- public bool getTgtMemIntrinsic(llvm::IntrinsicInst * Inst, llvm::MemIntrinsicInfo & Info) const
- public void getUnrollingPreferences(llvm::Loop * L, llvm::ScalarEvolution &, llvm::TargetTransformInfo::UnrollingPreferences & UP) const
- public int getUserCost(const llvm::User * U) const
- public int getUserCost(const llvm::User * U, ArrayRef<const llvm::Value *> Operands) const
- public int getVectorInstrCost(unsigned int Opcode, llvm::Type * Val, unsigned int Index = -1) const
- public bool hasBranchDivergence() const
- public bool hasDivRemOp(llvm::Type * DataType, bool IsSigned) const
- public bool hasVolatileVariant(llvm::Instruction * I, unsigned int AddrSpace) const
- public bool haveFastSqrt(llvm::Type * Ty) const
- public bool invalidate(llvm::Function &, const llvm::PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
- public bool isAlwaysUniform(const llvm::Value * V) const
- public bool isFCmpOrdCheaperThanFCmpZero(llvm::Type * Ty) const
- public bool isFPVectorizationPotentiallyUnsafe() const
- public bool isHardwareLoopProfitable(llvm::Loop * L, llvm::ScalarEvolution & SE, llvm::AssumptionCache & AC, llvm::TargetLibraryInfo * LibInfo, llvm::HardwareLoopInfo & HWLoopInfo) const
- public bool isIndexedLoadLegal(enum MemIndexedMode Mode, llvm::Type * Ty) const
- public bool isIndexedStoreLegal(enum MemIndexedMode Mode, llvm::Type * Ty) const
- public bool isLSRCostLess(TargetTransformInfo::LSRCost & C1, TargetTransformInfo::LSRCost & C2) const
- public bool isLegalAddImmediate(int64_t Imm) const
- public bool isLegalAddressingMode(llvm::Type * Ty, llvm::GlobalValue * BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned int AddrSpace = 0, llvm::Instruction * I = nullptr) const
- public bool isLegalICmpImmediate(int64_t Imm) const
- public bool isLegalMaskedCompressStore(llvm::Type * DataType) const
- public bool isLegalMaskedExpandLoad(llvm::Type * DataType) const
- public bool isLegalMaskedGather(llvm::Type * DataType, llvm::MaybeAlign Alignment) const
- public bool isLegalMaskedLoad(llvm::Type * DataType, llvm::MaybeAlign Alignment) const
- public bool isLegalMaskedScatter(llvm::Type * DataType, llvm::MaybeAlign Alignment) const
- public bool isLegalMaskedStore(llvm::Type * DataType, llvm::MaybeAlign Alignment) const
- public bool isLegalNTLoad(llvm::Type * DataType, llvm::Align Alignment) const
- public bool isLegalNTStore(llvm::Type * DataType, llvm::Align Alignment) const
- public bool isLegalToVectorizeLoad(llvm::LoadInst * LI) const
- public bool isLegalToVectorizeLoadChain(unsigned int ChainSizeInBytes, unsigned int Alignment, unsigned int AddrSpace) const
- public bool isLegalToVectorizeStore(llvm::StoreInst * SI) const
- public bool isLegalToVectorizeStoreChain(unsigned int ChainSizeInBytes, unsigned int Alignment, unsigned int AddrSpace) const
- public bool isLoweredToCall(const llvm::Function * F) const
- public bool isProfitableToHoist(llvm::Instruction * I) const
- public bool isSourceOfDivergence(const llvm::Value * V) const
- public bool isTruncateFree(llvm::Type * Ty1, llvm::Type * Ty2) const
- public bool isTypeLegal(llvm::Type * Ty) const
- public bool preferPredicateOverEpilogue(llvm::Loop * L, llvm::LoopInfo * LI, llvm::ScalarEvolution & SE, llvm::AssumptionCache & AC, llvm::TargetLibraryInfo * TLI, llvm::DominatorTree * DT, const llvm::LoopAccessInfo * LAI) const
- public bool prefersVectorizedAddressing() const
- public bool rewriteIntrinsicWithAddressSpace(llvm::IntrinsicInst * II, llvm::Value * OldV, llvm::Value * NewV) const
- public bool shouldBuildLookupTables() const
- public bool shouldBuildLookupTablesForConstant(llvm::Constant * C) const
- public bool shouldConsiderAddressTypePromotion(const llvm::Instruction & I, bool & AllowPromotionWithoutCommonHeader) const
- public bool shouldExpandReduction(const llvm::IntrinsicInst * II) const
- public bool shouldFavorBackedgeIndex(const llvm::Loop * L) const
- public bool shouldFavorPostInc() const
- public bool shouldMaximizeVectorBandwidth(bool OptSize) const
- public bool supportsEfficientVectorElementLoadStore() const
- public bool useAA() const
- public bool useColdCCForColdCall(llvm::Function & F) const
- public bool useReductionIntrinsic(unsigned int Opcode, llvm::Type * Ty, llvm::TargetTransformInfo::ReductionFlags Flags) const
- public ~TargetTransformInfo()
Methods
¶bool LSRWithInstrQueries() const
bool LSRWithInstrQueries() const
Description
Return true if the loop strength reduce pass should make Instruction* based TTI queries to isLegalAddressingMode(). This is needed on SystemZ, where e.g. a memcpy can only have a 12 bit unsigned immediate offset and no index register.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:640
¶TargetTransformInfo(
llvm::TargetTransformInfo&& Arg)
TargetTransformInfo(
llvm::TargetTransformInfo&& Arg)
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:128
Parameters
¶template <typename T>
TargetTransformInfo(T Impl)
template <typename T>
TargetTransformInfo(T Impl)
Description
Construct a TTI object using a type implementing the \c Concept API below. This is used by targets to construct a TTI wrapping their target-specific implementation that encodes appropriate costs for their target.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:118
Templates
- T
Parameters
- T Impl
¶TargetTransformInfo(const llvm::DataLayout& DL)
TargetTransformInfo(const llvm::DataLayout& DL)
Description
Construct a baseline TTI object using a minimal implementation of the \c Concept API below. The TTI implementation will reflect the information in the DataLayout provided if non-null.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:125
Parameters
- const llvm::DataLayout& DL
¶bool allowsMisalignedMemoryAccesses(
llvm::LLVMContext& Context,
unsigned int BitWidth,
unsigned int AddressSpace = 0,
unsigned int Alignment = 1,
bool* Fast = nullptr) const
bool allowsMisalignedMemoryAccesses(
llvm::LLVMContext& Context,
unsigned int BitWidth,
unsigned int AddressSpace = 0,
unsigned int Alignment = 1,
bool* Fast = nullptr) const
Description
Determine if the target supports unaligned memory accesses.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:729
Parameters
- llvm::LLVMContext& Context
- unsigned int BitWidth
- unsigned int AddressSpace = 0
- unsigned int Alignment = 1
- bool* Fast = nullptr
¶bool areFunctionArgsABICompatible(
const llvm::Function* Caller,
const llvm::Function* Callee,
SmallPtrSetImpl<llvm::Argument*>& Args) const
bool areFunctionArgsABICompatible(
const llvm::Function* Caller,
const llvm::Function* Callee,
SmallPtrSetImpl<llvm::Argument*>& Args) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1080
Parameters
- const llvm::Function* Caller
- const llvm::Function* Callee
- SmallPtrSetImpl<llvm::Argument*>& Args
- The list of compatible arguments. The implementation may filter out any incompatible args from this list.
Returns
True if the caller and callee agree on how \p Args will be passed to the callee.
¶bool areInlineCompatible(
const llvm::Function* Caller,
const llvm::Function* Callee) const
bool areInlineCompatible(
const llvm::Function* Caller,
const llvm::Function* Callee) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1073
Parameters
- const llvm::Function* Caller
- const llvm::Function* Callee
Returns
True if the two functions have compatible attributes for inlining purposes.
¶bool canMacroFuseCmp() const
bool canMacroFuseCmp() const
Description
Return true if the target can fuse a compare and branch. Loop-strength-reduction (LSR) uses that knowledge to adjust its cost calculation for the instructions in a loop.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:573
¶bool canSaveCmp(
llvm::Loop* L,
llvm::BranchInst** BI,
llvm::ScalarEvolution* SE,
llvm::LoopInfo* LI,
llvm::DominatorTree* DT,
llvm::AssumptionCache* AC,
llvm::TargetLibraryInfo* LibInfo) const
bool canSaveCmp(
llvm::Loop* L,
llvm::BranchInst** BI,
llvm::ScalarEvolution* SE,
llvm::LoopInfo* LI,
llvm::DominatorTree* DT,
llvm::AssumptionCache* AC,
llvm::TargetLibraryInfo* LibInfo) const
Description
Return true if the target can save a compare for loop count, for example hardware loop saves a compare.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:577
Parameters
- llvm::Loop* L
- llvm::BranchInst** BI
- llvm::ScalarEvolution* SE
- llvm::LoopInfo* LI
- llvm::DominatorTree* DT
- llvm::AssumptionCache* AC
- llvm::TargetLibraryInfo* LibInfo
¶bool collectFlatAddressOperands(
SmallVectorImpl<int>& OpIndexes,
Intrinsic::ID IID) const
bool collectFlatAddressOperands(
SmallVectorImpl<int>& OpIndexes,
Intrinsic::ID IID) const
Description
Return any intrinsic address operand indexes which may be rewritten if they use a flat address space pointer.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:380
Parameters
- SmallVectorImpl<int>& OpIndexes
- Intrinsic::ID IID
Returns
true if the intrinsic was handled.
¶bool enableAggressiveInterleaving(
bool LoopHasReductions) const
bool enableAggressiveInterleaving(
bool LoopHasReductions) const
Description
Don't restrict interleaved unrolling to small loops.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:679
Parameters
- bool LoopHasReductions
¶bool enableInterleavedAccessVectorization() const
bool enableInterleavedAccessVectorization() const
Description
Enable matching of interleaved access groups.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:712
¶bool enableMaskedInterleavedAccessVectorization()
const
bool enableMaskedInterleavedAccessVectorization()
const
Description
Enable matching of interleaved access groups that contain predicated accesses or gaps and therefore vectorized using masked vector loads/stores.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:717
¶llvm::TargetTransformInfo::MemCmpExpansionOptions
enableMemCmpExpansion(bool OptSize,
bool IsZeroCmp) const
llvm::TargetTransformInfo::MemCmpExpansionOptions
enableMemCmpExpansion(bool OptSize,
bool IsZeroCmp) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:708
Parameters
- bool OptSize
- bool IsZeroCmp
¶int getAddressComputationCost(
llvm::Type* Ty,
llvm::ScalarEvolution* SE = nullptr,
const llvm::SCEV* Ptr = nullptr) const
int getAddressComputationCost(
llvm::Type* Ty,
llvm::ScalarEvolution* SE = nullptr,
const llvm::SCEV* Ptr = nullptr) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1028
Parameters
- llvm::Type* Ty
- llvm::ScalarEvolution* SE = nullptr
- const llvm::SCEV* Ptr = nullptr
Returns
The cost of the address computation. For most targets this can be merged into the instruction indexing mode. Some targets might want to distinguish between address computation for memory operations on vector types and scalar types. Such targets should override this function. The 'SE' parameter holds pointer for the scalar evolution object which is used in order to get the Ptr step value in case of constant stride. The 'Ptr' parameter holds SCEV of the access pointer.
¶int getArithmeticInstrCost(
unsigned int Opcode,
llvm::Type* Ty,
llvm::TargetTransformInfo::OperandValueKind
Opd1Info = OK_AnyValue,
llvm::TargetTransformInfo::OperandValueKind
Opd2Info = OK_AnyValue,
llvm::TargetTransformInfo::
OperandValueProperties Opd1PropInfo =
OP_None,
llvm::TargetTransformInfo::
OperandValueProperties Opd2PropInfo =
OP_None,
ArrayRef<const llvm::Value*> Args =
llvm::ArrayRef<const llvm::Value*>(),
const llvm::Instruction* CxtI = nullptr) const
int getArithmeticInstrCost(
unsigned int Opcode,
llvm::Type* Ty,
llvm::TargetTransformInfo::OperandValueKind
Opd1Info = OK_AnyValue,
llvm::TargetTransformInfo::OperandValueKind
Opd2Info = OK_AnyValue,
llvm::TargetTransformInfo::
OperandValueProperties Opd1PropInfo =
OP_None,
llvm::TargetTransformInfo::
OperandValueProperties Opd2PropInfo =
OP_None,
ArrayRef<const llvm::Value*> Args =
llvm::ArrayRef<const llvm::Value*>(),
const llvm::Instruction* CxtI = nullptr) const
Description
This is an approximation of reciprocal throughput of a math/logic op. A higher cost indicates less expected throughput. From Agner Fog's guides, reciprocal throughput is "the average number of clock cycles per instruction when the instructions are not part of a limiting dependency chain." Therefore, costs should be scaled to account for multiple execution units on the target that can process this type of instruction. For example, if there are 5 scalar integer units and 2 vector integer units that can calculate an 'add' in a single cycle, this model should indicate that the cost of the vector add instruction is 2.5 times the cost of the scalar add instruction.\p Args is an optional argument which holds the instruction operands values so the TTI can analyze those values searching for special cases or optimizations based on those values.\p CxtI is the optional original context instruction, if one exists, to provide even more information.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:906
Parameters
- unsigned int Opcode
- llvm::Type* Ty
- llvm::TargetTransformInfo::OperandValueKind Opd1Info = OK_AnyValue
- llvm::TargetTransformInfo::OperandValueKind Opd2Info = OK_AnyValue
- llvm::TargetTransformInfo::OperandValueProperties Opd1PropInfo = OP_None
- llvm::TargetTransformInfo::OperandValueProperties Opd2PropInfo = OP_None
- ArrayRef<const llvm::Value*> Args = llvm::ArrayRef<const llvm::Value *>()
- const llvm::Instruction* CxtI = nullptr
¶int getArithmeticReductionCost(
unsigned int Opcode,
llvm::Type* Ty,
bool IsPairwiseForm) const
int getArithmeticReductionCost(
unsigned int Opcode,
llvm::Type* Ty,
bool IsPairwiseForm) const
Description
Calculate the cost of performing a vector reduction. This is the cost of reducing the vector value of type \p Ty to a scalar value using the operation denoted by \p Opcode. The form of the reduction can either be a pairwise reduction or a reduction that splits the vector at every reduction level. Pairwise: (v0, v1, v2, v3) ((v0+v1), (v2+v3), undef, undef) Split: (v0, v1, v2, v3) ((v0+v2), (v1+v3), undef, undef)
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:995
Parameters
- unsigned int Opcode
- llvm::Type* Ty
- bool IsPairwiseForm
¶unsigned int getAtomicMemIntrinsicMaxElementSize()
const
unsigned int getAtomicMemIntrinsicMaxElementSize()
const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1046
Returns
The maximum element size, in bytes, for an element unordered-atomic memory intrinsic.
¶int getCFInstrCost(unsigned int Opcode) const
int getCFInstrCost(unsigned int Opcode) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:935
Parameters
- unsigned int Opcode
Returns
The expected cost of control-flow related instructions such as Phi, Ret, Br.
¶llvm::Optional<unsigned int>
getCacheAssociativity(
llvm::TargetTransformInfo::CacheLevel Level)
const
llvm::Optional<unsigned int>
getCacheAssociativity(
llvm::TargetTransformInfo::CacheLevel Level)
const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:863
Parameters
- llvm::TargetTransformInfo::CacheLevel Level
Returns
The associativity of the cache level, if available.
¶unsigned int getCacheLineSize() const
unsigned int getCacheLineSize() const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:847
Returns
The size of a cache line in bytes.
¶llvm::Optional<unsigned int> getCacheSize(
llvm::TargetTransformInfo::CacheLevel Level)
const
llvm::Optional<unsigned int> getCacheSize(
llvm::TargetTransformInfo::CacheLevel Level)
const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:860
Parameters
- llvm::TargetTransformInfo::CacheLevel Level
Returns
The size of the cache level in bytes, if available.
¶int getCallCost(
const llvm::Function* F,
ArrayRef<const llvm::Value*> Arguments,
const llvm::User* U = nullptr) const
int getCallCost(
const llvm::Function* F,
ArrayRef<const llvm::Value*> Arguments,
const llvm::User* U = nullptr) const
Description
Estimate the cost of calling a specific function when lowered. This overload allows specifying a set of candidate argument values.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:258
Parameters
- const llvm::Function* F
- ArrayRef<const llvm::Value*> Arguments
- const llvm::User* U = nullptr
¶int getCallCost(
llvm::FunctionType* FTy,
int NumArgs = -1,
const llvm::User* U = nullptr) const
int getCallCost(
llvm::FunctionType* FTy,
int NumArgs = -1,
const llvm::User* U = nullptr) const
Description
Estimate the cost of a function call when lowered. The contract for this is the same as \c getOperationCost except that it supports an interface that provides extra information specific to call instructions. This is the most basic query for estimating call cost: it only knows the function type and (potentially) the number of arguments at the call site. The latter is only interesting for varargs function types.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:245
Parameters
- llvm::FunctionType* FTy
- int NumArgs = -1
- const llvm::User* U = nullptr
¶int getCallCost(
const llvm::Function* F,
int NumArgs = -1,
const llvm::User* U = nullptr) const
int getCallCost(
const llvm::Function* F,
int NumArgs = -1,
const llvm::User* U = nullptr) const
Description
Estimate the cost of calling a specific function when lowered. This overload adds the ability to reason about the particular function being called in the event it is a library call with special lowering.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:252
Parameters
- const llvm::Function* F
- int NumArgs = -1
- const llvm::User* U = nullptr
¶int getCallInstrCost(
llvm::Function* F,
llvm::Type* RetTy,
ArrayRef<llvm::Type*> Tys) const
int getCallInstrCost(
llvm::Function* F,
llvm::Type* RetTy,
ArrayRef<llvm::Type*> Tys) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1015
Parameters
- llvm::Function* F
- llvm::Type* RetTy
- ArrayRef<llvm::Type*> Tys
Returns
The cost of Call instructions.
¶int getCastInstrCost(
unsigned int Opcode,
llvm::Type* Dst,
llvm::Type* Src,
const llvm::Instruction* I = nullptr) const
int getCastInstrCost(
unsigned int Opcode,
llvm::Type* Dst,
llvm::Type* Src,
const llvm::Instruction* I = nullptr) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:925
Parameters
- unsigned int Opcode
- llvm::Type* Dst
- llvm::Type* Src
- const llvm::Instruction* I = nullptr
Returns
The expected cost of cast instructions, such as bitcast, trunc, zext, etc. If there is an existing instruction that holds Opcode, it may be passed in the 'I' parameter.
¶int getCmpSelInstrCost(
unsigned int Opcode,
llvm::Type* ValTy,
llvm::Type* CondTy = nullptr,
const llvm::Instruction* I = nullptr) const
int getCmpSelInstrCost(
unsigned int Opcode,
llvm::Type* ValTy,
llvm::Type* CondTy = nullptr,
const llvm::Instruction* I = nullptr) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:940
Parameters
- unsigned int Opcode
- llvm::Type* ValTy
- llvm::Type* CondTy = nullptr
- const llvm::Instruction* I = nullptr
Returns
The expected cost of compare and select instructions. If there is an existing instruction that holds Opcode, it may be passed in the 'I' parameter.
¶unsigned int getCostOfKeepingLiveOverCall(
ArrayRef<llvm::Type*> Tys) const
unsigned int getCostOfKeepingLiveOverCall(
ArrayRef<llvm::Type*> Tys) const
Description
Some types may require the use of register classes that do not have any callee-saved registers, so would require a spill and fill.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1036
Parameters
- ArrayRef<llvm::Type*> Tys
Returns
The cost, if any, of keeping values of the given types alive over a callsite.
¶unsigned int getEstimatedNumberOfCaseClusters(
const llvm::SwitchInst& SI,
unsigned int& JTSize,
llvm::ProfileSummaryInfo* PSI,
llvm::BlockFrequencyInfo* BFI) const
unsigned int getEstimatedNumberOfCaseClusters(
const llvm::SwitchInst& SI,
unsigned int& JTSize,
llvm::ProfileSummaryInfo* PSI,
llvm::BlockFrequencyInfo* BFI) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:302
Parameters
- const llvm::SwitchInst& SI
- unsigned int& JTSize
- llvm::ProfileSummaryInfo* PSI
- llvm::BlockFrequencyInfo* BFI
Returns
The estimated number of case clusters when lowering \p 'SI'. \p JTSize Set a jump table size only when \p SI is suitable for a jump table.
¶int getExtCost(const llvm::Instruction* I,
const llvm::Value* Src) const
int getExtCost(const llvm::Instruction* I,
const llvm::Value* Src) const
Description
Estimate the cost of a EXT operation when lowered. The contract for this function is the same as \c getOperationCost except that it supports an interface that provides extra information specific to the EXT operation.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:234
Parameters
- const llvm::Instruction* I
- const llvm::Value* Src
¶int getExtractWithExtendCost(
unsigned int Opcode,
llvm::Type* Dst,
llvm::VectorType* VecTy,
unsigned int Index = -1) const
int getExtractWithExtendCost(
unsigned int Opcode,
llvm::Type* Dst,
llvm::VectorType* VecTy,
unsigned int Index = -1) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:930
Parameters
- unsigned int Opcode
- llvm::Type* Dst
- llvm::VectorType* VecTy
- unsigned int Index = -1
Returns
The expected cost of a sign- or zero-extended vector extract. Use -1 to indicate that there is no information about the index value.
¶int getFPOpCost(llvm::Type* Ty) const
int getFPOpCost(llvm::Type* Ty) const
Description
Return the expected cost of supporting the floating point operation of the specified type.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:748
Parameters
- llvm::Type* Ty
¶unsigned int getFlatAddressSpace() const
unsigned int getFlatAddressSpace() const
Description
This is for targets with different pointer representations which can be converted with the addrspacecast instruction. If a pointer is converted to this address space, optimizations should attempt to replace the access with the source address space.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:374
Returns
~0u if the target does not have such a flat address space to optimize away.
¶int getGEPCost(
llvm::Type* PointeeType,
const llvm::Value* Ptr,
ArrayRef<const llvm::Value*> Operands) const
int getGEPCost(
llvm::Type* PointeeType,
const llvm::Value* Ptr,
ArrayRef<const llvm::Value*> Operands) const
Description
Estimate the cost of a GEP operation when lowered. The contract for this function is the same as \c getOperationCost except that it supports an interface that provides extra information specific to the GEP operation.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:226
Parameters
- llvm::Type* PointeeType
- const llvm::Value* Ptr
- ArrayRef<const llvm::Value*> Operands
¶unsigned int getGISelRematGlobalCost() const
unsigned int getGISelRematGlobalCost() const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1150
Returns
the size cost of rematerializing a GlobalValue address relative to a stack reload.
¶int getGatherScatterOpCost(
unsigned int Opcode,
llvm::Type* DataTy,
llvm::Value* Ptr,
bool VariableMask,
unsigned int Alignment) const
int getGatherScatterOpCost(
unsigned int Opcode,
llvm::Type* DataTy,
llvm::Value* Ptr,
bool VariableMask,
unsigned int Alignment) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:963
Parameters
- unsigned int Opcode
- llvm::Type* DataTy
- llvm::Value* Ptr
- bool VariableMask
- unsigned int Alignment
Returns
The cost of Gather or Scatter operation\p Opcode - is a type of memory access Load or Store\p DataTy - a vector type of the data to be loaded or stored\p Ptr - pointer [or vector of pointers] - address[es] in memory\p VariableMask - true when the memory access is predicated with a mask that is not a compile-time constant\p Alignment - alignment of single element
¶int getInlinerVectorBonusPercent() const
int getInlinerVectorBonusPercent() const
Description
Vector bonuses: We want to more aggressively inline vector-dense kernels and apply this bonus based on the percentage of vector instructions. A bonus is applied if the vector instructions exceed 50% and half that amount is applied if it exceeds 10%. Note that these bonuses are some what arbitrary and evolved over time by accident as much as because they are principled bonuses. FIXME: It would be nice to base the bonus values on something more scientific. A target may has no bonus on vector instructions.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:279
Returns
Vector bonus in percent.
¶unsigned int getInliningThresholdMultiplier()
const
unsigned int getInliningThresholdMultiplier()
const
Description
TODO: This is a rather blunt instrument. Perhaps altering the costs of individual classes of instructions would be better.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:267
Returns
A value by which our inlining threshold should be multiplied. This is primarily used to bump up the inlining threshold wholesale on targets where calls are unusually expensive.
¶int getInstructionCost(
const llvm::Instruction* I,
enum TargetCostKind kind) const
int getInstructionCost(
const llvm::Instruction* I,
enum TargetCostKind kind) const
Description
Query the cost of a specified instruction. Clients should use this interface to query the cost of an existing instruction. The instruction must have a valid parent (basic block). Note, this method does not cache the cost calculation and it can be expensive in some cases.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:167
Parameters
- const llvm::Instruction* I
- enum TargetCostKind kind
¶int getIntImmCodeSizeCost(unsigned int Opc,
unsigned int Idx,
const llvm::APInt& Imm,
llvm::Type* Ty) const
int getIntImmCodeSizeCost(unsigned int Opc,
unsigned int Idx,
const llvm::APInt& Imm,
llvm::Type* Ty) const
Description
Return the expected cost for the given integer when optimising for size. This is different than the other integer immediate cost functions in that it is subtarget agnostic. This is useful when you e.g. target one ISA such as Aarch32 but smaller encodings could be possible with another such as Thumb. This return value is used as a penalty when the total costs for a constant is calculated (the bigger the cost, the more beneficial constant hoisting is).
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:769
Parameters
- unsigned int Opc
- unsigned int Idx
- const llvm::APInt& Imm
- llvm::Type* Ty
¶int getIntImmCost(const llvm::APInt& Imm,
llvm::Type* Ty) const
int getIntImmCost(const llvm::APInt& Imm,
llvm::Type* Ty) const
Description
Return the expected cost of materializing for the given integer immediate of the specified type.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:752
Parameters
- const llvm::APInt& Imm
- llvm::Type* Ty
¶int getIntImmCostInst(unsigned int Opc,
unsigned int Idx,
const llvm::APInt& Imm,
llvm::Type* Ty) const
int getIntImmCostInst(unsigned int Opc,
unsigned int Idx,
const llvm::APInt& Imm,
llvm::Type* Ty) const
Description
Return the expected cost of materialization for the given integer immediate of the specified type for a given instruction. The cost can be zero if the immediate can be folded into the specified instruction.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:757
Parameters
- unsigned int Opc
- unsigned int Idx
- const llvm::APInt& Imm
- llvm::Type* Ty
¶int getIntImmCostIntrin(Intrinsic::ID IID,
unsigned int Idx,
const llvm::APInt& Imm,
llvm::Type* Ty) const
int getIntImmCostIntrin(Intrinsic::ID IID,
unsigned int Idx,
const llvm::APInt& Imm,
llvm::Type* Ty) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:759
Parameters
- Intrinsic::ID IID
- unsigned int Idx
- const llvm::APInt& Imm
- llvm::Type* Ty
¶int getInterleavedMemoryOpCost(
unsigned int Opcode,
llvm::Type* VecTy,
unsigned int Factor,
ArrayRef<unsigned int> Indices,
unsigned int Alignment,
unsigned int AddressSpace,
bool UseMaskForCond = false,
bool UseMaskForGaps = false) const
int getInterleavedMemoryOpCost(
unsigned int Opcode,
llvm::Type* VecTy,
unsigned int Factor,
ArrayRef<unsigned int> Indices,
unsigned int Alignment,
unsigned int AddressSpace,
bool UseMaskForCond = false,
bool UseMaskForGaps = false) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:976
Parameters
- unsigned int Opcode
- llvm::Type* VecTy
- unsigned int Factor
- ArrayRef<unsigned int> Indices
- unsigned int Alignment
- unsigned int AddressSpace
- bool UseMaskForCond = false
- bool UseMaskForGaps = false
Returns
The cost of the interleaved memory operation.\p Opcode is the memory operation code\p VecTy is the vector type of the interleaved access.\p Factor is the interleave factor\p Indices is the indices for interleaved load members (as interleaved load allows gaps)\p Alignment is the alignment of the memory operation\p AddressSpace is address space of the pointer.\p UseMaskForCond indicates if the memory access is predicated.\p UseMaskForGaps indicates if gaps should be masked.
¶int getIntrinsicCost(
Intrinsic::ID IID,
llvm::Type* RetTy,
ArrayRef<llvm::Type*> ParamTys,
const llvm::User* U = nullptr) const
int getIntrinsicCost(
Intrinsic::ID IID,
llvm::Type* RetTy,
ArrayRef<llvm::Type*> ParamTys,
const llvm::User* U = nullptr) const
Description
Estimate the cost of an intrinsic when lowered. Mirrors the \c getCallCost method but uses an intrinsic identifier.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:284
Parameters
- Intrinsic::ID IID
- llvm::Type* RetTy
- ArrayRef<llvm::Type*> ParamTys
- const llvm::User* U = nullptr
¶int getIntrinsicCost(
Intrinsic::ID IID,
llvm::Type* RetTy,
ArrayRef<const llvm::Value*> Arguments,
const llvm::User* U = nullptr) const
int getIntrinsicCost(
Intrinsic::ID IID,
llvm::Type* RetTy,
ArrayRef<const llvm::Value*> Arguments,
const llvm::User* U = nullptr) const
Description
Estimate the cost of an intrinsic when lowered. Mirrors the \c getCallCost method but uses an intrinsic identifier.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:291
Parameters
- Intrinsic::ID IID
- llvm::Type* RetTy
- ArrayRef<const llvm::Value*> Arguments
- const llvm::User* U = nullptr
¶int getIntrinsicInstrCost(
Intrinsic::ID ID,
llvm::Type* RetTy,
ArrayRef<llvm::Value*> Args,
llvm::FastMathFlags FMF,
unsigned int VF = 1) const
int getIntrinsicInstrCost(
Intrinsic::ID ID,
llvm::Type* RetTy,
ArrayRef<llvm::Value*> Args,
llvm::FastMathFlags FMF,
unsigned int VF = 1) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1003
Parameters
- Intrinsic::ID ID
- llvm::Type* RetTy
- ArrayRef<llvm::Value*> Args
- llvm::FastMathFlags FMF
- unsigned int VF = 1
Returns
The cost of Intrinsic instructions. Analyses the real arguments. Three cases are handled: 1. scalar instruction 2. vector instruction 3. scalar instruction which is to be vectorized with VF.
¶int getIntrinsicInstrCost(
Intrinsic::ID ID,
llvm::Type* RetTy,
ArrayRef<llvm::Type*> Tys,
llvm::FastMathFlags FMF,
unsigned int ScalarizationCostPassed =
(2147483647 * 2U + 1U)) const
int getIntrinsicInstrCost(
Intrinsic::ID ID,
llvm::Type* RetTy,
ArrayRef<llvm::Type*> Tys,
llvm::FastMathFlags FMF,
unsigned int ScalarizationCostPassed =
(2147483647 * 2U + 1U)) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1010
Parameters
- Intrinsic::ID ID
- llvm::Type* RetTy
- ArrayRef<llvm::Type*> Tys
- llvm::FastMathFlags FMF
- unsigned int ScalarizationCostPassed = (2147483647 * 2U + 1U)
Returns
The cost of Intrinsic instructions. Types analysis only. If ScalarizationCostPassed is UINT_MAX, the cost of scalarizing the arguments and the return value will be computed based on types.
¶unsigned int getLoadStoreVecRegBitWidth(
unsigned int AddrSpace) const
unsigned int getLoadStoreVecRegBitWidth(
unsigned int AddrSpace) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1101
Parameters
- unsigned int AddrSpace
Returns
The bitwidth of the largest vector type that should be used to load/store in the given address space.
¶unsigned int getLoadVectorFactor(
unsigned int VF,
unsigned int LoadSize,
unsigned int ChainSizeInBytes,
llvm::VectorType* VecTy) const
unsigned int getLoadVectorFactor(
unsigned int VF,
unsigned int LoadSize,
unsigned int ChainSizeInBytes,
llvm::VectorType* VecTy) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1121
Parameters
- unsigned int VF
- unsigned int LoadSize
- unsigned int ChainSizeInBytes
- llvm::VectorType* VecTy
Returns
The new vector factor value if the target doesn't support \p SizeInBytes loads or has a better vector factor.
¶int getMaskedMemoryOpCost(
unsigned int Opcode,
llvm::Type* Src,
unsigned int Alignment,
unsigned int AddressSpace) const
int getMaskedMemoryOpCost(
unsigned int Opcode,
llvm::Type* Src,
unsigned int Alignment,
unsigned int AddressSpace) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:953
Parameters
- unsigned int Opcode
- llvm::Type* Src
- unsigned int Alignment
- unsigned int AddressSpace
Returns
The cost of masked Load and Store instructions.
¶unsigned int getMaxInterleaveFactor(
unsigned int VF) const
unsigned int getMaxInterleaveFactor(
unsigned int VF) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:884
Parameters
- unsigned int VF
Returns
The maximum interleave factor that any transform should try to perform for this target. This number depends on the level of parallelism and the number of execution units in the CPU.
¶unsigned int getMaxPrefetchIterationsAhead() const
unsigned int getMaxPrefetchIterationsAhead() const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:879
Returns
The maximum number of iterations to prefetch ahead. If the required number of iterations is more than this number, no prefetching is performed.
¶int getMemcpyCost(
const llvm::Instruction* I) const
int getMemcpyCost(
const llvm::Instruction* I) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:297
Parameters
- const llvm::Instruction* I
Returns
the expected cost of a memcpy, which could e.g. depend on the source/destination type and alignment and the number of bytes copied.
¶llvm::Type* getMemcpyLoopLoweringType(
llvm::LLVMContext& Context,
llvm::Value* Length,
unsigned int SrcAlign,
unsigned int DestAlign) const
llvm::Type* getMemcpyLoopLoweringType(
llvm::LLVMContext& Context,
llvm::Value* Length,
unsigned int SrcAlign,
unsigned int DestAlign) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1056
Parameters
- llvm::LLVMContext& Context
- llvm::Value* Length
- unsigned int SrcAlign
- unsigned int DestAlign
Returns
The type to use in a loop expansion of a memcpy call.
¶void getMemcpyLoopResidualLoweringType(
SmallVectorImpl<llvm::Type*>& OpsOut,
llvm::LLVMContext& Context,
unsigned int RemainingBytes,
unsigned int SrcAlign,
unsigned int DestAlign) const
void getMemcpyLoopResidualLoweringType(
SmallVectorImpl<llvm::Type*>& OpsOut,
llvm::LLVMContext& Context,
unsigned int RemainingBytes,
unsigned int SrcAlign,
unsigned int DestAlign) const
Description
Calculates the operand types to use when copying \p RemainingBytes of memory, where source and destination alignments are \p SrcAlign and\p DestAlign respectively.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1065
Parameters
- SmallVectorImpl<llvm::Type*>& OpsOut
- The operand types to copy RemainingBytes of memory.
- llvm::LLVMContext& Context
- unsigned int RemainingBytes
- The number of bytes to copy.
- unsigned int SrcAlign
- unsigned int DestAlign
¶int getMemoryOpCost(
unsigned int Opcode,
llvm::Type* Src,
llvm::MaybeAlign Alignment,
unsigned int AddressSpace,
const llvm::Instruction* I = nullptr) const
int getMemoryOpCost(
unsigned int Opcode,
llvm::Type* Src,
llvm::MaybeAlign Alignment,
unsigned int AddressSpace,
const llvm::Instruction* I = nullptr) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:948
Parameters
- unsigned int Opcode
- llvm::Type* Src
- llvm::MaybeAlign Alignment
- unsigned int AddressSpace
- const llvm::Instruction* I = nullptr
Returns
The cost of Load and Store instructions.
¶int getMinMaxReductionCost(llvm::Type* Ty,
llvm::Type* CondTy,
bool IsPairwiseForm,
bool IsUnsigned) const
int getMinMaxReductionCost(llvm::Type* Ty,
llvm::Type* CondTy,
bool IsPairwiseForm,
bool IsUnsigned) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:997
Parameters
- llvm::Type* Ty
- llvm::Type* CondTy
- bool IsPairwiseForm
- bool IsUnsigned
¶unsigned int getMinPrefetchStride() const
unsigned int getMinPrefetchStride() const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:874
Returns
Some HW prefetchers can handle accesses up to a certain constant stride. This is the minimum stride in bytes where it makes sense to start adding SW prefetches. The default is 1, i.e. prefetch with any stride.
¶unsigned int getMinVectorRegisterBitWidth() const
unsigned int getMinVectorRegisterBitWidth() const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:825
Returns
The width of the smallest vector register type.
¶unsigned int getMinimumVF(
unsigned int ElemWidth) const
unsigned int getMinimumVF(
unsigned int ElemWidth) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:838
Parameters
- unsigned int ElemWidth
Returns
The minimum vectorization factor for types of given element bit width, or 0 if there is no minimum VF. The returned value only applies when shouldMaximizeVectorBandwidth returns true.
¶unsigned int getNumberOfParts(
llvm::Type* Tp) const
unsigned int getNumberOfParts(
llvm::Type* Tp) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1019
Parameters
- llvm::Type* Tp
Returns
The number of pieces into which the provided type must be split during legalization. Zero is returned when the answer is unknown.
¶unsigned int getNumberOfRegisters(
unsigned int ClassID) const
unsigned int getNumberOfRegisters(
unsigned int ClassID) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:804
Parameters
- unsigned int ClassID
Returns
the number of registers in the target-provided register class.
¶static llvm::TargetTransformInfo::OperandValueKind
getOperandInfo(
llvm::Value* V,
llvm::TargetTransformInfo::
OperandValueProperties& OpProps)
static llvm::TargetTransformInfo::OperandValueKind
getOperandInfo(
llvm::Value* V,
llvm::TargetTransformInfo::
OperandValueProperties& OpProps)
Description
Collect properties of V used in cost analysis, e.g. OP_PowerOf2.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:887
Parameters
- llvm::Value* V
- llvm::TargetTransformInfo::OperandValueProperties& OpProps
¶unsigned int getOperandsScalarizationOverhead(
ArrayRef<const llvm::Value*> Args,
unsigned int VF) const
unsigned int getOperandsScalarizationOverhead(
ArrayRef<const llvm::Value*> Args,
unsigned int VF) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:670
Parameters
- ArrayRef<const llvm::Value*> Args
- unsigned int VF
¶int getOperationCost(
unsigned int Opcode,
llvm::Type* Ty,
llvm::Type* OpTy = nullptr) const
int getOperationCost(
unsigned int Opcode,
llvm::Type* Ty,
llvm::Type* OpTy = nullptr) const
Description
Estimate the cost of a specific operation when lowered. Note that this is designed to work on an arbitrary synthetic opcode, and thus work for hypothetical queries before an instruction has even been formed. However, this does *not* work for GEPs, and must not be called for a GEP instruction. Instead, use the dedicated getGEPCost interface as analyzing a GEP's cost required more information. Typically only the result type is required, and the operand type can be omitted. However, if the opcode is one of the cast instructions, the operand type is required. The returned cost is defined in terms of \c TargetCostConstants, see its comments for a detailed explanation of the cost values.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:219
Parameters
- unsigned int Opcode
- llvm::Type* Ty
- llvm::Type* OpTy = nullptr
¶llvm::Value* getOrCreateResultFromMemIntrinsic(
llvm::IntrinsicInst* Inst,
llvm::Type* ExpectedType) const
llvm::Value* getOrCreateResultFromMemIntrinsic(
llvm::IntrinsicInst* Inst,
llvm::Type* ExpectedType) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1052
Parameters
- llvm::IntrinsicInst* Inst
- llvm::Type* ExpectedType
Returns
A value which is the result of the given memory intrinsic. New instructions may be created to extract the result from the given intrinsic memory operation. Returns nullptr if the target cannot create a result from the given intrinsic.
¶llvm::TargetTransformInfo::PopcntSupportKind
getPopcntSupport(
unsigned int IntTyWidthInBit) const
llvm::TargetTransformInfo::PopcntSupportKind
getPopcntSupport(
unsigned int IntTyWidthInBit) const
Description
Return hardware support for population count.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:735
Parameters
- unsigned int IntTyWidthInBit
¶unsigned int getPrefetchDistance() const
unsigned int getPrefetchDistance() const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:868
Returns
How much before a load we should place the prefetch instruction. This is currently measured in number of instructions.
¶unsigned int getRegisterBitWidth(
bool Vector) const
unsigned int getRegisterBitWidth(
bool Vector) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:822
Parameters
- bool Vector
Returns
The width of the largest scalar or vector register type.
¶unsigned int getRegisterClassForType(
bool Vector,
llvm::Type* Ty = nullptr) const
unsigned int getRegisterClassForType(
bool Vector,
llvm::Type* Ty = nullptr) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:816
Parameters
- bool Vector
- llvm::Type* Ty = nullptr
Returns
the target-provided register class ID for the provided type, accounting for type promotion and other type-legalization techniques that the target might apply. However, it specifically does not account for the scalarization or splitting of vector types. Should a vector type require scalarization or splitting into multiple underlying vector registers, that type should be mapped to a register class containing no registers. Specifically, this is designed to provide a simple, high-level view of the register allocation later performed by the backend. These register classes don't necessarily map onto the register classes used by the backend. FIXME: It's not currently possible to determine how many registers are used by the provided type.
¶const char* getRegisterClassName(
unsigned int ClassID) const
const char* getRegisterClassName(
unsigned int ClassID) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:819
Parameters
- unsigned int ClassID
Returns
the target-provided register class name
¶unsigned int getScalarizationOverhead(
llvm::Type* Ty,
bool Insert,
bool Extract) const
unsigned int getScalarizationOverhead(
llvm::Type* Ty,
bool Insert,
bool Extract) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:668
Parameters
- llvm::Type* Ty
- bool Insert
- bool Extract
¶int getScalingFactorCost(
llvm::Type* Ty,
llvm::GlobalValue* BaseGV,
int64_t BaseOffset,
bool HasBaseReg,
int64_t Scale,
unsigned int AddrSpace = 0) const
int getScalingFactorCost(
llvm::Type* Ty,
llvm::GlobalValue* BaseGV,
int64_t BaseOffset,
bool HasBaseReg,
int64_t Scale,
unsigned int AddrSpace = 0) const
Description
Return the cost of the scaling factor used in the addressing mode represented by AM for this target, for a load/store of the specified type. If the AM is supported, the return value must be >= 0. If the AM is not supported, it returns a negative value. TODO: Handle pre/postinc as well.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:632
Parameters
- llvm::Type* Ty
- llvm::GlobalValue* BaseGV
- int64_t BaseOffset
- bool HasBaseReg
- int64_t Scale
- unsigned int AddrSpace = 0
¶int getShuffleCost(
llvm::TargetTransformInfo::ShuffleKind Kind,
llvm::Type* Tp,
int Index = 0,
llvm::Type* SubTp = nullptr) const
int getShuffleCost(
llvm::TargetTransformInfo::ShuffleKind Kind,
llvm::Type* Tp,
int Index = 0,
llvm::Type* SubTp = nullptr) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:919
Parameters
- llvm::TargetTransformInfo::ShuffleKind Kind
- llvm::Type* Tp
- int Index = 0
- llvm::Type* SubTp = nullptr
Returns
The cost of a shuffle instruction of kind Kind and of type Tp. The index and subtype parameters are used by the subvector insertion and extraction shuffle kinds to show the insert/extract point and the type of the subvector being inserted/extracted. NOTE: For subvector extractions Tp represents the source type.
¶unsigned int getStoreVectorFactor(
unsigned int VF,
unsigned int StoreSize,
unsigned int ChainSizeInBytes,
llvm::VectorType* VecTy) const
unsigned int getStoreVectorFactor(
unsigned int VF,
unsigned int StoreSize,
unsigned int ChainSizeInBytes,
llvm::VectorType* VecTy) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1127
Parameters
- unsigned int VF
- unsigned int StoreSize
- unsigned int ChainSizeInBytes
- llvm::VectorType* VecTy
Returns
The new vector factor value if the target doesn't support \p SizeInBytes stores or has a better vector factor.
¶bool getTgtMemIntrinsic(
llvm::IntrinsicInst* Inst,
llvm::MemIntrinsicInfo& Info) const
bool getTgtMemIntrinsic(
llvm::IntrinsicInst* Inst,
llvm::MemIntrinsicInfo& Info) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1042
Parameters
- llvm::IntrinsicInst* Inst
- llvm::MemIntrinsicInfo& Info
Returns
True if the intrinsic is a supported memory intrinsic. Info will contain additional information - whether the intrinsic may write or read to memory, volatility and the pointer. Info is undefined if false is returned.
¶void getUnrollingPreferences(
llvm::Loop* L,
llvm::ScalarEvolution&,
llvm::TargetTransformInfo::
UnrollingPreferences& UP) const
void getUnrollingPreferences(
llvm::Loop* L,
llvm::ScalarEvolution&,
llvm::TargetTransformInfo::
UnrollingPreferences& UP) const
Description
Get target-customized preferences for the generic loop unrolling transformation. The caller will initialize UP with the current target-independent defaults.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:512
Parameters
¶int getUserCost(const llvm::User* U) const
int getUserCost(const llvm::User* U) const
Description
This is a helper function which calls the two-argument getUserCost with \p Operands which are the current operands U has.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:332
Parameters
- const llvm::User* U
¶int getUserCost(
const llvm::User* U,
ArrayRef<const llvm::Value*> Operands) const
int getUserCost(
const llvm::User* U,
ArrayRef<const llvm::Value*> Operands) const
Description
Estimate the cost of a given IR user when lowered. This can estimate the cost of either a ConstantExpr or Instruction when lowered. It has two primary advantages over the \c getOperationCost and\c getGEPCost above, and one significant disadvantage: it can only be used when the IR construct has already been formed. The advantages are that it can inspect the SSA use graph to reason more accurately about the cost. For example, all-constant-GEPs can often be folded into a load or other instruction, but if they are used in some other context they may not be folded. This routine can distinguish such cases. \p Operands is a list of operands which can be a result of transformations of the current operands. The number of the operands on the list must equal to the number of the current operands the IR user has. Their order on the list must be the same as the order of the current operands the IR user has. The returned cost is defined in terms of \c TargetCostConstants, see its comments for a detailed explanation of the cost values.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:328
Parameters
- const llvm::User* U
- ArrayRef<const llvm::Value*> Operands
¶int getVectorInstrCost(
unsigned int Opcode,
llvm::Type* Val,
unsigned int Index = -1) const
int getVectorInstrCost(
unsigned int Opcode,
llvm::Type* Val,
unsigned int Index = -1) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:945
Parameters
- unsigned int Opcode
- llvm::Type* Val
- unsigned int Index = -1
Returns
The expected cost of vector Insert and Extract. Use -1 to indicate that there is no information on the index value.
¶bool hasBranchDivergence() const
bool hasBranchDivergence() const
Description
Return true if branch divergence exists. Branch divergence has a significantly negative impact on GPU performance when threads in the same wavefront take different paths due to conditional branches.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:343
¶bool hasDivRemOp(llvm::Type* DataType,
bool IsSigned) const
bool hasDivRemOp(llvm::Type* DataType,
bool IsSigned) const
Description
Return true if the target has a unified operation to calculate division and remainder. If so, the additional implicit multiplication and subtraction required to calculate a remainder from division are free. This can enable more aggressive transformations for division and remainder than would typically be allowed using throughput or size cost models.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:614
Parameters
- llvm::Type* DataType
- bool IsSigned
¶bool hasVolatileVariant(
llvm::Instruction* I,
unsigned int AddrSpace) const
bool hasVolatileVariant(
llvm::Instruction* I,
unsigned int AddrSpace) const
Description
Return true if the given instruction (assumed to be a memory access instruction) has a volatile variant. If that's the case then we can avoid addrspacecast to generic AS for volatile loads/stores. Default implementation returns false, which prevents address space inference for volatile loads/stores.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:621
Parameters
- llvm::Instruction* I
- unsigned int AddrSpace
¶bool haveFastSqrt(llvm::Type* Ty) const
bool haveFastSqrt(llvm::Type* Ty) const
Description
Return true if the hardware has a fast square-root instruction.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:738
Parameters
- llvm::Type* Ty
¶bool invalidate(
llvm::Function&,
const llvm::PreservedAnalyses&,
FunctionAnalysisManager::Invalidator&)
bool invalidate(
llvm::Function&,
const llvm::PreservedAnalyses&,
FunctionAnalysisManager::Invalidator&)
Description
Handle the invalidation of this information. When used as a result of \c TargetIRAnalysis this method will be called when the function this was computed for changes. When it returns false, the information is preserved across those changes.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:140
Parameters
- llvm::Function&
- const llvm::PreservedAnalyses&
- FunctionAnalysisManager::Invalidator&
¶bool isAlwaysUniform(const llvm::Value* V) const
bool isAlwaysUniform(const llvm::Value* V) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:356
Parameters
- const llvm::Value* V
¶bool isFCmpOrdCheaperThanFCmpZero(
llvm::Type* Ty) const
bool isFCmpOrdCheaperThanFCmpZero(
llvm::Type* Ty) const
Description
Return true if it is faster to check if a floating-point value is NaN (or not-NaN) versus a comparison against a constant FP zero value. Targets should override this if materializing a 0.0 for comparison is generally as cheap as checking for ordered/unordered.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:744
Parameters
- llvm::Type* Ty
¶bool isFPVectorizationPotentiallyUnsafe() const
bool isFPVectorizationPotentiallyUnsafe() const
Description
Indicate that it is potentially unsafe to automatically vectorize floating-point operations because the semantics of vector and scalar floating-point semantics may differ. For example, ARM NEON v7 SIMD math does not support IEEE-754 denormal numbers, while depending on the platform, scalar floating-point math does. This applies to floating-point math operations and calls, not memory operations, shuffles, or casts.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:726
¶bool isHardwareLoopProfitable(
llvm::Loop* L,
llvm::ScalarEvolution& SE,
llvm::AssumptionCache& AC,
llvm::TargetLibraryInfo* LibInfo,
llvm::HardwareLoopInfo& HWLoopInfo) const
bool isHardwareLoopProfitable(
llvm::Loop* L,
llvm::ScalarEvolution& SE,
llvm::AssumptionCache& AC,
llvm::TargetLibraryInfo* LibInfo,
llvm::HardwareLoopInfo& HWLoopInfo) const
Description
Query the target whether it would be profitable to convert the given loop into a hardware loop.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:517
Parameters
- llvm::Loop* L
- llvm::ScalarEvolution& SE
- llvm::AssumptionCache& AC
- llvm::TargetLibraryInfo* LibInfo
- llvm::HardwareLoopInfo& HWLoopInfo
¶bool isIndexedLoadLegal(enum MemIndexedMode Mode,
llvm::Type* Ty) const
bool isIndexedLoadLegal(enum MemIndexedMode Mode,
llvm::Type* Ty) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1094
Parameters
- enum MemIndexedMode Mode
- llvm::Type* Ty
Returns
True if the specified indexed load for the given type is legal.
¶bool isIndexedStoreLegal(enum MemIndexedMode Mode,
llvm::Type* Ty) const
bool isIndexedStoreLegal(enum MemIndexedMode Mode,
llvm::Type* Ty) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1097
Parameters
- enum MemIndexedMode Mode
- llvm::Type* Ty
Returns
True if the specified indexed store for the given type is legal.
¶bool isLSRCostLess(
TargetTransformInfo::LSRCost& C1,
TargetTransformInfo::LSRCost& C2) const
bool isLSRCostLess(
TargetTransformInfo::LSRCost& C1,
TargetTransformInfo::LSRCost& C2) const
Description
Return true if LSR cost of C1 is lower than C1.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:567
Parameters
¶bool isLegalAddImmediate(int64_t Imm) const
bool isLegalAddImmediate(int64_t Imm) const
Description
Return true if the specified immediate is legal add immediate, that is the target has add instructions which can add a register with the immediate without having to materialize the immediate into a register.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:547
Parameters
- int64_t Imm
¶bool isLegalAddressingMode(
llvm::Type* Ty,
llvm::GlobalValue* BaseGV,
int64_t BaseOffset,
bool HasBaseReg,
int64_t Scale,
unsigned int AddrSpace = 0,
llvm::Instruction* I = nullptr) const
bool isLegalAddressingMode(
llvm::Type* Ty,
llvm::GlobalValue* BaseGV,
int64_t BaseOffset,
bool HasBaseReg,
int64_t Scale,
unsigned int AddrSpace = 0,
llvm::Instruction* I = nullptr) const
Description
Return true if the addressing mode represented by AM is legal for this target, for a load/store of the specified type. The type may be VoidTy, in which case only return true if the addressing mode is legal for a load/store of any legal type. If target returns true in LSRWithInstrQueries(), I may be valid. TODO: Handle pre/postinc as well.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:561
Parameters
- llvm::Type* Ty
- llvm::GlobalValue* BaseGV
- int64_t BaseOffset
- bool HasBaseReg
- int64_t Scale
- unsigned int AddrSpace = 0
- llvm::Instruction* I = nullptr
¶bool isLegalICmpImmediate(int64_t Imm) const
bool isLegalICmpImmediate(int64_t Imm) const
Description
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructions which can compare a register against the immediate without having to materialize the immediate into a register.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:553
Parameters
- int64_t Imm
¶bool isLegalMaskedCompressStore(
llvm::Type* DataType) const
bool isLegalMaskedCompressStore(
llvm::Type* DataType) const
Description
Return true if the target supports masked compress store.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:605
Parameters
- llvm::Type* DataType
¶bool isLegalMaskedExpandLoad(
llvm::Type* DataType) const
bool isLegalMaskedExpandLoad(
llvm::Type* DataType) const
Description
Return true if the target supports masked expand load.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:607
Parameters
- llvm::Type* DataType
¶bool isLegalMaskedGather(
llvm::Type* DataType,
llvm::MaybeAlign Alignment) const
bool isLegalMaskedGather(
llvm::Type* DataType,
llvm::MaybeAlign Alignment) const
Description
Return true if the target supports masked gather.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:602
Parameters
- llvm::Type* DataType
- llvm::MaybeAlign Alignment
¶bool isLegalMaskedLoad(
llvm::Type* DataType,
llvm::MaybeAlign Alignment) const
bool isLegalMaskedLoad(
llvm::Type* DataType,
llvm::MaybeAlign Alignment) const
Description
Return true if the target supports masked load.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:592
Parameters
- llvm::Type* DataType
- llvm::MaybeAlign Alignment
¶bool isLegalMaskedScatter(
llvm::Type* DataType,
llvm::MaybeAlign Alignment) const
bool isLegalMaskedScatter(
llvm::Type* DataType,
llvm::MaybeAlign Alignment) const
Description
Return true if the target supports masked scatter.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:600
Parameters
- llvm::Type* DataType
- llvm::MaybeAlign Alignment
¶bool isLegalMaskedStore(
llvm::Type* DataType,
llvm::MaybeAlign Alignment) const
bool isLegalMaskedStore(
llvm::Type* DataType,
llvm::MaybeAlign Alignment) const
Description
Return true if the target supports masked store.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:590
Parameters
- llvm::Type* DataType
- llvm::MaybeAlign Alignment
¶bool isLegalNTLoad(llvm::Type* DataType,
llvm::Align Alignment) const
bool isLegalNTLoad(llvm::Type* DataType,
llvm::Align Alignment) const
Description
Return true if the target supports nontemporal load.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:597
Parameters
- llvm::Type* DataType
- llvm::Align Alignment
¶bool isLegalNTStore(llvm::Type* DataType,
llvm::Align Alignment) const
bool isLegalNTStore(llvm::Type* DataType,
llvm::Align Alignment) const
Description
Return true if the target supports nontemporal store.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:595
Parameters
- llvm::Type* DataType
- llvm::Align Alignment
¶bool isLegalToVectorizeLoad(
llvm::LoadInst* LI) const
bool isLegalToVectorizeLoad(
llvm::LoadInst* LI) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1104
Parameters
- llvm::LoadInst* LI
Returns
True if the load instruction is legal to vectorize.
¶bool isLegalToVectorizeLoadChain(
unsigned int ChainSizeInBytes,
unsigned int Alignment,
unsigned int AddrSpace) const
bool isLegalToVectorizeLoadChain(
unsigned int ChainSizeInBytes,
unsigned int Alignment,
unsigned int AddrSpace) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1110
Parameters
- unsigned int ChainSizeInBytes
- unsigned int Alignment
- unsigned int AddrSpace
Returns
True if it is legal to vectorize the given load chain.
¶bool isLegalToVectorizeStore(
llvm::StoreInst* SI) const
bool isLegalToVectorizeStore(
llvm::StoreInst* SI) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1107
Parameters
- llvm::StoreInst* SI
Returns
True if the store instruction is legal to vectorize.
¶bool isLegalToVectorizeStoreChain(
unsigned int ChainSizeInBytes,
unsigned int Alignment,
unsigned int AddrSpace) const
bool isLegalToVectorizeStoreChain(
unsigned int ChainSizeInBytes,
unsigned int Alignment,
unsigned int AddrSpace) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1115
Parameters
- unsigned int ChainSizeInBytes
- unsigned int Alignment
- unsigned int AddrSpace
Returns
True if it is legal to vectorize the given store chain.
¶bool isLoweredToCall(
const llvm::Function* F) const
bool isLoweredToCall(
const llvm::Function* F) const
Description
Test whether calls to a function lower to actual program function calls. The idea is to test whether the program is likely to require a 'call' instruction or equivalent in order to call the given function. FIXME: It's not clear that this is a good or useful query API. Client's should probably move to simpler cost metrics using the above. Alternatively, we could split the cost interface into distinct code-size and execution-speed costs. This would allow modelling the core of this query more accurately as a call is a single small instruction, but incurs significant execution cost.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:402
Parameters
- const llvm::Function* F
¶bool isProfitableToHoist(
llvm::Instruction* I) const
bool isProfitableToHoist(
llvm::Instruction* I) const
Description
Return true if it is profitable to hoist instruction in the then/else to before if.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:649
Parameters
¶bool isSourceOfDivergence(
const llvm::Value* V) const
bool isSourceOfDivergence(
const llvm::Value* V) const
Description
Returns whether V is a source of divergence. This function provides the target-dependent information for the target-independent LegacyDivergenceAnalysis. LegacyDivergenceAnalysis first builds the dependency graph, and then runs the reachability algorithm starting with the sources of divergence.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:351
Parameters
- const llvm::Value* V
¶bool isTruncateFree(llvm::Type* Ty1,
llvm::Type* Ty2) const
bool isTruncateFree(llvm::Type* Ty1,
llvm::Type* Ty2) const
Description
Return true if it's free to truncate a value of type Ty1 to type Ty2. e.g. On x86 it's free to truncate a i32 value in register EAX to i16 by referencing its sub-register AX.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:645
Parameters
- llvm::Type* Ty1
- llvm::Type* Ty2
¶bool isTypeLegal(llvm::Type* Ty) const
bool isTypeLegal(llvm::Type* Ty) const
Description
Return true if this type is legal.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:654
Parameters
- llvm::Type* Ty
¶bool preferPredicateOverEpilogue(
llvm::Loop* L,
llvm::LoopInfo* LI,
llvm::ScalarEvolution& SE,
llvm::AssumptionCache& AC,
llvm::TargetLibraryInfo* TLI,
llvm::DominatorTree* DT,
const llvm::LoopAccessInfo* LAI) const
bool preferPredicateOverEpilogue(
llvm::Loop* L,
llvm::LoopInfo* LI,
llvm::ScalarEvolution& SE,
llvm::AssumptionCache& AC,
llvm::TargetLibraryInfo* TLI,
llvm::DominatorTree* DT,
const llvm::LoopAccessInfo* LAI) const
Description
Query the target whether it would be prefered to create a predicated vector loop, which can avoid the need to emit a scalar epilogue loop.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:524
Parameters
- llvm::Loop* L
- llvm::LoopInfo* LI
- llvm::ScalarEvolution& SE
- llvm::AssumptionCache& AC
- llvm::TargetLibraryInfo* TLI
- llvm::DominatorTree* DT
- const llvm::LoopAccessInfo* LAI
¶bool prefersVectorizedAddressing() const
bool prefersVectorizedAddressing() const
Description
Return true if target doesn't mind addresses in vectors.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:624
¶bool rewriteIntrinsicWithAddressSpace(
llvm::IntrinsicInst* II,
llvm::Value* OldV,
llvm::Value* NewV) const
bool rewriteIntrinsicWithAddressSpace(
llvm::IntrinsicInst* II,
llvm::Value* OldV,
llvm::Value* NewV) const
Description
Rewrite intrinsic call \p II such that \p OldV will be replaced with \p NewV, which has a different address space. This should happen for every operand index that collectFlatAddressOperands returned for the intrinsic.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:387
Parameters
- llvm::IntrinsicInst* II
- llvm::Value* OldV
- llvm::Value* NewV
Returns
true if the intrinsic /// was handled.
¶bool shouldBuildLookupTables() const
bool shouldBuildLookupTables() const
Description
Return true if switches should be turned into lookup tables for the target.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:658
¶bool shouldBuildLookupTablesForConstant(
llvm::Constant* C) const
bool shouldBuildLookupTablesForConstant(
llvm::Constant* C) const
Description
Return true if switches should be turned into lookup tables containing this constant value for the target.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:662
Parameters
¶bool shouldConsiderAddressTypePromotion(
const llvm::Instruction& I,
bool& AllowPromotionWithoutCommonHeader) const
bool shouldConsiderAddressTypePromotion(
const llvm::Instruction& I,
bool& AllowPromotionWithoutCommonHeader) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:843
Parameters
- const llvm::Instruction& I
- bool& AllowPromotionWithoutCommonHeader
Returns
True if it should be considered for address type promotion.\p AllowPromotionWithoutCommonHeader Set true if promoting \p I is profitable without finding other extensions fed by the same input.
¶bool shouldExpandReduction(
const llvm::IntrinsicInst* II) const
bool shouldExpandReduction(
const llvm::IntrinsicInst* II) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1146
Parameters
- const llvm::IntrinsicInst* II
Returns
True if the target wants to expand the given reduction intrinsic into a shuffle sequence.
¶bool shouldFavorBackedgeIndex(
const llvm::Loop* L) const
bool shouldFavorBackedgeIndex(
const llvm::Loop* L) const
Description
Return true if LSR should make efforts to generate indexed addressing modes that operate across loop iterations.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:587
Parameters
- const llvm::Loop* L
¶bool shouldFavorPostInc() const
bool shouldFavorPostInc() const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:583
Returns
True is LSR should make efforts to create/preserve post-inc addressing mode expressions.
¶bool shouldMaximizeVectorBandwidth(
bool OptSize) const
bool shouldMaximizeVectorBandwidth(
bool OptSize) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:833
Parameters
- bool OptSize
Returns
True if the vectorization factor should be chosen to make the vector of the smallest element type match the size of a vector register. For wider element types, this could result in creating vectors that span multiple vector registers. If false, the vectorization factor will be chosen based on the size of the widest element type.
¶bool supportsEfficientVectorElementLoadStore()
const
bool supportsEfficientVectorElementLoadStore()
const
Description
If target has efficient vector element load/store instructions, it can return true here so that insertion/extraction costs are not added to the scalarization cost of a load/store.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:676
¶bool useAA() const
bool useAA() const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:651
¶bool useColdCCForColdCall(llvm::Function& F) const
bool useColdCCForColdCall(llvm::Function& F) const
Description
Return true if the input function which is cold at all call sites, should use coldcc calling convention.
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:666
Parameters
¶bool useReductionIntrinsic(
unsigned int Opcode,
llvm::Type* Ty,
llvm::TargetTransformInfo::ReductionFlags
Flags) const
bool useReductionIntrinsic(
unsigned int Opcode,
llvm::Type* Ty,
llvm::TargetTransformInfo::ReductionFlags
Flags) const
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:1141
Parameters
- unsigned int Opcode
- llvm::Type* Ty
- llvm::TargetTransformInfo::ReductionFlags Flags
Returns
True if the target wants to handle the given reduction idiom in the intrinsics form instead of the shuffle form.
¶~TargetTransformInfo()
~TargetTransformInfo()
Declared at: llvm/include/llvm/Analysis/TargetTransformInfo.h:133