|
@@ -49,7 +49,7 @@ class Type;
|
|
class User;
|
|
class User;
|
|
class Value;
|
|
class Value;
|
|
|
|
|
|
-/// \brief Information about a load/store intrinsic defined by the target.
|
|
|
|
|
|
+/// Information about a load/store intrinsic defined by the target.
|
|
struct MemIntrinsicInfo {
|
|
struct MemIntrinsicInfo {
|
|
/// This is the pointer that the intrinsic is loading from or storing to.
|
|
/// This is the pointer that the intrinsic is loading from or storing to.
|
|
/// If this is non-null, then analysis/optimization passes can assume that
|
|
/// If this is non-null, then analysis/optimization passes can assume that
|
|
@@ -73,18 +73,18 @@ struct MemIntrinsicInfo {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-/// \brief This pass provides access to the codegen interfaces that are needed
|
|
|
|
|
|
+/// This pass provides access to the codegen interfaces that are needed
|
|
/// for IR-level transformations.
|
|
/// for IR-level transformations.
|
|
class TargetTransformInfo {
|
|
class TargetTransformInfo {
|
|
public:
|
|
public:
|
|
- /// \brief Construct a TTI object using a type implementing the \c Concept
|
|
|
|
|
|
+ /// Construct a TTI object using a type implementing the \c Concept
|
|
/// API below.
|
|
/// API below.
|
|
///
|
|
///
|
|
/// This is used by targets to construct a TTI wrapping their target-specific
|
|
/// This is used by targets to construct a TTI wrapping their target-specific
|
|
/// implementaion that encodes appropriate costs for their target.
|
|
/// implementaion that encodes appropriate costs for their target.
|
|
template <typename T> TargetTransformInfo(T Impl);
|
|
template <typename T> TargetTransformInfo(T Impl);
|
|
|
|
|
|
- /// \brief Construct a baseline TTI object using a minimal implementation of
|
|
|
|
|
|
+ /// Construct a baseline TTI object using a minimal implementation of
|
|
/// the \c Concept API below.
|
|
/// the \c Concept API below.
|
|
///
|
|
///
|
|
/// The TTI implementation will reflect the information in the DataLayout
|
|
/// The TTI implementation will reflect the information in the DataLayout
|
|
@@ -99,7 +99,7 @@ public:
|
|
// out-of-line.
|
|
// out-of-line.
|
|
~TargetTransformInfo();
|
|
~TargetTransformInfo();
|
|
|
|
|
|
- /// \brief Handle the invalidation of this information.
|
|
|
|
|
|
+ /// Handle the invalidation of this information.
|
|
///
|
|
///
|
|
/// When used as a result of \c TargetIRAnalysis this method will be called
|
|
/// 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,
|
|
/// when the function this was computed for changes. When it returns false,
|
|
@@ -114,7 +114,7 @@ public:
|
|
/// \name Generic Target Information
|
|
/// \name Generic Target Information
|
|
/// @{
|
|
/// @{
|
|
|
|
|
|
- /// \brief The kind of cost model.
|
|
|
|
|
|
+ /// The kind of cost model.
|
|
///
|
|
///
|
|
/// There are several different cost models that can be customized by the
|
|
/// There are several different cost models that can be customized by the
|
|
/// target. The normalization of each cost model may be target specific.
|
|
/// target. The normalization of each cost model may be target specific.
|
|
@@ -124,7 +124,7 @@ public:
|
|
TCK_CodeSize ///< Instruction code size.
|
|
TCK_CodeSize ///< Instruction code size.
|
|
};
|
|
};
|
|
|
|
|
|
- /// \brief Query the cost of a specified instruction.
|
|
|
|
|
|
+ /// Query the cost of a specified instruction.
|
|
///
|
|
///
|
|
/// Clients should use this interface to query the cost of an existing
|
|
/// Clients should use this interface to query the cost of an existing
|
|
/// instruction. The instruction must have a valid parent (basic block).
|
|
/// instruction. The instruction must have a valid parent (basic block).
|
|
@@ -145,7 +145,7 @@ public:
|
|
llvm_unreachable("Unknown instruction cost kind");
|
|
llvm_unreachable("Unknown instruction cost kind");
|
|
}
|
|
}
|
|
|
|
|
|
- /// \brief Underlying constants for 'cost' values in this interface.
|
|
|
|
|
|
+ /// Underlying constants for 'cost' values in this interface.
|
|
///
|
|
///
|
|
/// Many APIs in this interface return a cost. This enum defines the
|
|
/// Many APIs in this interface return a cost. This enum defines the
|
|
/// fundamental values that should be used to interpret (and produce) those
|
|
/// fundamental values that should be used to interpret (and produce) those
|
|
@@ -169,7 +169,7 @@ public:
|
|
TCC_Expensive = 4 ///< The cost of a 'div' instruction on x86.
|
|
TCC_Expensive = 4 ///< The cost of a 'div' instruction on x86.
|
|
};
|
|
};
|
|
|
|
|
|
- /// \brief Estimate the cost of a specific operation when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of a specific operation when lowered.
|
|
///
|
|
///
|
|
/// Note that this is designed to work on an arbitrary synthetic opcode, and
|
|
/// Note that this is designed to work on an arbitrary synthetic opcode, and
|
|
/// thus work for hypothetical queries before an instruction has even been
|
|
/// thus work for hypothetical queries before an instruction has even been
|
|
@@ -185,7 +185,7 @@ public:
|
|
/// comments for a detailed explanation of the cost values.
|
|
/// comments for a detailed explanation of the cost values.
|
|
int getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy = nullptr) const;
|
|
int getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy = nullptr) const;
|
|
|
|
|
|
- /// \brief Estimate the cost of a GEP operation when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of a GEP operation when lowered.
|
|
///
|
|
///
|
|
/// The contract for this function is the same as \c getOperationCost except
|
|
/// The contract for this function is the same as \c getOperationCost except
|
|
/// that it supports an interface that provides extra information specific to
|
|
/// that it supports an interface that provides extra information specific to
|
|
@@ -193,14 +193,14 @@ public:
|
|
int getGEPCost(Type *PointeeType, const Value *Ptr,
|
|
int getGEPCost(Type *PointeeType, const Value *Ptr,
|
|
ArrayRef<const Value *> Operands) const;
|
|
ArrayRef<const Value *> Operands) const;
|
|
|
|
|
|
- /// \brief Estimate the cost of a EXT operation when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of a EXT operation when lowered.
|
|
///
|
|
///
|
|
/// The contract for this function is the same as \c getOperationCost except
|
|
/// The contract for this function is the same as \c getOperationCost except
|
|
/// that it supports an interface that provides extra information specific to
|
|
/// that it supports an interface that provides extra information specific to
|
|
/// the EXT operation.
|
|
/// the EXT operation.
|
|
int getExtCost(const Instruction *I, const Value *Src) const;
|
|
int getExtCost(const Instruction *I, const Value *Src) const;
|
|
|
|
|
|
- /// \brief Estimate the cost of a function call when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of a function call when lowered.
|
|
///
|
|
///
|
|
/// The contract for this is the same as \c getOperationCost except that it
|
|
/// The contract for this is the same as \c getOperationCost except that it
|
|
/// supports an interface that provides extra information specific to call
|
|
/// supports an interface that provides extra information specific to call
|
|
@@ -211,13 +211,13 @@ public:
|
|
/// The latter is only interesting for varargs function types.
|
|
/// The latter is only interesting for varargs function types.
|
|
int getCallCost(FunctionType *FTy, int NumArgs = -1) const;
|
|
int getCallCost(FunctionType *FTy, int NumArgs = -1) const;
|
|
|
|
|
|
- /// \brief Estimate the cost of calling a specific function when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of calling a specific function when lowered.
|
|
///
|
|
///
|
|
/// This overload adds the ability to reason about the particular function
|
|
/// This overload adds the ability to reason about the particular function
|
|
/// being called in the event it is a library call with special lowering.
|
|
/// being called in the event it is a library call with special lowering.
|
|
int getCallCost(const Function *F, int NumArgs = -1) const;
|
|
int getCallCost(const Function *F, int NumArgs = -1) const;
|
|
|
|
|
|
- /// \brief Estimate the cost of calling a specific function when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of calling a specific function when lowered.
|
|
///
|
|
///
|
|
/// This overload allows specifying a set of candidate argument values.
|
|
/// This overload allows specifying a set of candidate argument values.
|
|
int getCallCost(const Function *F, ArrayRef<const Value *> Arguments) const;
|
|
int getCallCost(const Function *F, ArrayRef<const Value *> Arguments) const;
|
|
@@ -230,13 +230,13 @@ public:
|
|
/// individual classes of instructions would be better.
|
|
/// individual classes of instructions would be better.
|
|
unsigned getInliningThresholdMultiplier() const;
|
|
unsigned getInliningThresholdMultiplier() const;
|
|
|
|
|
|
- /// \brief Estimate the cost of an intrinsic when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of an intrinsic when lowered.
|
|
///
|
|
///
|
|
/// Mirrors the \c getCallCost method but uses an intrinsic identifier.
|
|
/// Mirrors the \c getCallCost method but uses an intrinsic identifier.
|
|
int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
|
|
int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
|
|
ArrayRef<Type *> ParamTys) const;
|
|
ArrayRef<Type *> ParamTys) const;
|
|
|
|
|
|
- /// \brief Estimate the cost of an intrinsic when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of an intrinsic when lowered.
|
|
///
|
|
///
|
|
/// Mirrors the \c getCallCost method but uses an intrinsic identifier.
|
|
/// Mirrors the \c getCallCost method but uses an intrinsic identifier.
|
|
int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
|
|
int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
|
|
@@ -248,7 +248,7 @@ public:
|
|
unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI,
|
|
unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI,
|
|
unsigned &JTSize) const;
|
|
unsigned &JTSize) const;
|
|
|
|
|
|
- /// \brief Estimate the cost of a given IR user when lowered.
|
|
|
|
|
|
+ /// Estimate the cost of a given IR user when lowered.
|
|
///
|
|
///
|
|
/// This can estimate the cost of either a ConstantExpr or Instruction when
|
|
/// This can estimate the cost of either a ConstantExpr or Instruction when
|
|
/// lowered. It has two primary advantages over the \c getOperationCost and
|
|
/// lowered. It has two primary advantages over the \c getOperationCost and
|
|
@@ -271,7 +271,7 @@ public:
|
|
/// comments for a detailed explanation of the cost values.
|
|
/// comments for a detailed explanation of the cost values.
|
|
int getUserCost(const User *U, ArrayRef<const Value *> Operands) const;
|
|
int getUserCost(const User *U, ArrayRef<const Value *> Operands) const;
|
|
|
|
|
|
- /// \brief This is a helper function which calls the two-argument getUserCost
|
|
|
|
|
|
+ /// This is a helper function which calls the two-argument getUserCost
|
|
/// with \p Operands which are the current operands U has.
|
|
/// with \p Operands which are the current operands U has.
|
|
int getUserCost(const User *U) const {
|
|
int getUserCost(const User *U) const {
|
|
SmallVector<const Value *, 4> Operands(U->value_op_begin(),
|
|
SmallVector<const Value *, 4> Operands(U->value_op_begin(),
|
|
@@ -279,14 +279,14 @@ public:
|
|
return getUserCost(U, Operands);
|
|
return getUserCost(U, Operands);
|
|
}
|
|
}
|
|
|
|
|
|
- /// \brief Return true if branch divergence exists.
|
|
|
|
|
|
+ /// Return true if branch divergence exists.
|
|
///
|
|
///
|
|
/// Branch divergence has a significantly negative impact on GPU performance
|
|
/// Branch divergence has a significantly negative impact on GPU performance
|
|
/// when threads in the same wavefront take different paths due to conditional
|
|
/// when threads in the same wavefront take different paths due to conditional
|
|
/// branches.
|
|
/// branches.
|
|
bool hasBranchDivergence() const;
|
|
bool hasBranchDivergence() const;
|
|
|
|
|
|
- /// \brief Returns whether V is a source of divergence.
|
|
|
|
|
|
+ /// Returns whether V is a source of divergence.
|
|
///
|
|
///
|
|
/// This function provides the target-dependent information for
|
|
/// This function provides the target-dependent information for
|
|
/// the target-independent DivergenceAnalysis. DivergenceAnalysis first
|
|
/// the target-independent DivergenceAnalysis. DivergenceAnalysis first
|
|
@@ -294,7 +294,7 @@ public:
|
|
/// starting with the sources of divergence.
|
|
/// starting with the sources of divergence.
|
|
bool isSourceOfDivergence(const Value *V) const;
|
|
bool isSourceOfDivergence(const Value *V) const;
|
|
|
|
|
|
- // \brief Returns true for the target specific
|
|
|
|
|
|
+ // Returns true for the target specific
|
|
// set of operations which produce uniform result
|
|
// set of operations which produce uniform result
|
|
// even taking non-unform arguments
|
|
// even taking non-unform arguments
|
|
bool isAlwaysUniform(const Value *V) const;
|
|
bool isAlwaysUniform(const Value *V) const;
|
|
@@ -317,7 +317,7 @@ public:
|
|
/// optimize away.
|
|
/// optimize away.
|
|
unsigned getFlatAddressSpace() const;
|
|
unsigned getFlatAddressSpace() const;
|
|
|
|
|
|
- /// \brief Test whether calls to a function lower to actual program function
|
|
|
|
|
|
+ /// Test whether calls to a function lower to actual program function
|
|
/// calls.
|
|
/// calls.
|
|
///
|
|
///
|
|
/// The idea is to test whether the program is likely to require a 'call'
|
|
/// The idea is to test whether the program is likely to require a 'call'
|
|
@@ -424,7 +424,7 @@ public:
|
|
bool UnrollRemainder;
|
|
bool UnrollRemainder;
|
|
};
|
|
};
|
|
|
|
|
|
- /// \brief Get target-customized preferences for the generic loop unrolling
|
|
|
|
|
|
+ /// Get target-customized preferences for the generic loop unrolling
|
|
/// transformation. The caller will initialize UP with the current
|
|
/// transformation. The caller will initialize UP with the current
|
|
/// target-independent defaults.
|
|
/// target-independent defaults.
|
|
void getUnrollingPreferences(Loop *L, ScalarEvolution &,
|
|
void getUnrollingPreferences(Loop *L, ScalarEvolution &,
|
|
@@ -435,7 +435,7 @@ public:
|
|
/// \name Scalar Target Information
|
|
/// \name Scalar Target Information
|
|
/// @{
|
|
/// @{
|
|
|
|
|
|
- /// \brief Flags indicating the kind of support for population count.
|
|
|
|
|
|
+ /// Flags indicating the kind of support for population count.
|
|
///
|
|
///
|
|
/// Compared to the SW implementation, HW support is supposed to
|
|
/// Compared to the SW implementation, HW support is supposed to
|
|
/// significantly boost the performance when the population is dense, and it
|
|
/// significantly boost the performance when the population is dense, and it
|
|
@@ -445,18 +445,18 @@ public:
|
|
/// considered as "Slow".
|
|
/// considered as "Slow".
|
|
enum PopcntSupportKind { PSK_Software, PSK_SlowHardware, PSK_FastHardware };
|
|
enum PopcntSupportKind { PSK_Software, PSK_SlowHardware, PSK_FastHardware };
|
|
|
|
|
|
- /// \brief Return true if the specified immediate is legal add immediate, that
|
|
|
|
|
|
+ /// Return true if the specified immediate is legal add immediate, that
|
|
/// is the target has add instructions which can add a register with the
|
|
/// is the target has add instructions which can add a register with the
|
|
/// immediate without having to materialize the immediate into a register.
|
|
/// immediate without having to materialize the immediate into a register.
|
|
bool isLegalAddImmediate(int64_t Imm) const;
|
|
bool isLegalAddImmediate(int64_t Imm) const;
|
|
|
|
|
|
- /// \brief Return true if the specified immediate is legal icmp immediate,
|
|
|
|
|
|
+ /// Return true if the specified immediate is legal icmp immediate,
|
|
/// that is the target has icmp instructions which can compare a register
|
|
/// that is the target has icmp instructions which can compare a register
|
|
/// against the immediate without having to materialize the immediate into a
|
|
/// against the immediate without having to materialize the immediate into a
|
|
/// register.
|
|
/// register.
|
|
bool isLegalICmpImmediate(int64_t Imm) const;
|
|
bool isLegalICmpImmediate(int64_t Imm) const;
|
|
|
|
|
|
- /// \brief Return true if the addressing mode represented by AM is legal for
|
|
|
|
|
|
+ /// Return true if the addressing mode represented by AM is legal for
|
|
/// this target, for a load/store of the specified type.
|
|
/// this target, for a load/store of the specified type.
|
|
/// The type may be VoidTy, in which case only return true if the addressing
|
|
/// 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.
|
|
/// mode is legal for a load/store of any legal type.
|
|
@@ -467,7 +467,7 @@ public:
|
|
unsigned AddrSpace = 0,
|
|
unsigned AddrSpace = 0,
|
|
Instruction *I = nullptr) const;
|
|
Instruction *I = nullptr) const;
|
|
|
|
|
|
- /// \brief Return true if LSR cost of C1 is lower than C1.
|
|
|
|
|
|
+ /// Return true if LSR cost of C1 is lower than C1.
|
|
bool isLSRCostLess(TargetTransformInfo::LSRCost &C1,
|
|
bool isLSRCostLess(TargetTransformInfo::LSRCost &C1,
|
|
TargetTransformInfo::LSRCost &C2) const;
|
|
TargetTransformInfo::LSRCost &C2) const;
|
|
|
|
|
|
@@ -480,12 +480,12 @@ public:
|
|
/// addressing mode expressions.
|
|
/// addressing mode expressions.
|
|
bool shouldFavorPostInc() const;
|
|
bool shouldFavorPostInc() const;
|
|
|
|
|
|
- /// \brief Return true if the target supports masked load/store
|
|
|
|
|
|
+ /// Return true if the target supports masked load/store
|
|
/// AVX2 and AVX-512 targets allow masks for consecutive load and store
|
|
/// AVX2 and AVX-512 targets allow masks for consecutive load and store
|
|
bool isLegalMaskedStore(Type *DataType) const;
|
|
bool isLegalMaskedStore(Type *DataType) const;
|
|
bool isLegalMaskedLoad(Type *DataType) const;
|
|
bool isLegalMaskedLoad(Type *DataType) const;
|
|
|
|
|
|
- /// \brief Return true if the target supports masked gather/scatter
|
|
|
|
|
|
+ /// Return true if the target supports masked gather/scatter
|
|
/// AVX-512 fully supports gather and scatter for vectors with 32 and 64
|
|
/// AVX-512 fully supports gather and scatter for vectors with 32 and 64
|
|
/// bits scalar type.
|
|
/// bits scalar type.
|
|
bool isLegalMaskedScatter(Type *DataType) const;
|
|
bool isLegalMaskedScatter(Type *DataType) const;
|
|
@@ -508,7 +508,7 @@ public:
|
|
/// Return true if target doesn't mind addresses in vectors.
|
|
/// Return true if target doesn't mind addresses in vectors.
|
|
bool prefersVectorizedAddressing() const;
|
|
bool prefersVectorizedAddressing() const;
|
|
|
|
|
|
- /// \brief Return the cost of the scaling factor used in the addressing
|
|
|
|
|
|
+ /// Return the cost of the scaling factor used in the addressing
|
|
/// mode represented by AM for this target, for a load/store
|
|
/// mode represented by AM for this target, for a load/store
|
|
/// of the specified type.
|
|
/// of the specified type.
|
|
/// If the AM is supported, the return value must be >= 0.
|
|
/// If the AM is supported, the return value must be >= 0.
|
|
@@ -518,41 +518,41 @@ public:
|
|
bool HasBaseReg, int64_t Scale,
|
|
bool HasBaseReg, int64_t Scale,
|
|
unsigned AddrSpace = 0) const;
|
|
unsigned AddrSpace = 0) const;
|
|
|
|
|
|
- /// \brief Return true if the loop strength reduce pass should make
|
|
|
|
|
|
+ /// Return true if the loop strength reduce pass should make
|
|
/// Instruction* based TTI queries to isLegalAddressingMode(). This is
|
|
/// Instruction* based TTI queries to isLegalAddressingMode(). This is
|
|
/// needed on SystemZ, where e.g. a memcpy can only have a 12 bit unsigned
|
|
/// needed on SystemZ, where e.g. a memcpy can only have a 12 bit unsigned
|
|
/// immediate offset and no index register.
|
|
/// immediate offset and no index register.
|
|
bool LSRWithInstrQueries() const;
|
|
bool LSRWithInstrQueries() const;
|
|
|
|
|
|
- /// \brief Return true if it's free to truncate a value of type Ty1 to type
|
|
|
|
|
|
+ /// 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
|
|
/// Ty2. e.g. On x86 it's free to truncate a i32 value in register EAX to i16
|
|
/// by referencing its sub-register AX.
|
|
/// by referencing its sub-register AX.
|
|
bool isTruncateFree(Type *Ty1, Type *Ty2) const;
|
|
bool isTruncateFree(Type *Ty1, Type *Ty2) const;
|
|
|
|
|
|
- /// \brief Return true if it is profitable to hoist instruction in the
|
|
|
|
|
|
+ /// Return true if it is profitable to hoist instruction in the
|
|
/// then/else to before if.
|
|
/// then/else to before if.
|
|
bool isProfitableToHoist(Instruction *I) const;
|
|
bool isProfitableToHoist(Instruction *I) const;
|
|
|
|
|
|
bool useAA() const;
|
|
bool useAA() const;
|
|
|
|
|
|
- /// \brief Return true if this type is legal.
|
|
|
|
|
|
+ /// Return true if this type is legal.
|
|
bool isTypeLegal(Type *Ty) const;
|
|
bool isTypeLegal(Type *Ty) const;
|
|
|
|
|
|
- /// \brief Returns the target's jmp_buf alignment in bytes.
|
|
|
|
|
|
+ /// Returns the target's jmp_buf alignment in bytes.
|
|
unsigned getJumpBufAlignment() const;
|
|
unsigned getJumpBufAlignment() const;
|
|
|
|
|
|
- /// \brief Returns the target's jmp_buf size in bytes.
|
|
|
|
|
|
+ /// Returns the target's jmp_buf size in bytes.
|
|
unsigned getJumpBufSize() const;
|
|
unsigned getJumpBufSize() const;
|
|
|
|
|
|
- /// \brief Return true if switches should be turned into lookup tables for the
|
|
|
|
|
|
+ /// Return true if switches should be turned into lookup tables for the
|
|
/// target.
|
|
/// target.
|
|
bool shouldBuildLookupTables() const;
|
|
bool shouldBuildLookupTables() const;
|
|
|
|
|
|
- /// \brief Return true if switches should be turned into lookup tables
|
|
|
|
|
|
+ /// Return true if switches should be turned into lookup tables
|
|
/// containing this constant value for the target.
|
|
/// containing this constant value for the target.
|
|
bool shouldBuildLookupTablesForConstant(Constant *C) const;
|
|
bool shouldBuildLookupTablesForConstant(Constant *C) const;
|
|
|
|
|
|
- /// \brief Return true if the input function which is cold at all call sites,
|
|
|
|
|
|
+ /// Return true if the input function which is cold at all call sites,
|
|
/// should use coldcc calling convention.
|
|
/// should use coldcc calling convention.
|
|
bool useColdCCForColdCall(Function &F) const;
|
|
bool useColdCCForColdCall(Function &F) const;
|
|
|
|
|
|
@@ -566,10 +566,10 @@ public:
|
|
/// the scalarization cost of a load/store.
|
|
/// the scalarization cost of a load/store.
|
|
bool supportsEfficientVectorElementLoadStore() const;
|
|
bool supportsEfficientVectorElementLoadStore() const;
|
|
|
|
|
|
- /// \brief Don't restrict interleaved unrolling to small loops.
|
|
|
|
|
|
+ /// Don't restrict interleaved unrolling to small loops.
|
|
bool enableAggressiveInterleaving(bool LoopHasReductions) const;
|
|
bool enableAggressiveInterleaving(bool LoopHasReductions) const;
|
|
|
|
|
|
- /// \brief If not nullptr, enable inline expansion of memcmp. IsZeroCmp is
|
|
|
|
|
|
+ /// If not nullptr, enable inline expansion of memcmp. IsZeroCmp is
|
|
/// true if this is the expansion of memcmp(p1, p2, s) == 0.
|
|
/// true if this is the expansion of memcmp(p1, p2, s) == 0.
|
|
struct MemCmpExpansionOptions {
|
|
struct MemCmpExpansionOptions {
|
|
// The list of available load sizes (in bytes), sorted in decreasing order.
|
|
// The list of available load sizes (in bytes), sorted in decreasing order.
|
|
@@ -577,10 +577,10 @@ public:
|
|
};
|
|
};
|
|
const MemCmpExpansionOptions *enableMemCmpExpansion(bool IsZeroCmp) const;
|
|
const MemCmpExpansionOptions *enableMemCmpExpansion(bool IsZeroCmp) const;
|
|
|
|
|
|
- /// \brief Enable matching of interleaved access groups.
|
|
|
|
|
|
+ /// Enable matching of interleaved access groups.
|
|
bool enableInterleavedAccessVectorization() const;
|
|
bool enableInterleavedAccessVectorization() const;
|
|
|
|
|
|
- /// \brief Indicate that it is potentially unsafe to automatically vectorize
|
|
|
|
|
|
+ /// Indicate that it is potentially unsafe to automatically vectorize
|
|
/// floating-point operations because the semantics of vector and scalar
|
|
/// floating-point operations because the semantics of vector and scalar
|
|
/// floating-point semantics may differ. For example, ARM NEON v7 SIMD math
|
|
/// floating-point semantics may differ. For example, ARM NEON v7 SIMD math
|
|
/// does not support IEEE-754 denormal numbers, while depending on the
|
|
/// does not support IEEE-754 denormal numbers, while depending on the
|
|
@@ -589,16 +589,16 @@ public:
|
|
/// operations, shuffles, or casts.
|
|
/// operations, shuffles, or casts.
|
|
bool isFPVectorizationPotentiallyUnsafe() const;
|
|
bool isFPVectorizationPotentiallyUnsafe() const;
|
|
|
|
|
|
- /// \brief Determine if the target supports unaligned memory accesses.
|
|
|
|
|
|
+ /// Determine if the target supports unaligned memory accesses.
|
|
bool allowsMisalignedMemoryAccesses(LLVMContext &Context,
|
|
bool allowsMisalignedMemoryAccesses(LLVMContext &Context,
|
|
unsigned BitWidth, unsigned AddressSpace = 0,
|
|
unsigned BitWidth, unsigned AddressSpace = 0,
|
|
unsigned Alignment = 1,
|
|
unsigned Alignment = 1,
|
|
bool *Fast = nullptr) const;
|
|
bool *Fast = nullptr) const;
|
|
|
|
|
|
- /// \brief Return hardware support for population count.
|
|
|
|
|
|
+ /// Return hardware support for population count.
|
|
PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const;
|
|
PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const;
|
|
|
|
|
|
- /// \brief Return true if the hardware has a fast square-root instruction.
|
|
|
|
|
|
+ /// Return true if the hardware has a fast square-root instruction.
|
|
bool haveFastSqrt(Type *Ty) const;
|
|
bool haveFastSqrt(Type *Ty) const;
|
|
|
|
|
|
/// Return true if it is faster to check if a floating-point value is NaN
|
|
/// Return true if it is faster to check if a floating-point value is NaN
|
|
@@ -607,15 +607,15 @@ public:
|
|
/// generally as cheap as checking for ordered/unordered.
|
|
/// generally as cheap as checking for ordered/unordered.
|
|
bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) const;
|
|
bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) const;
|
|
|
|
|
|
- /// \brief Return the expected cost of supporting the floating point operation
|
|
|
|
|
|
+ /// Return the expected cost of supporting the floating point operation
|
|
/// of the specified type.
|
|
/// of the specified type.
|
|
int getFPOpCost(Type *Ty) const;
|
|
int getFPOpCost(Type *Ty) const;
|
|
|
|
|
|
- /// \brief Return the expected cost of materializing for the given integer
|
|
|
|
|
|
+ /// Return the expected cost of materializing for the given integer
|
|
/// immediate of the specified type.
|
|
/// immediate of the specified type.
|
|
int getIntImmCost(const APInt &Imm, Type *Ty) const;
|
|
int getIntImmCost(const APInt &Imm, Type *Ty) const;
|
|
|
|
|
|
- /// \brief Return the expected cost of materialization for the given integer
|
|
|
|
|
|
+ /// Return the expected cost of materialization for the given integer
|
|
/// immediate of the specified type for a given instruction. The cost can be
|
|
/// immediate of the specified type for a given instruction. The cost can be
|
|
/// zero if the immediate can be folded into the specified instruction.
|
|
/// zero if the immediate can be folded into the specified instruction.
|
|
int getIntImmCost(unsigned Opc, unsigned Idx, const APInt &Imm,
|
|
int getIntImmCost(unsigned Opc, unsigned Idx, const APInt &Imm,
|
|
@@ -623,7 +623,7 @@ public:
|
|
int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
|
|
int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
|
|
Type *Ty) const;
|
|
Type *Ty) const;
|
|
|
|
|
|
- /// \brief Return the expected cost for the given integer when optimising
|
|
|
|
|
|
+ /// Return the expected cost for the given integer when optimising
|
|
/// for size. This is different than the other integer immediate cost
|
|
/// 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.
|
|
/// 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
|
|
/// target one ISA such as Aarch32 but smaller encodings could be possible
|
|
@@ -637,7 +637,7 @@ public:
|
|
/// \name Vector Target Information
|
|
/// \name Vector Target Information
|
|
/// @{
|
|
/// @{
|
|
|
|
|
|
- /// \brief The various kinds of shuffle patterns for vector queries.
|
|
|
|
|
|
+ /// The various kinds of shuffle patterns for vector queries.
|
|
enum ShuffleKind {
|
|
enum ShuffleKind {
|
|
SK_Broadcast, ///< Broadcast element 0 to all other elements.
|
|
SK_Broadcast, ///< Broadcast element 0 to all other elements.
|
|
SK_Reverse, ///< Reverse the order of the vector.
|
|
SK_Reverse, ///< Reverse the order of the vector.
|
|
@@ -651,7 +651,7 @@ public:
|
|
///< shuffle mask.
|
|
///< shuffle mask.
|
|
};
|
|
};
|
|
|
|
|
|
- /// \brief Additional information about an operand's possible values.
|
|
|
|
|
|
+ /// Additional information about an operand's possible values.
|
|
enum OperandValueKind {
|
|
enum OperandValueKind {
|
|
OK_AnyValue, // Operand can have any value.
|
|
OK_AnyValue, // Operand can have any value.
|
|
OK_UniformValue, // Operand is uniform (splat of a value).
|
|
OK_UniformValue, // Operand is uniform (splat of a value).
|
|
@@ -659,7 +659,7 @@ public:
|
|
OK_NonUniformConstantValue // Operand is a non uniform constant value.
|
|
OK_NonUniformConstantValue // Operand is a non uniform constant value.
|
|
};
|
|
};
|
|
|
|
|
|
- /// \brief Additional properties of an operand's values.
|
|
|
|
|
|
+ /// Additional properties of an operand's values.
|
|
enum OperandValueProperties { OP_None = 0, OP_PowerOf2 = 1 };
|
|
enum OperandValueProperties { OP_None = 0, OP_PowerOf2 = 1 };
|
|
|
|
|
|
/// \return The number of scalar or vector registers that the target has.
|
|
/// \return The number of scalar or vector registers that the target has.
|
|
@@ -812,7 +812,7 @@ public:
|
|
ArrayRef<unsigned> Indices, unsigned Alignment,
|
|
ArrayRef<unsigned> Indices, unsigned Alignment,
|
|
unsigned AddressSpace) const;
|
|
unsigned AddressSpace) const;
|
|
|
|
|
|
- /// \brief Calculate the cost of performing a vector reduction.
|
|
|
|
|
|
+ /// Calculate the cost of performing a vector reduction.
|
|
///
|
|
///
|
|
/// This is the cost of reducing the vector value of type \p Ty to a scalar
|
|
/// 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
|
|
/// value using the operation denoted by \p Opcode. The form of the reduction
|
|
@@ -906,7 +906,7 @@ public:
|
|
bool areInlineCompatible(const Function *Caller,
|
|
bool areInlineCompatible(const Function *Caller,
|
|
const Function *Callee) const;
|
|
const Function *Callee) const;
|
|
|
|
|
|
- /// \brief The type of load/store indexing.
|
|
|
|
|
|
+ /// The type of load/store indexing.
|
|
enum MemIndexedMode {
|
|
enum MemIndexedMode {
|
|
MIM_Unindexed, ///< No indexing.
|
|
MIM_Unindexed, ///< No indexing.
|
|
MIM_PreInc, ///< Pre-incrementing.
|
|
MIM_PreInc, ///< Pre-incrementing.
|
|
@@ -972,19 +972,19 @@ public:
|
|
/// @}
|
|
/// @}
|
|
|
|
|
|
private:
|
|
private:
|
|
- /// \brief Estimate the latency of specified instruction.
|
|
|
|
|
|
+ /// Estimate the latency of specified instruction.
|
|
/// Returns 1 as the default value.
|
|
/// Returns 1 as the default value.
|
|
int getInstructionLatency(const Instruction *I) const;
|
|
int getInstructionLatency(const Instruction *I) const;
|
|
|
|
|
|
- /// \brief Returns the expected throughput cost of the instruction.
|
|
|
|
|
|
+ /// Returns the expected throughput cost of the instruction.
|
|
/// Returns -1 if the cost is unknown.
|
|
/// Returns -1 if the cost is unknown.
|
|
int getInstructionThroughput(const Instruction *I) const;
|
|
int getInstructionThroughput(const Instruction *I) const;
|
|
|
|
|
|
- /// \brief The abstract base class used to type erase specific TTI
|
|
|
|
|
|
+ /// The abstract base class used to type erase specific TTI
|
|
/// implementations.
|
|
/// implementations.
|
|
class Concept;
|
|
class Concept;
|
|
|
|
|
|
- /// \brief The template model for the base class which wraps a concrete
|
|
|
|
|
|
+ /// The template model for the base class which wraps a concrete
|
|
/// implementation in a type erased interface.
|
|
/// implementation in a type erased interface.
|
|
template <typename T> class Model;
|
|
template <typename T> class Model;
|
|
|
|
|
|
@@ -1574,7 +1574,7 @@ template <typename T>
|
|
TargetTransformInfo::TargetTransformInfo(T Impl)
|
|
TargetTransformInfo::TargetTransformInfo(T Impl)
|
|
: TTIImpl(new Model<T>(Impl)) {}
|
|
: TTIImpl(new Model<T>(Impl)) {}
|
|
|
|
|
|
-/// \brief Analysis pass providing the \c TargetTransformInfo.
|
|
|
|
|
|
+/// Analysis pass providing the \c TargetTransformInfo.
|
|
///
|
|
///
|
|
/// The core idea of the TargetIRAnalysis is to expose an interface through
|
|
/// The core idea of the TargetIRAnalysis is to expose an interface through
|
|
/// which LLVM targets can analyze and provide information about the middle
|
|
/// which LLVM targets can analyze and provide information about the middle
|
|
@@ -1589,13 +1589,13 @@ class TargetIRAnalysis : public AnalysisInfoMixin<TargetIRAnalysis> {
|
|
public:
|
|
public:
|
|
typedef TargetTransformInfo Result;
|
|
typedef TargetTransformInfo Result;
|
|
|
|
|
|
- /// \brief Default construct a target IR analysis.
|
|
|
|
|
|
+ /// Default construct a target IR analysis.
|
|
///
|
|
///
|
|
/// This will use the module's datalayout to construct a baseline
|
|
/// This will use the module's datalayout to construct a baseline
|
|
/// conservative TTI result.
|
|
/// conservative TTI result.
|
|
TargetIRAnalysis();
|
|
TargetIRAnalysis();
|
|
|
|
|
|
- /// \brief Construct an IR analysis pass around a target-provide callback.
|
|
|
|
|
|
+ /// Construct an IR analysis pass around a target-provide callback.
|
|
///
|
|
///
|
|
/// The callback will be called with a particular function for which the TTI
|
|
/// The callback will be called with a particular function for which the TTI
|
|
/// is needed and must return a TTI object for that function.
|
|
/// is needed and must return a TTI object for that function.
|
|
@@ -1621,7 +1621,7 @@ private:
|
|
friend AnalysisInfoMixin<TargetIRAnalysis>;
|
|
friend AnalysisInfoMixin<TargetIRAnalysis>;
|
|
static AnalysisKey Key;
|
|
static AnalysisKey Key;
|
|
|
|
|
|
- /// \brief The callback used to produce a result.
|
|
|
|
|
|
+ /// The callback used to produce a result.
|
|
///
|
|
///
|
|
/// We use a completely opaque callback so that targets can provide whatever
|
|
/// We use a completely opaque callback so that targets can provide whatever
|
|
/// mechanism they desire for constructing the TTI for a given function.
|
|
/// mechanism they desire for constructing the TTI for a given function.
|
|
@@ -1633,11 +1633,11 @@ private:
|
|
/// the external TargetMachine, and that reference needs to never dangle.
|
|
/// the external TargetMachine, and that reference needs to never dangle.
|
|
std::function<Result(const Function &)> TTICallback;
|
|
std::function<Result(const Function &)> TTICallback;
|
|
|
|
|
|
- /// \brief Helper function used as the callback in the default constructor.
|
|
|
|
|
|
+ /// Helper function used as the callback in the default constructor.
|
|
static Result getDefaultTTI(const Function &F);
|
|
static Result getDefaultTTI(const Function &F);
|
|
};
|
|
};
|
|
|
|
|
|
-/// \brief Wrapper pass for TargetTransformInfo.
|
|
|
|
|
|
+/// Wrapper pass for TargetTransformInfo.
|
|
///
|
|
///
|
|
/// This pass can be constructed from a TTI object which it stores internally
|
|
/// This pass can be constructed from a TTI object which it stores internally
|
|
/// and is queried by passes.
|
|
/// and is queried by passes.
|
|
@@ -1650,7 +1650,7 @@ class TargetTransformInfoWrapperPass : public ImmutablePass {
|
|
public:
|
|
public:
|
|
static char ID;
|
|
static char ID;
|
|
|
|
|
|
- /// \brief We must provide a default constructor for the pass but it should
|
|
|
|
|
|
+ /// We must provide a default constructor for the pass but it should
|
|
/// never be used.
|
|
/// never be used.
|
|
///
|
|
///
|
|
/// Use the constructor below or call one of the creation routines.
|
|
/// Use the constructor below or call one of the creation routines.
|
|
@@ -1661,7 +1661,7 @@ public:
|
|
TargetTransformInfo &getTTI(const Function &F);
|
|
TargetTransformInfo &getTTI(const Function &F);
|
|
};
|
|
};
|
|
|
|
|
|
-/// \brief Create an analysis pass wrapper around a TTI object.
|
|
|
|
|
|
+/// Create an analysis pass wrapper around a TTI object.
|
|
///
|
|
///
|
|
/// This analysis pass just holds the TTI instance and makes it available to
|
|
/// This analysis pass just holds the TTI instance and makes it available to
|
|
/// clients.
|
|
/// clients.
|