14#ifndef LLVM_ANALYSIS_TARGETTRANSFORMINFOIMPL_H
15#define LLVM_ANALYSIS_TARGETTRANSFORMINFOIMPL_H
61 for (
const Value *Operand : Operands)
82 return SI.getNumCases();
156 virtual std::pair<KnownBits, KnownBits>
160 "expected pointer or pointer vector type");
163 if (
DL.isNonIntegralAddressSpace(FromAS))
164 return std::pair(
KnownBits(
DL.getPointerSizeInBits(FromAS)),
170 CastI->getDestAddressSpace(), *CastI->getPointerOperand());
171 FromPtrBits = KB.second;
179 return {FromPtrBits, ToPtrBits};
185 unsigned ToASBitSize =
DL.getPointerSizeInBits(ToAS);
187 if (
DL.isNonIntegralAddressSpace(FromAS))
197 unsigned DstAS)
const {
198 return {
DL.getPointerSizeInBits(SrcAS), 0};
210 virtual std::pair<const Value *, unsigned>
212 return std::make_pair(
nullptr, -1);
222 assert(
F &&
"A concrete function must be provided to this routine.");
229 if (
F->isIntrinsic())
232 if (
F->hasLocalLinkage() || !
F->hasName())
239 if (Name ==
"copysign" || Name ==
"copysignf" || Name ==
"copysignl" ||
240 Name ==
"fabs" || Name ==
"fabsf" || Name ==
"fabsl" ||
241 Name ==
"fmin" || Name ==
"fminf" || Name ==
"fminl" ||
242 Name ==
"fmax" || Name ==
"fmaxf" || Name ==
"fmaxl" ||
243 Name ==
"sin" || Name ==
"sinf" || Name ==
"sinl" ||
244 Name ==
"cos" || Name ==
"cosf" || Name ==
"cosl" ||
245 Name ==
"tan" || Name ==
"tanf" || Name ==
"tanl" ||
246 Name ==
"asin" || Name ==
"asinf" || Name ==
"asinl" ||
247 Name ==
"acos" || Name ==
"acosf" || Name ==
"acosl" ||
248 Name ==
"atan" || Name ==
"atanf" || Name ==
"atanl" ||
249 Name ==
"atan2" || Name ==
"atan2f" || Name ==
"atan2l"||
250 Name ==
"sinh" || Name ==
"sinhf" || Name ==
"sinhl" ||
251 Name ==
"cosh" || Name ==
"coshf" || Name ==
"coshl" ||
252 Name ==
"tanh" || Name ==
"tanhf" || Name ==
"tanhl" ||
253 Name ==
"sqrt" || Name ==
"sqrtf" || Name ==
"sqrtl" ||
254 Name ==
"exp10" || Name ==
"exp10l" || Name ==
"exp10f")
258 if (Name ==
"pow" || Name ==
"powf" || Name ==
"powl" || Name ==
"exp2" ||
259 Name ==
"exp2l" || Name ==
"exp2f" || Name ==
"floor" ||
260 Name ==
"floorf" || Name ==
"ceil" || Name ==
"round" ||
261 Name ==
"ffs" || Name ==
"ffsl" || Name ==
"abs" || Name ==
"labs" ||
285 virtual std::optional<Instruction *>
290 virtual std::optional<Value *>
293 bool &KnownBitsComputed)
const {
301 SimplifyAndSetOp)
const {
319 int64_t BaseOffset,
bool HasBaseReg,
320 int64_t Scale,
unsigned AddrSpace,
322 int64_t ScalableOffset = 0)
const {
325 return !BaseGV && BaseOffset == 0 && (Scale == 0 || Scale == 1);
372 unsigned DataSize =
DL.getTypeStoreSize(DataType);
379 unsigned DataSize =
DL.getTypeStoreSize(DataType);
397 Align Alignment)
const {
402 Align Alignment)
const {
407 Align Alignment)
const {
427 unsigned AddrSpace)
const {
432 Type *DataType)
const {
450 bool HasBaseReg, int64_t Scale,
451 unsigned AddrSpace)
const {
454 Scale, AddrSpace,
nullptr,
466 virtual bool useAA()
const {
return false; }
489 unsigned ScalarOpdIdx)
const {
564 unsigned *
Fast)
const {
620 Type *Ty =
nullptr)
const {
627 return "Generic::Unknown Register Class";
629 return "Generic::ScalarRC";
631 return "Generic::VectorRC";
654 virtual std::optional<unsigned>
getMaxVScale()
const {
return std::nullopt; }
668 virtual unsigned getMaximumVF(
unsigned ElemWidth,
unsigned Opcode)
const {
677 const Instruction &
I,
bool &AllowPromotionWithoutCommonHeader)
const {
678 AllowPromotionWithoutCommonHeader =
false;
683 virtual std::optional<unsigned>
694 virtual std::optional<unsigned>
710 unsigned NumStridedMemAccesses,
711 unsigned NumPrefetches,
712 bool HasCall)
const {
720 unsigned Opcode,
Type *InputTypeA,
Type *InputTypeB,
Type *AccumType,
735 auto IsWidenableCondition = [](
const Value *V) {
737 if (
II->getIntrinsicID() == Intrinsic::experimental_widenable_condition)
746 case Instruction::FDiv:
747 case Instruction::FRem:
748 case Instruction::SDiv:
749 case Instruction::SRem:
750 case Instruction::UDiv:
751 case Instruction::URem:
754 case Instruction::And:
755 case Instruction::Or:
756 if (
any_of(Args, IsWidenableCondition))
763 if (Ty->getScalarType()->isFloatingPointTy())
791 case Instruction::IntToPtr: {
792 unsigned SrcSize = Src->getScalarSizeInBits();
793 if (
DL.isLegalInteger(SrcSize) &&
794 SrcSize <=
DL.getPointerTypeSizeInBits(Dst))
798 case Instruction::PtrToAddr: {
799 unsigned DstSize = Dst->getScalarSizeInBits();
800 assert(DstSize ==
DL.getAddressSizeInBits(Src));
801 if (
DL.isLegalInteger(DstSize))
805 case Instruction::PtrToInt: {
806 unsigned DstSize = Dst->getScalarSizeInBits();
807 if (
DL.isLegalInteger(DstSize) &&
808 DstSize >=
DL.getPointerTypeSizeInBits(Src))
812 case Instruction::BitCast:
813 if (Dst == Src || (Dst->isPointerTy() && Src->isPointerTy()))
817 case Instruction::Trunc: {
866 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx,
881 unsigned Index)
const {
887 const APInt &DemandedDstElts,
898 if (Opcode == Instruction::InsertValue &&
914 bool UseMaskForCond,
bool UseMaskForGaps)
const {
921 switch (ICA.
getID()) {
924 case Intrinsic::allow_runtime_check:
925 case Intrinsic::allow_ubsan_check:
926 case Intrinsic::annotation:
927 case Intrinsic::assume:
928 case Intrinsic::sideeffect:
929 case Intrinsic::pseudoprobe:
930 case Intrinsic::arithmetic_fence:
931 case Intrinsic::dbg_assign:
932 case Intrinsic::dbg_declare:
933 case Intrinsic::dbg_value:
934 case Intrinsic::dbg_label:
935 case Intrinsic::invariant_start:
936 case Intrinsic::invariant_end:
937 case Intrinsic::launder_invariant_group:
938 case Intrinsic::strip_invariant_group:
939 case Intrinsic::is_constant:
940 case Intrinsic::lifetime_start:
941 case Intrinsic::lifetime_end:
942 case Intrinsic::experimental_noalias_scope_decl:
943 case Intrinsic::objectsize:
944 case Intrinsic::ptr_annotation:
945 case Intrinsic::var_annotation:
946 case Intrinsic::experimental_gc_result:
947 case Intrinsic::experimental_gc_relocate:
948 case Intrinsic::coro_alloc:
949 case Intrinsic::coro_begin:
950 case Intrinsic::coro_begin_custom_abi:
951 case Intrinsic::coro_free:
952 case Intrinsic::coro_end:
953 case Intrinsic::coro_frame:
954 case Intrinsic::coro_size:
955 case Intrinsic::coro_align:
956 case Intrinsic::coro_suspend:
957 case Intrinsic::coro_subfn_addr:
958 case Intrinsic::threadlocal_address:
959 case Intrinsic::experimental_widenable_condition:
960 case Intrinsic::ssa_copy:
963 case Intrinsic::bswap:
974 switch (MICA.
getID()) {
975 case Intrinsic::masked_scatter:
976 case Intrinsic::masked_gather:
977 case Intrinsic::masked_load:
978 case Intrinsic::masked_store:
979 case Intrinsic::vp_scatter:
980 case Intrinsic::vp_gather:
981 case Intrinsic::masked_compressstore:
982 case Intrinsic::masked_expandload:
1006 std::optional<FastMathFlags> FMF,
1019 VectorType *Ty, std::optional<FastMathFlags> FMF,
1051 bool CanCreate =
true)
const {
1057 unsigned SrcAddrSpace,
unsigned DestAddrSpace,
1059 std::optional<uint32_t> AtomicElementSize)
const {
1060 return AtomicElementSize ?
Type::getIntNTy(Context, *AtomicElementSize * 8)
1066 unsigned RemainingBytes,
unsigned SrcAddrSpace,
unsigned DestAddrSpace,
1068 std::optional<uint32_t> AtomicCpySize)
const {
1069 unsigned OpSizeInBytes = AtomicCpySize.value_or(1);
1071 for (
unsigned i = 0; i != RemainingBytes; i += OpSizeInBytes)
1077 return (Caller->getFnAttribute(
"target-cpu") ==
1078 Callee->getFnAttribute(
"target-cpu")) &&
1079 (Caller->getFnAttribute(
"target-features") ==
1080 Callee->getFnAttribute(
"target-features"));
1084 unsigned DefaultCallPenalty)
const {
1085 return DefaultCallPenalty;
1098 return (Caller->getFnAttribute(
"target-cpu") ==
1099 Callee->getFnAttribute(
"target-cpu")) &&
1100 (Caller->getFnAttribute(
"target-features") ==
1101 Callee->getFnAttribute(
"target-features"));
1122 unsigned AddrSpace)
const {
1128 unsigned AddrSpace)
const {
1142 unsigned ChainSizeInBytes,
1148 unsigned ChainSizeInBytes,
1252 unsigned MaxRequiredSize =
1253 VT->getElementType()->getPrimitiveSizeInBits().getFixedValue();
1255 unsigned MinRequiredSize = 0;
1256 for (
unsigned i = 0, e = VT->getNumElements(); i < e; ++i) {
1257 if (
auto *IntElement =
1259 bool signedElement = IntElement->getValue().isNegative();
1261 unsigned ElementMinRequiredSize =
1262 IntElement->getValue().getSignificantBits() - 1;
1264 isSigned |= signedElement;
1266 MinRequiredSize = std::max(MinRequiredSize, ElementMinRequiredSize);
1269 return MaxRequiredSize;
1272 return MinRequiredSize;
1276 isSigned = CI->getValue().isNegative();
1277 return CI->getValue().getSignificantBits() - 1;
1282 return Cast->getSrcTy()->getScalarSizeInBits() - 1;
1287 return Cast->getSrcTy()->getScalarSizeInBits();
1299 const SCEV *Ptr)
const {
1307 int64_t MergeDistance)
const {
1321template <
typename T>
1333 assert(PointeeType && Ptr &&
"can't get GEPCost of nullptr");
1335 bool HasBaseReg = (BaseGV ==
nullptr);
1337 auto PtrSizeBits =
DL.getPointerTypeSizeInBits(Ptr->
getType());
1338 APInt BaseOffset(PtrSizeBits, 0);
1342 Type *TargetType =
nullptr;
1346 if (Operands.
empty())
1349 for (
auto I = Operands.
begin();
I != Operands.
end(); ++
I, ++GTI) {
1350 TargetType = GTI.getIndexedType();
1357 if (
StructType *STy = GTI.getStructTypeOrNull()) {
1359 assert(ConstIdx &&
"Unexpected GEP index");
1361 BaseOffset +=
DL.getStructLayout(STy)->getElementOffset(
Field);
1367 int64_t ElementSize =
1368 GTI.getSequentialElementStride(
DL).getFixedValue();
1377 Scale = ElementSize;
1392 AccessType = TargetType;
1423 for (
const Value *V : Ptrs) {
1427 if (Info.isSameBase() && V !=
Base) {
1428 if (
GEP->hasAllConstantIndices())
1432 {TTI::OK_AnyValue, TTI::OP_None}, {TTI::OK_AnyValue, TTI::OP_None},
1437 GEP->getSourceElementType(),
GEP->getPointerOperand(), Indices,
1449 auto *TargetTTI =
static_cast<const T *
>(
this);
1454 if (
const Function *
F = CB->getCalledFunction()) {
1455 if (!TargetTTI->isLoweredToCall(
F))
1464 Type *Ty = U->getType();
1470 case Instruction::Call: {
1474 return TargetTTI->getIntrinsicInstrCost(CostAttrs,
CostKind);
1476 case Instruction::UncondBr:
1477 case Instruction::CondBr:
1478 case Instruction::Ret:
1479 case Instruction::PHI:
1480 case Instruction::Switch:
1481 return TargetTTI->getCFInstrCost(Opcode,
CostKind,
I);
1482 case Instruction::Freeze:
1484 case Instruction::ExtractValue:
1485 case Instruction::InsertValue:
1486 return TargetTTI->getInsertExtractValueCost(Opcode,
CostKind);
1487 case Instruction::Alloca:
1491 case Instruction::GetElementPtr: {
1493 Type *AccessType =
nullptr;
1496 if (
GEP->hasOneUser() &&
I)
1497 AccessType =
I->user_back()->getAccessType();
1499 return TargetTTI->getGEPCost(
GEP->getSourceElementType(),
1503 case Instruction::Add:
1504 case Instruction::FAdd:
1505 case Instruction::Sub:
1506 case Instruction::FSub:
1507 case Instruction::Mul:
1508 case Instruction::FMul:
1509 case Instruction::UDiv:
1510 case Instruction::SDiv:
1511 case Instruction::FDiv:
1512 case Instruction::URem:
1513 case Instruction::SRem:
1514 case Instruction::FRem:
1515 case Instruction::Shl:
1516 case Instruction::LShr:
1517 case Instruction::AShr:
1518 case Instruction::And:
1519 case Instruction::Or:
1520 case Instruction::Xor:
1521 case Instruction::FNeg: {
1524 if (Opcode != Instruction::FNeg)
1526 return TargetTTI->getArithmeticInstrCost(Opcode, Ty,
CostKind, Op1Info,
1527 Op2Info, Operands,
I);
1529 case Instruction::IntToPtr:
1530 case Instruction::PtrToAddr:
1531 case Instruction::PtrToInt:
1532 case Instruction::SIToFP:
1533 case Instruction::UIToFP:
1534 case Instruction::FPToUI:
1535 case Instruction::FPToSI:
1536 case Instruction::Trunc:
1537 case Instruction::FPTrunc:
1538 case Instruction::BitCast:
1539 case Instruction::FPExt:
1540 case Instruction::SExt:
1541 case Instruction::ZExt:
1542 case Instruction::AddrSpaceCast: {
1543 Type *OpTy = Operands[0]->getType();
1544 return TargetTTI->getCastInstrCost(
1547 case Instruction::Store: {
1549 Type *ValTy = Operands[0]->getType();
1551 return TargetTTI->getMemoryOpCost(Opcode, ValTy,
SI->getAlign(),
1555 case Instruction::Load: {
1560 Type *LoadType = U->getType();
1571 LoadType = TI->getDestTy();
1573 return TargetTTI->getMemoryOpCost(Opcode, LoadType, LI->getAlign(),
1575 {TTI::OK_AnyValue, TTI::OP_None},
I);
1577 case Instruction::Select: {
1578 const Value *Op0, *Op1;
1589 return TargetTTI->getArithmeticInstrCost(
1591 CostKind, Op1Info, Op2Info, Operands,
I);
1595 Type *CondTy = Operands[0]->getType();
1596 return TargetTTI->getCmpSelInstrCost(Opcode, U->getType(), CondTy,
1600 case Instruction::ICmp:
1601 case Instruction::FCmp: {
1604 Type *ValTy = Operands[0]->getType();
1606 return TargetTTI->getCmpSelInstrCost(Opcode, ValTy, U->getType(),
1611 case Instruction::InsertElement: {
1617 if (CI->getValue().getActiveBits() <= 32)
1618 Idx = CI->getZExtValue();
1619 return TargetTTI->getVectorInstrCost(*IE, Ty,
CostKind, Idx,
1622 case Instruction::ShuffleVector: {
1630 int NumSubElts, SubIndex;
1633 if (
all_of(Mask, [](
int M) {
return M < 0; }))
1637 if (Shuffle->changesLength()) {
1639 if (Shuffle->increasesLength() && Shuffle->isIdentityWithPadding())
1642 if (Shuffle->isExtractSubvectorMask(SubIndex))
1644 VecSrcTy, Mask,
CostKind, SubIndex,
1645 VecTy, Operands, Shuffle);
1647 if (Shuffle->isInsertSubvectorMask(NumSubElts, SubIndex))
1648 return TargetTTI->getShuffleCost(
1654 int ReplicationFactor, VF;
1655 if (Shuffle->isReplicationMask(ReplicationFactor, VF)) {
1659 DemandedDstElts.
setBit(
I.index());
1661 return TargetTTI->getReplicationShuffleCost(
1662 VecSrcTy->getElementType(), ReplicationFactor, VF,
1667 NumSubElts = VecSrcTy->getElementCount().getKnownMinValue();
1673 if (Shuffle->increasesLength()) {
1674 for (
int &M : AdjustMask)
1675 M = M >= NumSubElts ? (M + (Mask.size() - NumSubElts)) : M;
1677 return TargetTTI->getShuffleCost(
1679 VecTy, AdjustMask,
CostKind, 0,
nullptr, Operands, Shuffle);
1690 VecSrcTy, VecSrcTy, AdjustMask,
CostKind, 0,
nullptr, Operands,
1694 std::iota(ExtractMask.
begin(), ExtractMask.
end(), 0);
1695 return ShuffleCost + TargetTTI->getShuffleCost(
1697 ExtractMask,
CostKind, 0, VecTy, {}, Shuffle);
1700 if (Shuffle->isIdentity())
1703 if (Shuffle->isReverse())
1704 return TargetTTI->getShuffleCost(
TTI::SK_Reverse, VecTy, VecSrcTy, Mask,
1708 if (Shuffle->isTranspose())
1710 Mask,
CostKind, 0,
nullptr, Operands,
1713 if (Shuffle->isZeroEltSplat())
1715 Mask,
CostKind, 0,
nullptr, Operands,
1718 if (Shuffle->isSingleSource())
1720 VecSrcTy, Mask,
CostKind, 0,
nullptr,
1723 if (Shuffle->isInsertSubvectorMask(NumSubElts, SubIndex))
1724 return TargetTTI->getShuffleCost(
1729 if (Shuffle->isSelect())
1730 return TargetTTI->getShuffleCost(
TTI::SK_Select, VecTy, VecSrcTy, Mask,
1734 if (Shuffle->isSplice(SubIndex))
1735 return TargetTTI->getShuffleCost(
TTI::SK_Splice, VecTy, VecSrcTy, Mask,
1736 CostKind, SubIndex,
nullptr, Operands,
1740 Mask,
CostKind, 0,
nullptr, Operands,
1743 case Instruction::ExtractElement: {
1749 if (CI->getValue().getActiveBits() <= 32)
1750 Idx = CI->getZExtValue();
1751 Type *DstTy = Operands[0]->getType();
1752 return TargetTTI->getVectorInstrCost(*EEI, DstTy,
CostKind, Idx);
1761 auto *TargetTTI =
static_cast<const T *
>(
this);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
uint64_t IntrinsicInst * II
OptimizedStructLayoutField Field
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
static SymbolRef::Type getType(const Symbol *Sym)
Class for arbitrary precision integers.
void setBit(unsigned BitPosition)
Set the given bit to 1 whose position is given as "bitPosition".
unsigned getBitWidth() const
Return the number of bits in the APInt.
LLVM_ABI APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
static APInt getZero(unsigned numBits)
Get the '0' value for the specified bit-width.
int64_t getSExtValue() const
Get sign extended value.
This class represents a conversion between pointers from one address space to another.
an instruction to allocate memory on the stack
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
const T & front() const
front - Get the first element.
bool empty() const
empty - Check if the array is empty.
Class to represent array types.
A cache of @llvm.assume calls within a function.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Conditional Branch instruction.
This is the shared class of boolean and integer constants.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
const APInt & getValue() const
Return the constant as an APInt value reference.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
Convenience struct for specifying and reasoning about fast-math flags.
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
The core instruction combiner logic.
static InstructionCost getInvalid(CostType Val=0)
Type * getReturnType() const
Intrinsic::ID getID() const
A wrapper class for inspecting calls to intrinsic functions.
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
Represents a single loop in the control flow graph.
Information for memory intrinsic cost model.
Intrinsic::ID getID() const
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
Analysis providing profile information.
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
This node represents a polynomial recurrence on the trip count of the specified loop.
SCEVUse getStepRecurrence(ScalarEvolution &SE) const
Constructs and returns the recurrence indicating how much this expression steps by.
This class represents a constant integer value.
const APInt & getAPInt() const
This class represents an analyzed expression in the program.
The main scalar evolution driver.
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StackOffset holds a fixed and a scalable offset in bytes.
static StackOffset getScalable(int64_t Scalable)
static StackOffset getFixed(int64_t Fixed)
An instruction for storing to memory.
StringRef - Represent a constant reference to a string, i.e.
Class to represent struct types.
Provides information about what library functions are available for the current target.
This class represents a truncation of integer types.
static constexpr TypeSize get(ScalarTy Quantity, bool Scalable)
The instances of the Type class are immutable: once they are created, they are never changed.
bool isVectorTy() const
True if this is an instance of VectorType.
LLVM_ABI bool isScalableTy(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this is a type whose size is a known multiple of vscale.
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
static LLVM_ABI IntegerType * getIntNTy(LLVMContext &C, unsigned N)
This is the common base class for vector predication intrinsics.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
Base class of all SIMD vector types.
constexpr ScalarTy getFixedValue() const
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ Fast
Attempts to make calls as fast as possible (e.g.
@ C
The default llvm calling convention, compatible with C.
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
class_match< Constant > m_Constant()
Match an arbitrary Constant and ignore it.
bool match(Val *V, const Pattern &P)
ThreeOps_match< Cond, LHS, RHS, Instruction::Select > m_Select(const Cond &C, const LHS &L, const RHS &R)
Matches SelectInst.
auto m_LogicalOr()
Matches L || R where L and R are arbitrary values.
class_match< Value > m_Value()
Match an arbitrary value and ignore it.
auto m_LogicalAnd()
Matches L && R where L and R are arbitrary values.
match_combine_or< LTy, RTy > m_CombineOr(const LTy &L, const RTy &R)
Combine two pattern matchers matching L || R.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
FunctionAddr VTableAddr uintptr_t uintptr_t DataSize
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
LLVM_ABI Value * getSplatValue(const Value *V)
Get splat value if the input is a splat vector or return nullptr.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
LLVM_ABI void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true, unsigned Depth=0)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
constexpr int PoisonMaskElem
RecurKind
These are the kinds of recurrences that we support.
constexpr unsigned BitWidth
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
gep_type_iterator gep_type_begin(const User *GEP)
@ DataWithoutLaneMask
Same as Data, but avoids using the get.active.lane.mask intrinsic to calculate the mask and instead i...
InstructionUniformity
Enum describing how instructions behave with respect to uniformity and divergence,...
@ Default
The result values are uniform if and only if all operands are uniform.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Attributes of a target dependent hardware loop.
KnownBits anyextOrTrunc(unsigned BitWidth) const
Return known bits for an "any" extension or truncation of the value we're tracking.
Information about a load/store intrinsic defined by the target.