14#ifndef LLVM_ANALYSIS_TARGETTRANSFORMINFOIMPL_H
15#define LLVM_ANALYSIS_TARGETTRANSFORMINFOIMPL_H
58 Type *AccessType)
const {
82 return SI.getNumCases();
160 virtual std::pair<KnownBits, KnownBits>
164 "expected pointer or pointer vector type");
167 if (
DL.isNonIntegralAddressSpace(FromAS))
168 return std::pair(
KnownBits(
DL.getPointerSizeInBits(FromAS)),
174 CastI->getDestAddressSpace(), *CastI->getPointerOperand());
175 FromPtrBits = KB.second;
183 return {FromPtrBits, ToPtrBits};
189 unsigned ToASBitSize =
DL.getPointerSizeInBits(ToAS);
191 if (
DL.isNonIntegralAddressSpace(FromAS))
201 unsigned DstAS)
const {
202 return {
DL.getPointerSizeInBits(SrcAS), 0};
212 virtual std::pair<const Value *, unsigned>
214 return std::make_pair(
nullptr, -1);
224 assert(
F &&
"A concrete function must be provided to this routine.");
231 if (
F->isIntrinsic())
234 if (
F->hasLocalLinkage() || !
F->hasName())
241 if (Name ==
"copysign" || Name ==
"copysignf" || Name ==
"copysignl" ||
242 Name ==
"fabs" || Name ==
"fabsf" || Name ==
"fabsl" ||
243 Name ==
"fmin" || Name ==
"fminf" || Name ==
"fminl" ||
244 Name ==
"fmax" || Name ==
"fmaxf" || Name ==
"fmaxl" ||
245 Name ==
"sin" || Name ==
"sinf" || Name ==
"sinl" ||
246 Name ==
"cos" || Name ==
"cosf" || Name ==
"cosl" ||
247 Name ==
"tan" || Name ==
"tanf" || Name ==
"tanl" ||
248 Name ==
"asin" || Name ==
"asinf" || Name ==
"asinl" ||
249 Name ==
"acos" || Name ==
"acosf" || Name ==
"acosl" ||
250 Name ==
"atan" || Name ==
"atanf" || Name ==
"atanl" ||
251 Name ==
"atan2" || Name ==
"atan2f" || Name ==
"atan2l"||
252 Name ==
"sinh" || Name ==
"sinhf" || Name ==
"sinhl" ||
253 Name ==
"cosh" || Name ==
"coshf" || Name ==
"coshl" ||
254 Name ==
"tanh" || Name ==
"tanhf" || Name ==
"tanhl" ||
255 Name ==
"sqrt" || Name ==
"sqrtf" || Name ==
"sqrtl" ||
256 Name ==
"exp10" || Name ==
"exp10l" || Name ==
"exp10f")
260 if (Name ==
"pow" || Name ==
"powf" || Name ==
"powl" || Name ==
"exp2" ||
261 Name ==
"exp2l" || Name ==
"exp2f" || Name ==
"floor" ||
262 Name ==
"floorf" || Name ==
"ceil" || Name ==
"round" ||
263 Name ==
"ffs" || Name ==
"ffsl" || Name ==
"abs" || Name ==
"labs" ||
287 virtual std::optional<Instruction *>
292 virtual std::optional<Value *>
295 bool &KnownBitsComputed)
const {
303 SimplifyAndSetOp)
const {
321 const APInt &)
const {
326 int64_t BaseOffset,
bool HasBaseReg,
327 int64_t Scale,
unsigned AddrSpace,
329 int64_t ScalableOffset = 0)
const {
332 return !BaseGV && BaseOffset == 0 && (Scale == 0 || Scale == 1);
337 return std::tie(
C1.NumRegs,
C1.AddRecCost,
C1.NumIVMuls,
C1.NumBaseAdds,
338 C1.ScaleCost,
C1.ImmCost,
C1.SetupCost) <
384 unsigned DataSize =
DL.getTypeStoreSize(DataType);
391 unsigned DataSize =
DL.getTypeStoreSize(DataType);
409 Align Alignment)
const {
414 Align Alignment)
const {
419 Align Alignment)
const {
441 std::optional<Instruction::CastOps> CastHint)
const {
447 unsigned AddrSpace)
const {
452 Type *DataType)
const {
470 bool HasBaseReg, int64_t Scale,
471 unsigned AddrSpace)
const {
474 Scale, AddrSpace,
nullptr,
486 virtual bool useAA()
const {
return false; }
507 unsigned ScalarOpdIdx)
const {
582 unsigned *
Fast)
const {
638 Type *Ty =
nullptr)
const {
645 return "Generic::Unknown Register Class";
647 return "Generic::ScalarRC";
649 return "Generic::VectorRC";
685 virtual unsigned getMaximumVF(
unsigned ElemWidth,
unsigned Opcode)
const {
694 const Instruction &
I,
bool &AllowPromotionWithoutCommonHeader)
const {
695 AllowPromotionWithoutCommonHeader =
false;
700 virtual std::optional<unsigned>
711 virtual std::optional<unsigned>
727 unsigned NumStridedMemAccesses,
728 unsigned NumPrefetches,
729 bool HasCall)
const {
737 unsigned Opcode,
Type *InputTypeA,
Type *InputTypeB,
Type *AccumType,
745 bool HasUnorderedReductions)
const {
755 auto IsWidenableCondition = [](
const Value *V) {
757 if (
II->getIntrinsicID() == Intrinsic::experimental_widenable_condition)
766 case Instruction::FDiv:
767 case Instruction::FRem:
768 case Instruction::SDiv:
769 case Instruction::SRem:
770 case Instruction::UDiv:
771 case Instruction::URem:
774 case Instruction::And:
775 case Instruction::Or:
776 if (
any_of(Args, IsWidenableCondition))
783 if (Ty->getScalarType()->isFloatingPointTy())
813 case Instruction::IntToPtr: {
814 unsigned SrcSize = Src->getScalarSizeInBits();
815 if (
DL.isLegalInteger(SrcSize) &&
816 SrcSize <=
DL.getPointerTypeSizeInBits(Dst))
820 case Instruction::PtrToAddr: {
821 unsigned DstSize = Dst->getScalarSizeInBits();
822 assert(DstSize ==
DL.getAddressSizeInBits(Src));
823 if (
DL.isLegalInteger(DstSize))
827 case Instruction::PtrToInt: {
828 unsigned DstSize = Dst->getScalarSizeInBits();
829 if (
DL.isLegalInteger(DstSize) &&
830 DstSize >=
DL.getPointerTypeSizeInBits(Src))
834 case Instruction::BitCast:
835 if (Dst == Src || (Dst->isPointerTy() && Src->isPointerTy()))
839 case Instruction::Trunc: {
888 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx,
903 unsigned Index)
const {
909 const APInt &DemandedDstElts,
920 if (Opcode == Instruction::InsertValue &&
936 bool UseMaskForCond,
bool UseMaskForGaps)
const {
943 switch (ICA.
getID()) {
946 case Intrinsic::allow_runtime_check:
947 case Intrinsic::allow_ubsan_check:
948 case Intrinsic::annotation:
949 case Intrinsic::assume:
950 case Intrinsic::sideeffect:
951 case Intrinsic::pseudoprobe:
952 case Intrinsic::arithmetic_fence:
953 case Intrinsic::invariant_start:
954 case Intrinsic::invariant_end:
955 case Intrinsic::launder_invariant_group:
956 case Intrinsic::is_constant:
957 case Intrinsic::lifetime_start:
958 case Intrinsic::lifetime_end:
959 case Intrinsic::experimental_noalias_scope_decl:
960 case Intrinsic::objectsize:
961 case Intrinsic::ptr_annotation:
962 case Intrinsic::var_annotation:
963 case Intrinsic::experimental_gc_result:
964 case Intrinsic::experimental_gc_relocate:
965 case Intrinsic::coro_alloc:
966 case Intrinsic::coro_begin:
967 case Intrinsic::coro_begin_custom_abi:
968 case Intrinsic::coro_dead:
969 case Intrinsic::coro_id:
970 case Intrinsic::coro_id_async:
971 case Intrinsic::coro_id_retcon:
972 case Intrinsic::coro_id_retcon_once:
973 case Intrinsic::coro_noop:
974 case Intrinsic::coro_free:
975 case Intrinsic::coro_end:
976 case Intrinsic::coro_frame:
977 case Intrinsic::coro_size:
978 case Intrinsic::coro_align:
979 case Intrinsic::coro_suspend:
980 case Intrinsic::coro_subfn_addr:
981 case Intrinsic::threadlocal_address:
982 case Intrinsic::experimental_widenable_condition:
983 case Intrinsic::ssa_copy:
986 case Intrinsic::bswap:
997 switch (MICA.
getID()) {
998 case Intrinsic::masked_scatter:
999 case Intrinsic::masked_gather:
1000 case Intrinsic::masked_load:
1001 case Intrinsic::masked_store:
1002 case Intrinsic::vp_scatter:
1003 case Intrinsic::vp_gather:
1004 case Intrinsic::masked_compressstore:
1005 case Intrinsic::masked_expandload:
1006 case Intrinsic::speculative_load:
1030 std::optional<FastMathFlags> FMF,
1043 VectorType *Ty, std::optional<FastMathFlags> FMF,
1075 bool CanCreate =
true)
const {
1081 unsigned SrcAddrSpace,
unsigned DestAddrSpace,
1083 std::optional<uint32_t> AtomicElementSize)
const {
1084 return AtomicElementSize ?
Type::getIntNTy(Context, *AtomicElementSize * 8)
1090 unsigned RemainingBytes,
unsigned SrcAddrSpace,
unsigned DestAddrSpace,
1092 std::optional<uint32_t> AtomicCpySize)
const {
1093 unsigned OpSizeInBytes = AtomicCpySize.value_or(1);
1095 for (
unsigned i = 0; i != RemainingBytes; i += OpSizeInBytes)
1101 return (Caller->getFnAttribute(
"target-cpu") ==
1102 Callee->getFnAttribute(
"target-cpu")) &&
1103 (Caller->getFnAttribute(
"target-features") ==
1104 Callee->getFnAttribute(
"target-features"));
1108 unsigned DefaultCallPenalty)
const {
1109 return DefaultCallPenalty;
1122 return (Caller->getFnAttribute(
"target-cpu") ==
1123 Callee->getFnAttribute(
"target-cpu")) &&
1124 (Caller->getFnAttribute(
"target-features") ==
1125 Callee->getFnAttribute(
"target-features"));
1146 unsigned AddrSpace)
const {
1152 unsigned AddrSpace)
const {
1165 GatherUseOps)
const {
1166 return TargetTransformInfo::VectorInstrContext::None;
1174 unsigned ChainSizeInBytes,
1180 unsigned ChainSizeInBytes,
1285 unsigned MaxRequiredSize =
1286 VT->getElementType()->getPrimitiveSizeInBits().getFixedValue();
1288 unsigned MinRequiredSize = 0;
1289 for (
unsigned i = 0, e = VT->getNumElements(); i < e; ++i) {
1290 if (
auto *IntElement =
1292 bool signedElement = IntElement->getValue().isNegative();
1294 unsigned ElementMinRequiredSize =
1295 IntElement->getValue().getSignificantBits() - 1;
1299 MinRequiredSize = std::max(MinRequiredSize, ElementMinRequiredSize);
1302 return MaxRequiredSize;
1305 return MinRequiredSize;
1309 isSigned = CI->getValue().isNegative();
1310 return CI->getValue().getSignificantBits() - 1;
1315 return Cast->getSrcTy()->getScalarSizeInBits() - 1;
1320 return Cast->getSrcTy()->getScalarSizeInBits();
1332 const SCEV *Ptr)
const {
1340 int64_t MergeDistance)
const {
1354template <
typename T>
1366 Type *AccessType)
const override {
1367 assert(PointeeType && Ptr &&
"can't get GEPCost of nullptr");
1369 bool HasBaseReg = (BaseGV ==
nullptr);
1371 auto PtrSizeBits =
DL.getPointerTypeSizeInBits(Ptr->
getType());
1372 APInt BaseOffset(PtrSizeBits, 0);
1376 Type *TargetType =
nullptr;
1384 TargetType = GTI.getIndexedType();
1391 if (
StructType *STy = GTI.getStructTypeOrNull()) {
1393 assert(ConstIdx &&
"Unexpected GEP index");
1395 BaseOffset +=
DL.getStructLayout(STy)->getElementOffset(
Field);
1399 if (TargetType->isScalableTy())
1401 int64_t ElementSize =
1402 GTI.getSequentialElementStride(
DL).getFixedValue();
1411 Scale = ElementSize;
1426 AccessType = TargetType;
1457 for (
const Value *V : Ptrs) {
1461 if (Info.isSameBase() && V !=
Base) {
1462 if (
GEP->hasAllConstantIndices())
1465 Instruction::Add,
GEP->getType(), CostKind,
1466 {TTI::OK_AnyValue, TTI::OP_None}, {TTI::OK_AnyValue, TTI::OP_None},
1471 GEP->getSourceElementType(),
GEP->getPointerOperand(), Indices,
1472 CostKind, AccessTy);
1483 auto *TargetTTI =
static_cast<const T *
>(
this);
1488 if (
const Function *
F = CB->getCalledFunction()) {
1489 if (!TargetTTI->isLoweredToCall(
F))
1498 Type *Ty = U->getType();
1504 case Instruction::Call: {
1508 return TargetTTI->getIntrinsicInstrCost(CostAttrs, CostKind);
1510 case Instruction::UncondBr:
1511 case Instruction::CondBr:
1512 case Instruction::Ret:
1513 case Instruction::PHI:
1514 case Instruction::Switch:
1515 return TargetTTI->getCFInstrCost(Opcode, CostKind,
I);
1516 case Instruction::Freeze:
1518 case Instruction::ExtractValue:
1519 case Instruction::InsertValue:
1520 return TargetTTI->getInsertExtractValueCost(Opcode, CostKind);
1521 case Instruction::Alloca:
1525 case Instruction::GetElementPtr: {
1527 Type *AccessType =
nullptr;
1530 if (
GEP->hasOneUser() &&
I)
1531 AccessType =
I->user_back()->getAccessType();
1533 return TargetTTI->getGEPCost(
GEP->getSourceElementType(),
1535 CostKind, AccessType);
1537 case Instruction::Add:
1538 case Instruction::FAdd:
1539 case Instruction::Sub:
1540 case Instruction::FSub:
1541 case Instruction::Mul:
1542 case Instruction::FMul:
1543 case Instruction::UDiv:
1544 case Instruction::SDiv:
1545 case Instruction::FDiv:
1546 case Instruction::URem:
1547 case Instruction::SRem:
1548 case Instruction::FRem:
1549 case Instruction::Shl:
1550 case Instruction::LShr:
1551 case Instruction::AShr:
1552 case Instruction::And:
1553 case Instruction::Or:
1554 case Instruction::Xor:
1555 case Instruction::FNeg: {
1558 if (Opcode != Instruction::FNeg)
1560 return TargetTTI->getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
1563 case Instruction::IntToPtr:
1564 case Instruction::PtrToAddr:
1565 case Instruction::PtrToInt:
1566 case Instruction::SIToFP:
1567 case Instruction::UIToFP:
1568 case Instruction::FPToUI:
1569 case Instruction::FPToSI:
1570 case Instruction::Trunc:
1571 case Instruction::FPTrunc:
1572 case Instruction::BitCast:
1573 case Instruction::FPExt:
1574 case Instruction::SExt:
1575 case Instruction::ZExt:
1576 case Instruction::AddrSpaceCast: {
1578 return TargetTTI->getCastInstrCost(
1581 case Instruction::Store: {
1585 return TargetTTI->getMemoryOpCost(Opcode, ValTy,
SI->getAlign(),
1586 SI->getPointerAddressSpace(), CostKind,
1589 case Instruction::Load: {
1591 Type *LoadType = U->getType();
1602 LoadType = TI->getDestTy();
1604 return TargetTTI->getMemoryOpCost(Opcode, LoadType, LI->getAlign(),
1606 {TTI::OK_AnyValue, TTI::OP_None},
I);
1608 case Instruction::Select: {
1609 const Value *Op0, *Op1;
1620 return TargetTTI->getArithmeticInstrCost(
1622 CostKind, Op1Info, Op2Info,
Operands,
I);
1627 return TargetTTI->getCmpSelInstrCost(Opcode, U->getType(), CondTy,
1629 CostKind, Op1Info, Op2Info,
I);
1631 case Instruction::ICmp:
1632 case Instruction::FCmp: {
1637 return TargetTTI->getCmpSelInstrCost(Opcode, ValTy, U->getType(),
1640 CostKind, Op1Info, Op2Info,
I);
1642 case Instruction::InsertElement: {
1648 if (CI->getValue().getActiveBits() <= 32)
1649 Idx = CI->getZExtValue();
1650 return TargetTTI->getVectorInstrCost(*IE, Ty, CostKind, Idx,
1653 case Instruction::ShuffleVector: {
1661 int NumSubElts, SubIndex;
1664 if (
all_of(Mask, [](
int M) {
return M < 0; }))
1668 if (Shuffle->changesLength()) {
1670 if (Shuffle->increasesLength() && Shuffle->isIdentityWithPadding())
1673 if (Shuffle->isExtractSubvectorMask(SubIndex))
1675 VecSrcTy, CostKind, Mask, SubIndex,
1678 if (Shuffle->isInsertSubvectorMask(NumSubElts, SubIndex))
1679 return TargetTTI->getShuffleCost(
1685 int ReplicationFactor, VF;
1686 if (Shuffle->isReplicationMask(ReplicationFactor, VF)) {
1690 DemandedDstElts.
setBit(
I.index());
1692 return TargetTTI->getReplicationShuffleCost(
1693 VecSrcTy->getElementType(), ReplicationFactor, VF,
1694 DemandedDstElts, CostKind);
1698 NumSubElts = VecSrcTy->getElementCount().getKnownMinValue();
1704 if (Shuffle->increasesLength()) {
1705 for (
int &M : AdjustMask)
1706 M = M >= NumSubElts ? (M + (Mask.size() - NumSubElts)) : M;
1708 return TargetTTI->getShuffleCost(
1710 VecTy, CostKind, AdjustMask, 0,
nullptr,
Operands, Shuffle);
1721 VecSrcTy, VecSrcTy, CostKind, AdjustMask, 0,
nullptr,
Operands,
1725 std::iota(ExtractMask.
begin(), ExtractMask.
end(), 0);
1726 return ShuffleCost + TargetTTI->getShuffleCost(
1728 CostKind, ExtractMask, 0, VecTy, {}, Shuffle);
1731 if (Shuffle->isIdentity())
1734 if (Shuffle->isReverse())
1736 CostKind, Mask, 0,
nullptr,
Operands,
1739 if (Shuffle->isTranspose())
1741 CostKind, Mask, 0,
nullptr,
Operands,
1744 if (Shuffle->isZeroEltSplat())
1746 CostKind, Mask, 0,
nullptr,
Operands,
1749 if (Shuffle->isSingleSource())
1751 VecSrcTy, CostKind, Mask, 0,
nullptr,
1754 if (Shuffle->isInsertSubvectorMask(NumSubElts, SubIndex))
1755 return TargetTTI->getShuffleCost(
1760 if (Shuffle->isSelect())
1761 return TargetTTI->getShuffleCost(
TTI::SK_Select, VecTy, VecSrcTy,
1762 CostKind, Mask, 0,
nullptr,
Operands,
1765 if (Shuffle->isSplice(SubIndex))
1766 return TargetTTI->getShuffleCost(
TTI::SK_Splice, VecTy, VecSrcTy,
1767 CostKind, Mask, SubIndex,
nullptr,
1771 CostKind, Mask, 0,
nullptr,
Operands,
1774 case Instruction::ExtractElement: {
1780 if (CI->getValue().getActiveBits() <= 32)
1781 Idx = CI->getZExtValue();
1783 return TargetTTI->getVectorInstrCost(*EEI, DstTy, CostKind, Idx);
1792 auto *TargetTTI =
static_cast<const T *
>(
this);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
static bool isSigned(unsigned Opcode)
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)
static void computeKnownBits(const Value *V, const APInt &DemandedElts, KnownBits &Known, const SimplifyQuery &Q, unsigned Depth)
Determine which bits of V are known to be either zero or one and return them in the Known bit set.
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
Represent a constant reference to an array (0 or more elements consecutively in memory),...
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)
This instruction compares its operands according to the predicate given to the constructor.
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.
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 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).
An efficient, type-erasing, non-owning reference to a callable.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
match_combine_or< Ty... > m_CombineOr(const Ty &...Ps)
Combine pattern matchers matching any of Ps patterns.
LogicalOp_match< LHS, RHS, Instruction::And > m_LogicalAnd(const LHS &L, const RHS &R)
Matches L && R either in the form of L & R or L ?
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_Value()
Match an arbitrary value and ignore it.
auto m_Constant()
Match an arbitrary Constant and ignore it.
auto m_LogicalOr()
Matches L || R where L and R are arbitrary values.
auto m_LogicalAnd()
Matches L && R where L and R are arbitrary values.
LogicalOp_match< LHS, RHS, Instruction::Or > m_LogicalOr(const LHS &L, const RHS &R)
Matches L || R either in the form of L | R or L ?
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.
@ Known
Known to have no common set bits.
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.
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.
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.
@ Fast
Assign the register banks as fast as possible (default).
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...
ValueUniformity
Enum describing how values behave with respect to uniformity and divergence, to answer the question: ...
@ Default
The result value is 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.