17 #ifndef LLVM_CODEGEN_BASICTTIIMPL_H 18 #define LLVM_CODEGEN_BASICTTIIMPL_H 62 class ScalarEvolution;
85 unsigned getBroadcastShuffleOverhead(
Type *Ty) {
91 Instruction::ExtractElement, Ty, 0);
95 Instruction::InsertElement, Ty, i);
102 unsigned getPermuteShuffleOverhead(
Type *Ty) {
113 Cost +=
static_cast<T *
>(
this)
115 Cost +=
static_cast<T *
>(
this)
123 unsigned getExtractSubvectorOverhead(
Type *Ty,
int Index,
Type *SubTy) {
125 "Can only extract subvectors from vectors");
128 "SK_ExtractSubvector index out of range");
134 for (
int i = 0; i != NumSubElts; ++i) {
136 Instruction::ExtractElement, Ty, i + Index);
138 Instruction::InsertElement, SubTy, i);
145 unsigned getInsertSubvectorOverhead(
Type *Ty,
int Index,
Type *SubTy) {
147 "Can only insert subvectors into vectors");
150 "SK_InsertSubvector index out of range");
156 for (
int i = 0; i != NumSubElts; ++i) {
158 Instruction::ExtractElement, SubTy, i);
160 Instruction::InsertElement, Ty, i + Index);
167 return static_cast<const T *
>(
this)->getST();
172 return static_cast<const T *
>(
this)->getTLI();
202 unsigned Alignment,
bool *
Fast)
const {
227 bool HasBaseReg, int64_t Scale,
254 bool HasBaseReg, int64_t Scale,
unsigned AddrSpace) {
284 if (getTLI()->isExtFree(I))
287 if (isa<ZExtInst>(I) || isa<SExtInst>(I))
288 if (
const LoadInst *LI = dyn_cast<LoadInst>(Src))
289 if (getTLI()->isExtLoad(LI, I,
DL))
303 if (getTLI()->isCheapToSpeculateCttz())
309 if (getTLI()->isCheapToSpeculateCtlz())
318 unsigned &JumpTableSize) {
338 APInt MinCaseVal = MaxCaseVal;
339 for (
auto CI : SI.
cases()) {
340 const APInt &CaseVal = CI.getCaseValue()->getValue();
341 if (CaseVal.
sgt(MaxCaseVal))
342 MaxCaseVal = CaseVal;
343 if (CaseVal.
slt(MinCaseVal))
344 MinCaseVal = CaseVal;
351 Dests.
insert(
I.getCaseSuccessor());
360 if (N < 2 || N < TLI->getMinimumJumpTableEntries())
363 (MaxCaseVal - MinCaseVal)
367 JumpTableSize = Range;
409 case Instruction::Trunc:
413 case Instruction::ZExt:
451 if (PartialUnrollingThreshold.getNumOccurrences() > 0)
452 MaxOps = PartialUnrollingThreshold;
464 if (isa<CallInst>(J) || isa<InvokeInst>(J)) {
467 if (!static_cast<T *>(
this)->isLoweredToCall(
F))
490 if (isa<LoadInst>(I))
513 Cost +=
static_cast<T *
>(
this)
516 Cost +=
static_cast<T *
>(
this)
530 for (
const Value *A : Args) {
531 if (!isa<Constant>(A) && UniqueOperands.
insert(A).second) {
532 Type *VecTy =
nullptr;
533 if (A->getType()->isVectorTy()) {
534 VecTy = A->getType();
537 "Vector argument does not match VF");
569 unsigned Opcode,
Type *Ty,
578 assert(ISD &&
"Invalid opcode");
585 unsigned OpCost = (IsFloat ? 2 : 1);
590 return LT.first * OpCost;
596 return LT.first * 2 * OpCost;
604 unsigned Cost =
static_cast<T *
>(
this)
619 return getBroadcastShuffleOverhead(Tp);
625 return getPermuteShuffleOverhead(Tp);
627 return getExtractSubvectorOverhead(Tp, Index, SubTp);
629 return getInsertSubvectorOverhead(Tp, Index, SubTp);
638 assert(ISD &&
"Invalid opcode");
643 if (SrcLT.first == DstLT.first &&
644 SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
647 if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc)
651 if (Opcode == Instruction::Trunc &&
655 if (Opcode == Instruction::ZExt &&
659 if (Opcode == Instruction::AddrSpaceCast &&
666 if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) &&
667 I && isa<LoadInst>(
I->getOperand(0))) {
677 if (SrcLT.first == DstLT.first &&
684 if (Opcode == Instruction::BitCast)
699 if (SrcLT.first == DstLT.first &&
700 SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
703 if (Opcode == Instruction::ZExt)
707 if (Opcode == Instruction::SExt)
714 return SrcLT.first * 1;
729 T *
TTI =
static_cast<T *
>(
this);
730 return TTI->getVectorSplitCost() +
731 (2 * TTI->getCastInstrCost(Opcode, SplitDst, SplitSrc,
I));
749 if (Opcode == Instruction::BitCast)
762 Instruction::ExtractElement, VecTy, Index) +
776 assert(ISD &&
"Invalid opcode");
780 assert(CondTy &&
"CondTy must exist");
786 if (!(ValTy->
isVectorTy() && !LT.second.isVector()) &&
813 std::pair<unsigned, MVT>
LT =
825 unsigned Cost = LT.first;
854 bool UseMaskForCond =
false,
855 bool UseMaskForGaps =
false) {
857 assert(VT &&
"Expect a vector type for interleaved memory op");
860 assert(Factor > 1 && NumElts % Factor == 0 &&
"Invalid interleave factor");
862 unsigned NumSubElts = NumElts / Factor;
867 if (UseMaskForCond || UseMaskForGaps)
869 Opcode, VecTy, Alignment, AddressSpace);
882 auto ceil = [](
unsigned A,
unsigned B) {
return (A +
B - 1) /
B; };
901 unsigned NumLegalInsts =
ceil(VecTySize, VecTyLTSize);
905 unsigned NumEltsPerLegalInst =
ceil(NumElts, NumLegalInsts);
908 BitVector UsedInsts(NumLegalInsts,
false);
909 for (
unsigned Index : Indices)
910 for (
unsigned Elt = 0; Elt < NumSubElts; ++Elt)
911 UsedInsts.
set((Index + Elt * Factor) / NumEltsPerLegalInst);
915 Cost *= UsedInsts.
count() / NumLegalInsts;
930 "Interleaved memory op has too many members");
932 for (
unsigned Index : Indices) {
933 assert(Index < Factor &&
"Invalid index for interleaved memory op");
936 for (
unsigned i = 0; i < NumSubElts; i++)
937 Cost += static_cast<T *>(
this)->getVectorInstrCost(
938 Instruction::ExtractElement, VT, Index + i * Factor);
941 unsigned InsSubCost = 0;
942 for (
unsigned i = 0; i < NumSubElts; i++)
943 InsSubCost += static_cast<T *>(
this)->getVectorInstrCost(
944 Instruction::InsertElement, SubVT, i);
946 Cost += Indices.size() * InsSubCost;
957 unsigned ExtSubCost = 0;
958 for (
unsigned i = 0; i < NumSubElts; i++)
959 ExtSubCost += static_cast<T *>(
this)->getVectorInstrCost(
960 Instruction::ExtractElement, SubVT, i);
961 Cost += ExtSubCost * Factor;
963 for (
unsigned i = 0; i < NumElts; i++)
964 Cost += static_cast<T *>(
this)
965 ->getVectorInstrCost(Instruction::InsertElement, VT, i);
985 for (
unsigned i = 0; i < NumSubElts; i++)
986 Cost += static_cast<T *>(
this)->getVectorInstrCost(
987 Instruction::ExtractElement, SubVT, i);
989 for (
unsigned i = 0; i < NumElts; i++)
990 Cost += static_cast<T *>(
this)->getVectorInstrCost(
991 Instruction::InsertElement, MaskVT, i);
1000 BinaryOperator::And, MaskVT);
1010 assert((RetVF == 1 || VF == 1) &&
"VF > 1 and RetVF is a vector type");
1011 auto *ConcreteTTI =
static_cast<T *
>(
this);
1018 Type *OpTy =
Op->getType();
1030 if (RetVF > 1 || VF > 1) {
1031 ScalarizationCost = 0;
1037 return ConcreteTTI->getIntrinsicInstrCost(IID, RetTy, Types, FMF,
1041 assert(VF == 1 &&
"Can't vectorize types here.");
1043 bool VarMask = !isa<Constant>(
Mask);
1044 unsigned Alignment = cast<ConstantInt>(Args[2])->getZExtValue();
1045 return ConcreteTTI->getGatherScatterOpCost(
1049 assert(VF == 1 &&
"Can't vectorize types here.");
1051 bool VarMask = !isa<Constant>(
Mask);
1052 unsigned Alignment = cast<ConstantInt>(Args[1])->getZExtValue();
1054 Args[0], VarMask, Alignment);
1085 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::Or, RetTy);
1086 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::Sub, RetTy);
1087 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::Shl, RetTy,
1088 OpKindX, OpKindZ, OpPropsX);
1089 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::LShr, RetTy,
1090 OpKindY, OpKindZ, OpPropsY);
1094 Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::URem, RetTy,
1095 OpKindZ, OpKindBW, OpPropsZ,
1102 Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::ICmp, RetTy,
1120 unsigned SingleCallCost = 10;
1124 unsigned ScalarizationCost = ScalarizationCostPassed;
1125 unsigned ScalarCalls = 1;
1126 Type *ScalarRetTy = RetTy;
1134 for (
unsigned i = 0, ie = Tys.
size(); i != ie; ++i) {
1144 if (ScalarCalls == 1)
1148 IID, ScalarRetTy, ScalarTys, FMF);
1150 return ScalarCalls * ScalarCost + ScalarizationCost;
1230 return static_cast<T *
>(
this)
1233 return static_cast<T *
>(
this)
1240 Instruction::Mul, Tys[0],
false);
1243 Instruction::And, Tys[0],
false);
1246 Instruction::Or, Tys[0],
false);
1249 Instruction::Xor, Tys[0],
false);
1252 Instruction::FAdd, Tys[0],
false);
1255 Instruction::FMul, Tys[0],
false);
1282 for (
unsigned ISD : ISDs) {
1304 auto MinLegalCostI = std::min_element(LegalCost.
begin(), LegalCost.
end());
1305 if (MinLegalCostI != LegalCost.
end())
1306 return *MinLegalCostI;
1308 auto MinCustomCostI = std::min_element(CustomCost.
begin(), CustomCost.
end());
1309 if (MinCustomCostI != CustomCost.
end())
1310 return *MinCustomCostI;
1315 return static_cast<T *
>(
this)
1317 static_cast<T *
>(
this)
1324 unsigned ScalarizationCost =
1326 ? ScalarizationCostPassed
1330 for (
unsigned i = 0, ie = Tys.
size(); i != ie; ++i) {
1338 for (
unsigned i = 0, ie = Tys.
size(); i != ie; ++i) {
1339 if (Tys[i]->isVectorTy()) {
1342 ScalarCalls =
std::max(ScalarCalls, Tys[i]->getVectorNumElements());
1346 return ScalarCalls * ScalarCost + ScalarizationCost;
1350 return SingleCallCost;
1418 unsigned NumReduxLevels =
Log2_32(NumVecElts);
1419 unsigned ArithCost = 0;
1420 unsigned ShuffleCost = 0;
1421 auto *ConcreteTTI =
static_cast<T *
>(
this);
1422 std::pair<unsigned, MVT>
LT =
1423 ConcreteTTI->getTLI()->getTypeLegalizationCost(
DL, Ty);
1424 unsigned LongVectorCount = 0;
1426 LT.second.isVector() ? LT.second.getVectorNumElements() : 1;
1427 while (NumVecElts > MVTLen) {
1431 ShuffleCost += (IsPairwise + 1) *
1434 ArithCost += ConcreteTTI->getArithmeticInstrCost(Opcode, SubTy);
1439 NumReduxLevels -= LongVectorCount;
1449 unsigned NumShuffles = NumReduxLevels;
1450 if (IsPairwise && NumReduxLevels >= 1)
1451 NumShuffles += NumReduxLevels - 1;
1452 ShuffleCost += NumShuffles *
1455 ArithCost += NumReduxLevels *
1456 ConcreteTTI->getArithmeticInstrCost(Opcode, Ty);
1457 return ShuffleCost + ArithCost +
1458 ConcreteTTI->getVectorInstrCost(Instruction::ExtractElement, Ty, 0);
1469 unsigned NumReduxLevels =
Log2_32(NumVecElts);
1472 CmpOpcode = Instruction::FCmp;
1475 "expecting floating point or integer type for min/max reduction");
1476 CmpOpcode = Instruction::ICmp;
1478 unsigned MinMaxCost = 0;
1479 unsigned ShuffleCost = 0;
1480 auto *ConcreteTTI =
static_cast<T *
>(
this);
1481 std::pair<unsigned, MVT>
LT =
1482 ConcreteTTI->getTLI()->getTypeLegalizationCost(
DL, Ty);
1483 unsigned LongVectorCount = 0;
1485 LT.second.isVector() ? LT.second.getVectorNumElements() : 1;
1486 while (NumVecElts > MVTLen) {
1492 ShuffleCost += (IsPairwise + 1) *
1496 ConcreteTTI->getCmpSelInstrCost(CmpOpcode, SubTy, CondTy,
nullptr) +
1503 NumReduxLevels -= LongVectorCount;
1513 unsigned NumShuffles = NumReduxLevels;
1514 if (IsPairwise && NumReduxLevels >= 1)
1515 NumShuffles += NumReduxLevels - 1;
1516 ShuffleCost += NumShuffles *
1521 (ConcreteTTI->getCmpSelInstrCost(CmpOpcode, Ty, CondTy,
nullptr) +
1526 return ShuffleCost + MinMaxCost +
1527 ConcreteTTI->getVectorInstrCost(Instruction::ExtractElement, Ty, 0);
1554 #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.
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...
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static IntegerType * getInt1Ty(LLVMContext &C)
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.
This class represents lattice values for constants.
FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 as less than 0...
unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract)
Estimate the overhead of scalarizing an instruction.
void push_back(const T &Elt)
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)
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.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
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
zlib-gnu style compression
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 getRegisterBitWidth(bool Vector) const
unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I)
unsigned getJumpBufSize()
Fast - This calling convention attempts to make calls as fast as possible (e.g.
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")
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
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.
unsigned getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
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.
virtual bool isProfitableToHoist(Instruction *I) const
static wasm::ValType getType(const TargetRegisterClass *RC)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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...
Returns platform specific canonical encoding of a floating point number.
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 getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
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.
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.
static IntegerType * getInt8Ty(LLVMContext &C)
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.
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.