17 #ifndef LLVM_CODEGEN_BASICTTIIMPL_H 18 #define LLVM_CODEGEN_BASICTTIIMPL_H 62 class ScalarEvolution;
85 unsigned getPermuteShuffleOverhead(
Type *Ty) {
96 Cost +=
static_cast<T *
>(
this)
98 Cost +=
static_cast<T *
>(
this)
106 return static_cast<const T *
>(
this)->getST();
111 return static_cast<const T *
>(
this)->getTLI();
141 unsigned Alignment,
bool *
Fast)
const {
166 bool HasBaseReg, int64_t Scale,
193 bool HasBaseReg, int64_t Scale,
unsigned AddrSpace) {
223 if (getTLI()->isExtFree(I))
226 if (isa<ZExtInst>(I) || isa<SExtInst>(I))
227 if (
const LoadInst *LI = dyn_cast<LoadInst>(Src))
228 if (getTLI()->isExtLoad(LI, I,
DL))
241 if (IID == Intrinsic::cttz) {
242 if (getTLI()->isCheapToSpeculateCttz())
247 if (IID == Intrinsic::ctlz) {
248 if (getTLI()->isCheapToSpeculateCtlz())
257 unsigned &JumpTableSize) {
277 APInt MinCaseVal = MaxCaseVal;
278 for (
auto CI : SI.
cases()) {
279 const APInt &CaseVal = CI.getCaseValue()->getValue();
280 if (CaseVal.
sgt(MaxCaseVal))
281 MaxCaseVal = CaseVal;
282 if (CaseVal.
slt(MinCaseVal))
283 MinCaseVal = CaseVal;
290 Dests.
insert(
I.getCaseSuccessor());
299 if (N < 2 || N < TLI->getMinimumJumpTableEntries())
302 (MaxCaseVal - MinCaseVal)
306 JumpTableSize = Range;
348 case Instruction::Trunc:
352 case Instruction::ZExt:
390 if (PartialUnrollingThreshold.getNumOccurrences() > 0)
391 MaxOps = PartialUnrollingThreshold;
403 if (isa<CallInst>(J) || isa<InvokeInst>(J)) {
406 if (!static_cast<T *>(
this)->isLoweredToCall(
F))
429 if (isa<LoadInst>(I))
452 Cost +=
static_cast<T *
>(
this)
455 Cost +=
static_cast<T *
>(
this)
469 for (
const Value *A : Args) {
470 if (!isa<Constant>(A) && UniqueOperands.
insert(A).second) {
471 Type *VecTy =
nullptr;
472 if (A->getType()->isVectorTy()) {
473 VecTy = A->getType();
476 "Vector argument does not match VF");
508 unsigned Opcode,
Type *Ty,
517 assert(ISD &&
"Invalid opcode");
524 unsigned OpCost = (IsFloat ? 2 : 1);
529 return LT.first * OpCost;
535 return LT.first * 2 * OpCost;
543 unsigned Cost =
static_cast<T *
>(
this)
561 return getPermuteShuffleOverhead(Tp);
571 assert(ISD &&
"Invalid opcode");
576 if (SrcLT.first == DstLT.first &&
577 SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
580 if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc)
584 if (Opcode == Instruction::Trunc &&
588 if (Opcode == Instruction::ZExt &&
592 if (Opcode == Instruction::AddrSpaceCast &&
599 if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) &&
600 I && isa<LoadInst>(
I->getOperand(0))) {
610 if (SrcLT.first == DstLT.first &&
617 if (Opcode == Instruction::BitCast)
632 if (SrcLT.first == DstLT.first &&
633 SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
636 if (Opcode == Instruction::ZExt)
640 if (Opcode == Instruction::SExt)
647 return SrcLT.first * 1;
662 T *
TTI =
static_cast<T *
>(
this);
663 return TTI->getVectorSplitCost() +
664 (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc,
I));
682 if (Opcode == Instruction::BitCast)
695 Instruction::ExtractElement, VecTy, Index) +
709 assert(ISD &&
"Invalid opcode");
713 assert(CondTy &&
"CondTy must exist");
719 if (!(ValTy->
isVectorTy() && !LT.second.isVector()) &&
746 std::pair<unsigned, MVT>
LT =
758 unsigned Cost = LT.first;
789 assert(VT &&
"Expect a vector type for interleaved memory op");
792 assert(Factor > 1 && NumElts % Factor == 0 &&
"Invalid interleave factor");
794 unsigned NumSubElts = NumElts / Factor;
799 Opcode, VecTy, Alignment, AddressSpace);
809 auto ceil = [](
unsigned A,
unsigned B) {
return (A +
B - 1) /
B; };
828 unsigned NumLegalInsts = ceil(VecTySize, VecTyLTSize);
832 unsigned NumEltsPerLegalInst = ceil(NumElts, NumLegalInsts);
835 BitVector UsedInsts(NumLegalInsts,
false);
836 for (
unsigned Index : Indices)
837 for (
unsigned Elt = 0; Elt < NumSubElts; ++Elt)
838 UsedInsts.
set((
Index + Elt * Factor) / NumEltsPerLegalInst);
842 Cost *= UsedInsts.
count() / NumLegalInsts;
857 "Interleaved memory op has too many members");
859 for (
unsigned Index : Indices) {
860 assert(
Index < Factor &&
"Invalid index for interleaved memory op");
863 for (
unsigned i = 0; i < NumSubElts; i++)
864 Cost += static_cast<T *>(
this)->getVectorInstrCost(
865 Instruction::ExtractElement, VT,
Index + i * Factor);
868 unsigned InsSubCost = 0;
869 for (
unsigned i = 0; i < NumSubElts; i++)
870 InsSubCost += static_cast<T *>(
this)->getVectorInstrCost(
871 Instruction::InsertElement, SubVT, i);
873 Cost += Indices.size() * InsSubCost;
884 unsigned ExtSubCost = 0;
885 for (
unsigned i = 0; i < NumSubElts; i++)
886 ExtSubCost += static_cast<T *>(
this)->getVectorInstrCost(
887 Instruction::ExtractElement, SubVT, i);
888 Cost += ExtSubCost * Factor;
890 for (
unsigned i = 0; i < NumElts; i++)
891 Cost += static_cast<T *>(
this)
892 ->getVectorInstrCost(Instruction::InsertElement, VT, i);
903 assert((RetVF == 1 || VF == 1) &&
"VF > 1 and RetVF is a vector type");
910 Type *OpTy =
Op->getType();
922 if (RetVF > 1 || VF > 1) {
923 ScalarizationCost = 0;
929 return static_cast<T *
>(
this)->
932 case Intrinsic::masked_scatter: {
933 assert(VF == 1 &&
"Can't vectorize types here.");
935 bool VarMask = !isa<Constant>(
Mask);
936 unsigned Alignment = cast<ConstantInt>(Args[2])->getZExtValue();
943 case Intrinsic::masked_gather: {
944 assert(VF == 1 &&
"Can't vectorize types here.");
946 bool VarMask = !isa<Constant>(
Mask);
947 unsigned Alignment = cast<ConstantInt>(Args[1])->getZExtValue();
950 RetTy, Args[0], VarMask,
953 case Intrinsic::experimental_vector_reduce_add:
954 case Intrinsic::experimental_vector_reduce_mul:
955 case Intrinsic::experimental_vector_reduce_and:
956 case Intrinsic::experimental_vector_reduce_or:
957 case Intrinsic::experimental_vector_reduce_xor:
958 case Intrinsic::experimental_vector_reduce_fadd:
959 case Intrinsic::experimental_vector_reduce_fmul:
960 case Intrinsic::experimental_vector_reduce_smax:
961 case Intrinsic::experimental_vector_reduce_smin:
962 case Intrinsic::experimental_vector_reduce_fmax:
963 case Intrinsic::experimental_vector_reduce_fmin:
964 case Intrinsic::experimental_vector_reduce_umax:
965 case Intrinsic::experimental_vector_reduce_umin:
978 unsigned SingleCallCost = 10;
982 unsigned ScalarizationCost = ScalarizationCostPassed;
983 unsigned ScalarCalls = 1;
984 Type *ScalarRetTy = RetTy;
992 for (
unsigned i = 0, ie = Tys.
size(); i != ie; ++i) {
1002 if (ScalarCalls == 1)
1006 IID, ScalarRetTy, ScalarTys, FMF);
1008 return ScalarCalls * ScalarCost + ScalarizationCost;
1012 case Intrinsic::sqrt:
1015 case Intrinsic::sin:
1018 case Intrinsic::cos:
1021 case Intrinsic::exp:
1024 case Intrinsic::exp2:
1027 case Intrinsic::log:
1030 case Intrinsic::log10:
1036 case Intrinsic::fabs:
1049 case Intrinsic::copysign:
1052 case Intrinsic::floor:
1055 case Intrinsic::ceil:
1058 case Intrinsic::trunc:
1061 case Intrinsic::nearbyint:
1064 case Intrinsic::rint:
1070 case Intrinsic::pow:
1073 case Intrinsic::fma:
1076 case Intrinsic::fmuladd:
1080 case Intrinsic::lifetime_start:
1081 case Intrinsic::lifetime_end:
1082 case Intrinsic::sideeffect:
1084 case Intrinsic::masked_store:
1085 return static_cast<T *
>(
this)
1087 case Intrinsic::masked_load:
1088 return static_cast<T *
>(
this)
1090 case Intrinsic::experimental_vector_reduce_add:
1093 case Intrinsic::experimental_vector_reduce_mul:
1095 Instruction::Mul, Tys[0],
false);
1096 case Intrinsic::experimental_vector_reduce_and:
1098 Instruction::And, Tys[0],
false);
1099 case Intrinsic::experimental_vector_reduce_or:
1101 Instruction::Or, Tys[0],
false);
1102 case Intrinsic::experimental_vector_reduce_xor:
1104 Instruction::Xor, Tys[0],
false);
1105 case Intrinsic::experimental_vector_reduce_fadd:
1107 Instruction::FAdd, Tys[0],
false);
1108 case Intrinsic::experimental_vector_reduce_fmul:
1110 Instruction::FMul, Tys[0],
false);
1111 case Intrinsic::experimental_vector_reduce_smax:
1112 case Intrinsic::experimental_vector_reduce_smin:
1113 case Intrinsic::experimental_vector_reduce_fmax:
1114 case Intrinsic::experimental_vector_reduce_fmin:
1118 case Intrinsic::experimental_vector_reduce_umax:
1119 case Intrinsic::experimental_vector_reduce_umin:
1123 case Intrinsic::ctpop:
1137 for (
unsigned ISD : ISDs) {
1139 if (IID == Intrinsic::fabs && TLI->
isFAbsFree(LT.second)) {
1158 auto MinLegalCostI = std::min_element(LegalCost.
begin(), LegalCost.
end());
1159 if (MinLegalCostI != LegalCost.
end())
1160 return *MinLegalCostI;
1162 auto MinCustomCostI = std::min_element(CustomCost.
begin(), CustomCost.
end());
1163 if (MinCustomCostI != CustomCost.
end())
1164 return *MinCustomCostI;
1168 if (IID == Intrinsic::fmuladd)
1169 return static_cast<T *
>(
this)
1171 static_cast<T *
>(
this)
1178 unsigned ScalarizationCost =
1180 ? ScalarizationCostPassed
1184 for (
unsigned i = 0, ie = Tys.
size(); i != ie; ++i) {
1192 for (
unsigned i = 0, ie = Tys.
size(); i != ie; ++i) {
1193 if (Tys[i]->isVectorTy()) {
1196 ScalarCalls =
std::max(ScalarCalls, Tys[i]->getVectorNumElements());
1200 return ScalarCalls * ScalarCost + ScalarizationCost;
1204 return SingleCallCost;
1272 unsigned NumReduxLevels =
Log2_32(NumVecElts);
1273 unsigned ArithCost = 0;
1274 unsigned ShuffleCost = 0;
1275 auto *ConcreteTTI =
static_cast<T *
>(
this);
1276 std::pair<unsigned, MVT>
LT =
1277 ConcreteTTI->getTLI()->getTypeLegalizationCost(
DL, Ty);
1278 unsigned LongVectorCount = 0;
1280 LT.second.isVector() ? LT.second.getVectorNumElements() : 1;
1281 while (NumVecElts > MVTLen) {
1284 ShuffleCost += (IsPairwise + 1) *
1287 ArithCost += ConcreteTTI->getArithmeticInstrCost(Opcode, Ty);
1295 ShuffleCost += (NumReduxLevels - LongVectorCount) * (IsPairwise + 1) *
1298 ArithCost += (NumReduxLevels - LongVectorCount) *
1299 ConcreteTTI->getArithmeticInstrCost(Opcode, Ty);
1311 unsigned NumReduxLevels =
Log2_32(NumVecElts);
1314 CmpOpcode = Instruction::FCmp;
1317 "expecting floating point or integer type for min/max reduction");
1318 CmpOpcode = Instruction::ICmp;
1320 unsigned MinMaxCost = 0;
1321 unsigned ShuffleCost = 0;
1322 auto *ConcreteTTI =
static_cast<T *
>(
this);
1323 std::pair<unsigned, MVT>
LT =
1324 ConcreteTTI->getTLI()->getTypeLegalizationCost(
DL, Ty);
1325 unsigned LongVectorCount = 0;
1327 LT.second.isVector() ? LT.second.getVectorNumElements() : 1;
1328 while (NumVecElts > MVTLen) {
1331 ShuffleCost += (IsPairwise + 1) *
1335 ConcreteTTI->getCmpSelInstrCost(CmpOpcode, Ty, CondTy,
nullptr) +
1346 ShuffleCost += (NumReduxLevels - LongVectorCount) * (IsPairwise + 1) *
1350 (NumReduxLevels - LongVectorCount) *
1351 (ConcreteTTI->getCmpSelInstrCost(CmpOpcode, Ty, CondTy,
nullptr) +
1356 return ShuffleCost + MinMaxCost +
1360 ScalarCondTy,
nullptr);
1387 #endif // LLVM_CODEGEN_BASICTTIIMPL_H LegalizeAction getLoadExtAction(unsigned ExtType, EVT ValVT, EVT MemVT) const
Return how this load with extension should be treated: either it is legal, needs to be promoted to a ...
Type * getVectorElementType() const
unsigned getNumCases() const
Return the number of 'cases' in this switch instruction, excluding the default case.
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
unsigned getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::OperandValueKind Opd1Info=TTI::OK_AnyValue, TTI::OperandValueKind Opd2Info=TTI::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo=TTI::OP_None, TTI::OperandValueProperties Opd2PropInfo=TTI::OP_None, ArrayRef< const Value *> Args=ArrayRef< const Value *>())
This represents an addressing mode of: BaseGV + BaseOffs + BaseReg + Scale*ScaleReg If BaseGV is null...
unsigned getIndexSizeInBits(unsigned AS) const
Size in bits of index used for address calculation in getelementptr.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
iterator_range< CaseIt > cases()
Iteration adapter for range-for loops.
static Type * makeCmpResultType(Type *opnd_type)
Create a result type for fcmp/icmp.
Compute iterated dominance frontiers using a linear time algorithm.
unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract)
Estimate the overhead of scalarizing an instruction.
The main scalar evolution driver.
bool slt(const APInt &RHS) const
Signed less than comparison.
int getGEPCost(Type *PointeeType, const Value *Ptr, ArrayRef< const Value *> Operands)
static uint64_t round(uint64_t Acc, uint64_t Input)
CaseIt case_begin()
Returns a read/write iterator that points to the first case in the SwitchInst.
bool isSuitableForBitTests(unsigned NumDests, unsigned NumCmps, const APInt &Low, const APInt &High, const DataLayout &DL) const
Return true if lowering to a bit test is suitable for a set of case clusters which contains NumDests ...
bool sgt(const APInt &RHS) const
Signed greather than comparison.
BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
int getExtCost(const Instruction *I, const Value *Src)
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
An instruction for reading from memory.
bool isProfitableToHoist(Instruction *I)
bool isVectorTy() const
True if this is an instance of VectorType.
Base class which can be used to help build a TTI implementation.
virtual bool isZExtFree(Type *FromTy, Type *ToTy) const
Return true if any actual instruction that defines a value of type FromTy implicitly zero-extends the...
bool isOperationLegalOrCustom(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
unsigned getMaxInterleaveFactor(unsigned VF)
unsigned getJumpBufAlignment() const
Returns the target's jmp_buf alignment in bytes (if never set, the default is 0)
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
iterator begin()
Instruction iterator methods.
unsigned getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy, ArrayRef< Value *> Args, FastMathFlags FMF, unsigned VF=1)
Get intrinsic cost based on arguments.
unsigned getAddressComputationCost(Type *Ty, ScalarEvolution *, const SCEV *)
unsigned getOperandsScalarizationOverhead(ArrayRef< const Value *> Args, unsigned VF)
Estimate the overhead of scalarizing an instructions unique non-constant operands.
unsigned getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index)
int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace)
unsigned getArithmeticReductionCost(unsigned Opcode, Type *Ty, bool IsPairwise)
Try to calculate arithmetic and shuffle op costs for reduction operations.
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
uint64_t getNumElements() const
bool allowsMisalignedMemoryAccesses(LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace, unsigned Alignment, bool *Fast) const
This file implements a class to represent arbitrary precision integral constant values and operations...
virtual bool isTruncateFree(Type *FromTy, Type *ToTy) const
Return true if it's free to truncate a value of type FromTy to type ToTy.
unsigned getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace)
unsigned getRegisterBitWidth(bool Vector) const
unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I)
unsigned getJumpBufSize()
unsigned getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, const Instruction *I=nullptr)
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
bool isFCmpOrdCheaperThanFCmpZero(Type *Ty)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
virtual bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AddrSpace, Instruction *I=nullptr) const
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
bool isIndexedStoreLegal(TTI::MemIndexedMode M, Type *Ty, const DataLayout &DL) const
unsigned getFPOpCost(Type *Ty)
bool isTruncateFree(Type *Ty1, Type *Ty2)
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
bool isVoidTy() const
Return true if this is 'void'.
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP)
virtual bool isSuitableForJumpTable(const SwitchInst *SI, uint64_t NumCases, uint64_t Range) const
Return true if lowering to a jump table is suitable for a set of case clusters which may contain NumC...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Concrete BasicTTIImpl that can be used if no further customization is needed.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Simple binary floating point operators.
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
This file contains the declarations for the subclasses of Constant, which represent the different fla...
unsigned getMinMaxReductionCost(Type *Ty, Type *CondTy, bool IsPairwise, bool)
Try to calculate op costs for min/max reduction operations.
unsigned getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy, ArrayRef< Type *> Tys, FastMathFlags FMF, unsigned ScalarizationCostPassed=std::numeric_limits< unsigned >::max())
Get intrinsic cost based on argument types.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
AMDGPU Lower Kernel Arguments
virtual bool areJTsAllowed(const Function *Fn) const
Return true if lowering to a jump table is allowed.
unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy, ArrayRef< Type *> ParamTys)
bool isOperationLegalOrCustomOrPromote(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
unsigned getNumberOfParts(Type *Tp)
bool isIndexedLoadLegal(unsigned IdxMode, EVT VT) const
Return true if the specified indexed load is legal on this target.
static double log2(double V)
virtual bool isProfitableToHoist(Instruction *I) const
static wasm::ValType getType(const TargetRegisterClass *RC)
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_READONLY APFloat maxnum(const APFloat &A, const APFloat &B)
Implements IEEE maxNum semantics.
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
bool isLegalAddImmediate(int64_t imm)
This base class for TargetLowering contains the SelectionDAG-independent parts that can be used from ...
LegalizeAction
This enum indicates whether operations are valid for a target, and if not, what action should be used...
unsigned getCFInstrCost(unsigned Opcode)
unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
unsigned getNumberOfRegisters(bool Vector)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
size_type count() const
count - Returns the number of bits which are set.
int getInstructionLatency(const Instruction *I)
virtual bool allowsMisalignedMemoryAccesses(EVT, unsigned AddrSpace=0, unsigned Align=1, bool *=nullptr) const
Determine if the target supports unaligned memory accesses.
unsigned getJumpBufSize() const
Returns the target's jmp_buf size in bytes (if never set, the default is 200)
unsigned getVectorSplitCost()
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
cl::opt< unsigned > PartialUnrollingThreshold
static const unsigned DefaultLoadLatency
LegalizeAction getTruncStoreAction(EVT ValVT, EVT MemVT) const
Return how this store with truncation should be treated: either it is legal, needs to be promoted to ...
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
unsigned getVectorNumElements() const
Class to represent vector types.
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
Class for arbitrary precision integers.
Select(COND, TRUEVAL, FALSEVAL).
InstListType::iterator iterator
Instruction iterators...
unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace, const Instruction *I=nullptr)
unsigned LoopMicroOpBufferSize
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
bool isAlwaysUniform(const Value *V)
int InstructionOpcodeToISD(unsigned Opcode) const
Get the ISD node that corresponds to the Instruction class opcode.
FMINNAN/FMAXNAN - Behave identically to FMINNUM/FMAXNUM, except that when a single input is NaN...
unsigned getFlatAddressSpace()
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual bool isLegalICmpImmediate(int64_t) const
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
BR_JT - Jumptable branch.
unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy, ArrayRef< const Value *> Arguments)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy)
This class represents an analyzed expression in the program.
bool hasBranchDivergence()
Represents a single loop in the control flow graph.
unsigned getJumpBufAlignment()
bool shouldBuildLookupTables()
Establish a view to a call site for examination.
LegalizeTypeAction getTypeAction(LLVMContext &Context, EVT VT) const
Return how we should legalize values of this type, either it is already legal (return 'Legal') or we ...
const Function * getParent() const
Return the enclosing method, or null if none.
unsigned getInliningThresholdMultiplier()
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
block_iterator block_end() const
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool isLSRCostLess(TTI::LSRCost C1, TTI::LSRCost C2)
unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI, unsigned &JumpTableSize)
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
unsigned getScalarizationOverhead(Type *VecTy, ArrayRef< const Value *> Args)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isSourceOfDivergence(const Value *V)
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
LLVM Value Representation.
FMA - Perform a * b + c with no intermediate rounding step.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
bool isOperationLegalOrPromote(unsigned Op, EVT VT) const
Return true if the specified operation is legal on this target or can be made legal using promotion...
bool isLoadExtLegal(unsigned ExtType, EVT ValVT, EVT MemVT) const
Return true if the specified load with extension is legal on this target.
Primary interface to the complete machine description for the target machine.
bool isTypeLegal(Type *Ty)
Type * getElementType() const
virtual int getScalingFactorCost(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS=0) const
Return the cost of the scaling factor used in the addressing mode represented by AM for this target...
virtual bool useAA() const
Enable use of alias analysis during code generation (during MI scheduling, DAGCombine, etc.).
bool isIndexedLoadLegal(TTI::MemIndexedMode M, Type *Ty, const DataLayout &DL) const
Convenience struct for specifying and reasoning about fast-math flags.
unsigned getCallInstrCost(Function *F, Type *RetTy, ArrayRef< Type *> Tys)
Compute a cost of the given call instruction.
bool haveFastSqrt(Type *Ty)
bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace, Instruction *I=nullptr)
bool isLegalICmpImmediate(int64_t imm)
block_iterator block_begin() const
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
virtual bool isLegalAddImmediate(int64_t) const
Return true if the specified immediate is legal add immediate, that is the target has add instruction...
virtual bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const
Returns true if a cast between SrcAS and DestAS is a noop.
const MCSchedModel & getSchedModel() const
Get the machine model for this subtarget's CPU.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool isOperationExpand(unsigned Op, EVT VT) const
Return true if the specified operation is illegal on this target or unlikely to be made legal with cu...
std::pair< int, MVT > getTypeLegalizationCost(const DataLayout &DL, Type *Ty) const
Estimate the cost of type-legalization and the legalized type.
LLVM_READONLY APFloat minnum(const APFloat &A, const APFloat &B)
Implements IEEE minNum semantics.
bool isIndexedStoreLegal(unsigned IdxMode, EVT VT) const
Return true if the specified indexed load is legal on this target.
bool empty() const
empty - Check if the array is empty.
virtual bool isFAbsFree(EVT VT) const
Return true if an fabs operation is free to the point where it is never worthwhile to replace it with...
This file describes how to lower LLVM code to machine code.
const BasicBlock * getParent() const
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.