49 : StructSize(
TypeSize::getFixed(0)) {
50 assert(!
ST->isOpaque() &&
"Cannot get layout of opaque structs");
52 NumElements =
ST->getNumElements();
55 for (
unsigned i = 0, e = NumElements; i !=
e; ++i) {
56 Type *Ty =
ST->getElementType(i);
57 if (i == 0 && Ty->isScalableTy())
60 const Align TyAlign =
ST->isPacked() ?
Align(1) :
DL.getABITypeAlign(Ty);
69 if (!StructSize.isScalable() && !
isAligned(TyAlign, StructSize)) {
75 StructAlignment = std::max(TyAlign, StructAlignment);
79 StructSize +=
DL.getTypeAllocSize(Ty);
84 if (!StructSize.isScalable() && !
isAligned(StructAlignment, StructSize)) {
93 assert(!StructSize.isScalable() &&
94 "Cannot get element at offset for structure containing scalable "
103 assert(
SI != MemberOffsets.
begin() &&
"Offset not in structure type!");
108 (
SI + 1 == MemberOffsets.
end() ||
110 "Upper bound didn't work!");
117 return SI - MemberOffsets.
begin();
122class StructLayoutMap {
124 LayoutInfoTy LayoutInfo;
129 for (
const auto &
I : LayoutInfo) {
131 Value->~StructLayout();
136 StructLayout *&operator[](StructType *STy) {
return LayoutInfo[STy]; }
162struct LessPrimitiveBitWidth {
164 unsigned RHSBitWidth)
const {
165 return LHS.BitWidth < RHSBitWidth;
170struct LessPointerAddrSpace {
172 unsigned RHSAddrSpace)
const {
173 return LHS.AddrSpace < RHSAddrSpace;
202 if (
Error Err = parseLayoutString(LayoutString))
207 delete static_cast<StructLayoutMap *
>(LayoutMap);
209 StringRepresentation =
Other.StringRepresentation;
210 BigEndian =
Other.BigEndian;
211 VectorsAreElementAligned =
Other.VectorsAreElementAligned;
212 AllocaAddrSpace =
Other.AllocaAddrSpace;
213 ProgramAddrSpace =
Other.ProgramAddrSpace;
214 DefaultGlobalsAddrSpace =
Other.DefaultGlobalsAddrSpace;
215 StackNaturalAlign =
Other.StackNaturalAlign;
216 FunctionPtrAlign =
Other.FunctionPtrAlign;
217 TheFunctionPtrAlignType =
Other.TheFunctionPtrAlignType;
218 ManglingMode =
Other.ManglingMode;
219 LegalIntWidths =
Other.LegalIntWidths;
220 IntSpecs =
Other.IntSpecs;
221 FloatSpecs =
Other.FloatSpecs;
222 VectorSpecs =
Other.VectorSpecs;
223 PointerSpecs =
Other.PointerSpecs;
224 StructABIAlignment =
Other.StructABIAlignment;
225 StructPrefAlignment =
Other.StructPrefAlignment;
231 return BigEndian ==
Other.BigEndian &&
232 VectorsAreElementAligned ==
Other.VectorsAreElementAligned &&
233 AllocaAddrSpace ==
Other.AllocaAddrSpace &&
234 ProgramAddrSpace ==
Other.ProgramAddrSpace &&
235 DefaultGlobalsAddrSpace ==
Other.DefaultGlobalsAddrSpace &&
236 StackNaturalAlign ==
Other.StackNaturalAlign &&
237 FunctionPtrAlign ==
Other.FunctionPtrAlign &&
238 TheFunctionPtrAlignType ==
Other.TheFunctionPtrAlignType &&
239 ManglingMode ==
Other.ManglingMode &&
240 LegalIntWidths ==
Other.LegalIntWidths && IntSpecs ==
Other.IntSpecs &&
241 FloatSpecs ==
Other.FloatSpecs && VectorSpecs ==
Other.VectorSpecs &&
242 PointerSpecs ==
Other.PointerSpecs &&
243 StructABIAlignment ==
Other.StructABIAlignment &&
244 StructPrefAlignment ==
Other.StructPrefAlignment;
249 if (
Error Err = Layout.parseLayoutString(LayoutString))
250 return std::move(Err);
280 if (Str.consumeInteger(10, AddrSpace) || !
isUInt<24>(AddrSpace))
287 if (Str.front() !=
'(')
291 if (Str.back() !=
')' || Str.size() == 2)
303 if (AddrSpaceName.
size() == 1) {
304 char C = AddrSpaceName.
front();
305 if (
C ==
'P' ||
C ==
'G' ||
C ==
'A')
307 "Cannot use predefined address space names P/G/A in data layout");
336 bool AllowZero =
false) {
347 Alignment =
Align(1);
351 constexpr unsigned ByteWidth = 8;
354 Name +
" alignment must be a power of two times the byte width");
364 assert(Specifier ==
'i' || Specifier ==
'f' || Specifier ==
'v');
367 if (Components.
size() < 2 || Components.
size() > 3)
380 if (Specifier ==
'i' &&
BitWidth == 8 && ABIAlign != 1)
384 Align PrefAlign = ABIAlign;
385 if (Components.
size() > 2)
389 if (PrefAlign < ABIAlign)
391 "preferred alignment cannot be less than the ABI alignment");
393 setPrimitiveSpec(Specifier,
BitWidth, ABIAlign, PrefAlign);
403 if (Components.
size() < 2 || Components.
size() > 3)
409 if (!Components[0].
empty()) {
422 Align PrefAlign = ABIAlign;
423 if (Components.
size() > 2)
427 if (PrefAlign < ABIAlign)
429 "preferred alignment cannot be less than the ABI alignment");
431 StructABIAlignment = ABIAlign;
432 StructPrefAlignment = PrefAlign;
436Error DataLayout::parsePointerSpec(
443 if (Components.
size() < 3 || Components.
size() > 5)
447 unsigned AddrSpace = 0;
448 bool ExternalState =
false;
449 bool UnstableRepr =
false;
452 NullPtrKind NullPtrFlag = NullPtrKind::Default;
453 StringRef AddrSpaceName;
454 StringRef AddrSpaceStr = Components[0];
455 while (!AddrSpaceStr.
empty()) {
456 char C = AddrSpaceStr.
front();
458 ExternalState =
true;
459 }
else if (
C ==
'u') {
461 }
else if (
C ==
'z') {
462 if (NullPtrFlag != NullPtrKind::Default)
464 NullPtrFlag = NullPtrKind::Zero;
465 }
else if (
C ==
'o') {
466 if (NullPtrFlag != NullPtrKind::Default)
468 NullPtrFlag = NullPtrKind::AllOnes;
477 if (!AddrSpaceStr.
empty())
481 if (AddrSpace == 0 && (ExternalState || UnstableRepr))
483 "address space 0 cannot be unstable or have external state");
486 if (!AddrSpaceName.
empty() && !AddrSpaceNames.
insert(AddrSpaceName).second)
502 Align PrefAlign = ABIAlign;
503 if (Components.
size() > 3)
507 if (PrefAlign < ABIAlign)
509 "preferred alignment cannot be less than the ABI alignment");
513 if (Components.
size() > 4)
514 if (
Error Err =
parseSize(Components[4], IndexBitWidth,
"index size"))
519 "index size cannot be larger than the pointer size");
521 APInt NullPtrValue = NullPtrFlag == NullPtrKind::AllOnes
525 setPointerSpec(AddrSpace,
BitWidth, ABIAlign, PrefAlign, IndexBitWidth,
526 UnstableRepr, ExternalState, AddrSpaceName, NullPtrValue);
530Error DataLayout::parseSpecification(
542 for (StringRef Str :
split(Rest,
':')) {
548 NonIntegralAddressSpaces.
push_back(AddrSpace);
554 VectorsAreElementAligned =
true;
559 assert(!Spec.
empty() &&
"Empty specification is handled by the caller");
562 if (Specifier ==
'i' || Specifier ==
'f' || Specifier ==
'v')
563 return parsePrimitiveSpec(Spec);
565 if (Specifier ==
'a')
566 return parseAggregateSpec(Spec);
568 if (Specifier ==
'p')
569 return parsePointerSpec(Spec, AddrSpaceNames);
581 "malformed specification, must be just 'e' or 'E'");
586 for (StringRef Str :
split(Rest,
':')) {
600 StackNaturalAlign = Alignment;
623 FunctionPtrAlign = Alignment;
656 ManglingMode = MM_ELF;
659 ManglingMode = MM_GOFF;
662 ManglingMode = MM_MachO;
665 ManglingMode = MM_Mips;
668 ManglingMode = MM_WinCOFF;
671 ManglingMode = MM_WinCOFFX86;
674 ManglingMode = MM_XCOFF;
686 StringRepresentation = LayoutString.
str();
688 if (LayoutString.
empty())
693 SmallVector<unsigned, 8> NonIntegralAddressSpaces;
694 SmallDenseSet<StringRef, 8> AddessSpaceNames;
695 for (StringRef Spec :
split(StringRepresentation,
'-')) {
698 if (
Error Err = parseSpecification(Spec, NonIntegralAddressSpaces,
705 for (
unsigned AS : NonIntegralAddressSpaces) {
709 setPointerSpec(AS, PS.BitWidth, PS.ABIAlign, PS.PrefAlign, PS.IndexBitWidth,
717void DataLayout::setPrimitiveSpec(
char Specifier, uint32_t
BitWidth,
719 SmallVectorImpl<PrimitiveSpec> *Specs;
730 Specs = &VectorSpecs;
737 I->ABIAlign = ABIAlign;
738 I->PrefAlign = PrefAlign;
746DataLayout::getPointerSpec(uint32_t AddrSpace)
const {
747 if (AddrSpace != 0) {
748 auto I =
lower_bound(PointerSpecs, AddrSpace, LessPointerAddrSpace());
749 if (
I != PointerSpecs.end() &&
I->AddrSpace == AddrSpace)
753 assert(PointerSpecs[0].AddrSpace == 0);
754 return PointerSpecs[0];
757void DataLayout::setPointerSpec(uint32_t AddrSpace, uint32_t
BitWidth,
759 uint32_t IndexBitWidth,
bool HasUnstableRepr,
760 bool HasExternalState,
StringRef AddrSpaceName,
761 APInt NullPtrValue) {
762 auto I =
lower_bound(PointerSpecs, AddrSpace, LessPointerAddrSpace());
763 if (
I == PointerSpecs.end() ||
I->AddrSpace != AddrSpace) {
765 IndexBitWidth, HasUnstableRepr,
766 HasExternalState, AddrSpaceName.
str(),
767 std::move(NullPtrValue)});
770 I->ABIAlign = ABIAlign;
771 I->PrefAlign = PrefAlign;
772 I->IndexBitWidth = IndexBitWidth;
773 I->HasUnstableRepresentation = HasUnstableRepr;
774 I->HasExternalState = HasExternalState;
775 I->AddrSpaceName = AddrSpaceName.
str();
776 I->NullPtrValue = std::move(NullPtrValue);
781 bool abi_or_pref)
const {
782 auto I = IntSpecs.begin();
783 for (;
I != IntSpecs.end(); ++
I) {
791 if (
I == IntSpecs.end())
793 return abi_or_pref ?
I->ABIAlign :
I->PrefAlign;
800 LayoutMap =
new StructLayoutMap();
802 StructLayoutMap *STM =
static_cast<StructLayoutMap*
>(LayoutMap);
821 return getPointerSpec(AS).ABIAlign;
825 return getPointerSpec(AS).AddrSpaceName;
832 if (
II != PointerSpecs.end())
833 return II->AddrSpace;
838 return getPointerSpec(AS).PrefAlign;
846 assert(Ty->isPtrOrPtrVectorTy() &&
847 "This should only be called with a pointer or pointer vector type");
848 Ty = Ty->getScalarType();
853 return divideCeil(getPointerSpec(AS).IndexBitWidth, 8);
857 assert(Ty->isPtrOrPtrVectorTy() &&
858 "This should only be called with a pointer or pointer vector type");
859 Ty = Ty->getScalarType();
871Align DataLayout::getAlignment(
Type *Ty,
bool abi_or_pref)
const {
872 assert(Ty->isSized() &&
"Cannot getTypeInfo() on a type that is unsized!");
873 switch (Ty->getTypeID()) {
892 const Align Align = abi_or_pref ? StructABIAlignment : StructPrefAlignment;
911 if (
I != FloatSpecs.end() &&
I->BitWidth ==
BitWidth)
912 return abi_or_pref ?
I->ABIAlign :
I->PrefAlign;
926 if (
I != VectorSpecs.end() &&
I->BitWidth ==
BitWidth)
927 return abi_or_pref ?
I->ABIAlign :
I->PrefAlign;
944 return getAlignment(LayoutTy, abi_or_pref);
952 switch (Ty->getTypeID()) {
970 unsigned BitWidth = Ty->getIntegerBitWidth();
976 unsigned AS = Ty->getPointerAddressSpace();
990 return getAlignment(Ty,
true);
994 return getAlignment(Ty,
false);
1003 assert(Ty->isPtrOrPtrVectorTy() &&
1004 "Expected a pointer or pointer vector type.");
1018 assert(Ty->isPtrOrPtrVectorTy() &&
1019 "Expected a pointer or pointer vector type.");
1028 for (
unsigned LegalIntWidth : LegalIntWidths)
1029 if (Width <= LegalIntWidth)
1036 return Max != LegalIntWidths.end() ? *Max : 0;
1045 assert(Ty->isPtrOrPtrVectorTy() &&
1046 "Expected a pointer or pointer vector type.");
1061 for (; GTI != GTE; ++GTI) {
1086 if (ElemSize.
isScalable() || ElemSize == 0 ||
1093 Offset -= Index * FixedElemSize;
1094 if (
Offset.isNegative()) {
1098 assert(
Offset.isNonNegative() &&
"Remaining offset shouldn't be negative");
1106 ElemTy = ArrTy->getElementType();
1114 return std::nullopt;
1121 return std::nullopt;
1125 ElemTy = STy->getElementType(Index);
1126 return APInt(32, Index);
1130 return std::nullopt;
1135 assert(ElemTy->isSized() &&
"Element type must be sized");
1155 return *GVAlignment;
1166 if (*GVAlignment >= Alignment)
1167 Alignment = *GVAlignment;
1176 if (Alignment <
Align(16)) {
1180 Alignment =
Align(16);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static SmallVector< size_t > getMemberOffsets(const DataLayout &DL, GlobalVariable *Handle, llvm::function_ref< bool(Type *)> IsPadding)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static Error parseSize(StringRef Str, unsigned &BitWidth, StringRef Name="size")
Attempts to parse a size component of a specification.
static APInt getElementIndex(TypeSize ElemSize, APInt &Offset)
static Error parseAddrSpace(StringRef Str, unsigned &AddrSpace)
Attempts to parse an address space component of a specification.
static Error createSpecFormatError(Twine Format)
static Error parseAlignment(StringRef Str, Align &Alignment, StringRef Name, bool AllowZero=false)
Attempts to parse an alignment component of a specification.
constexpr DataLayout::PrimitiveSpec DefaultFloatSpecs[]
constexpr DataLayout::PrimitiveSpec DefaultIntSpecs[]
static Error parseAddrSpaceAndName(StringRef Str, unsigned &AddrSpace, StringRef &AddrSpaceName)
Attempts to parse an address space component of a specification allowing name to be specified as well...
This file defines the DenseMap class.
This file defines counterparts of C library allocation functions defined in the namespace 'std'.
static unsigned getAddressSpace(const Value *V, unsigned MaxLookup)
uint64_t IntrinsicInst * II
static uint32_t getAlignment(const MCSectionCOFF &Sec)
Class for arbitrary precision integers.
static APInt getAllOnes(unsigned numBits)
Return an APInt of a specified width with all bits set.
static APInt getZero(unsigned numBits)
Get the '0' value for the specified bit-width.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Class to represent byte types.
static LLVM_ABI ByteType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing a ByteType.
A parsed version of the target data layout string in and methods for querying it.
LLVM_ABI std::optional< unsigned > getNamedAddressSpace(StringRef Name) const
LLVM_ABI StringRef getAddressSpaceName(unsigned AS) const
unsigned getPointerSizeInBits(unsigned AS=0) const
The size in bits of the pointer representation in a given address space.
@ MultipleOfFunctionAlign
The function pointer alignment is a multiple of the function alignment.
@ Independent
The function pointer alignment is independent of the function alignment.
LLVM_ABI SmallVector< APInt > getGEPIndicesForOffset(Type *&ElemTy, APInt &Offset) const
Get GEP indices to access Offset inside ElemTy.
LLVM_ABI unsigned getLargestLegalIntTypeSizeInBits() const
Returns the size of largest legal integer type size, or 0 if none are set.
bool vectorsAreElementAligned() const
Whether vectors are element aligned, rather than naturally aligned.
LLVM_ABI unsigned getIndexSize(unsigned AS) const
The index size in bytes used for address calculation, rounded up to a whole number of bytes.
LLVM_ABI const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
LLVM_ABI DataLayout()
Constructs a DataLayout with default values.
LLVM_ABI IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space.
LLVM_ABI Align getABITypeAlign(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
LLVM_ABI unsigned getIndexTypeSizeInBits(Type *Ty) const
The size in bits of the index used in GEP calculation for this type.
LLVM_ABI unsigned getPointerTypeSizeInBits(Type *) const
The pointer representation size in bits for this type.
LLVM_ABI ByteType * getBytePtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns a byte type with the same size of a pointer in the given address space.
LLVM_ABI DataLayout & operator=(const DataLayout &Other)
LLVM_ABI IntegerType * getIndexType(LLVMContext &C, unsigned AddressSpace) const
Returns the type of a GEP index in AddressSpace.
LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
LLVM_ABI std::optional< APInt > getGEPIndexForOffset(Type *&ElemTy, APInt &Offset) const
Get single GEP index to access Offset inside ElemTy.
LLVM_ABI Type * getSmallestLegalIntType(LLVMContext &C, unsigned Width=0) const
Returns the smallest integer type with size at least as big as Width bits.
LLVM_ABI Align getPreferredAlign(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
LLVM_ABI unsigned getPointerSize(unsigned AS=0) const
The pointer representation size in bytes, rounded up to a whole number of bytes.
LLVM_ABI Align getPointerPrefAlignment(unsigned AS=0) const
Return target's alignment for stack-based pointers FIXME: The defaults need to be removed once all of...
unsigned getIndexSizeInBits(unsigned AS) const
The size in bits of indices used for address calculation in getelementptr and for addresses in the gi...
TypeSize getTypeSizeInBits(Type *Ty) const
Size examples:
TypeSize getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type.
LLVM_ABI bool operator==(const DataLayout &Other) const
LLVM_ABI int64_t getIndexedOffsetInType(Type *ElemTy, ArrayRef< Value * > Indices) const
Returns the offset from the beginning of the type for the specified indices.
LLVM_ABI Align getPointerABIAlignment(unsigned AS) const
Layout pointer alignment.
LLVM_ABI Align getPrefTypeAlign(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
static LLVM_ABI Expected< DataLayout > parse(StringRef LayoutString)
Parse a data layout string and return the layout.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
bool hasSection() const
Check if this global has a custom object file section.
Type * getValueType() const
bool hasInitializer() const
Definitions have initializers, declarations don't.
MaybeAlign getAlign() const
Returns the alignment of the given variable.
Class to represent integer types.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
This is an important class for using LLVM in a threaded context.
Implements a dense probed hash-table based set with some number of buckets stored inline.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
std::string str() const
str - Get the contents as an std::string.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
empty - Check if the string is empty.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
constexpr size_t size() const
size - Get the string size.
char front() const
front - Get the first character in the string.
bool consume_front(char Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
TypeSize getSizeInBytes() const
MutableArrayRef< TypeSize > getMemberOffsets()
LLVM_ABI unsigned getElementContainingOffset(uint64_t FixedOffset) const
Given a valid byte offset into the structure, returns the structure index that contains it.
TypeSize getElementOffset(unsigned Idx) const
Align getAlignment() const
Class to represent struct types.
static constexpr std::enable_if_t< std::is_same_v< Foo< TrailingTys... >, Foo< Tys... > >, size_t > totalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t >::type... Counts)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static constexpr TypeSize getFixed(ScalarTy ExactSize)
static constexpr TypeSize getScalable(ScalarTy MinimumSize)
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI unsigned getIntegerBitWidth() const
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
@ HalfTyID
16-bit floating point type
@ TargetExtTyID
Target extension type.
@ ScalableVectorTyID
Scalable SIMD vector type.
@ FloatTyID
32-bit floating point type
@ IntegerTyID
Arbitrary bit width integers.
@ FixedVectorTyID
Fixed width SIMD vector type.
@ BFloatTyID
16-bit floating point type (7-bit significand)
@ DoubleTyID
64-bit floating point type
@ X86_FP80TyID
80-bit floating point type (X87)
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
@ ByteTyID
Arbitrary bit width bytes.
@ FP128TyID
128-bit floating point type (112-bit significand)
LLVM_ABI unsigned getByteBitWidth() const
bool isIntegerTy() const
True if this is an instance of IntegerType.
static LLVM_ABI IntegerType * getIntNTy(LLVMContext &C, unsigned N)
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
Base class of all SIMD vector types.
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
std::pair< iterator, bool > insert(const ValueT &V)
constexpr ScalarTy getFixedValue() const
static constexpr bool isKnownLE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
static constexpr bool isKnownLT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
static constexpr bool isKnownGT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
StructType * getStructTypeOrNull() const
TypeSize getSequentialElementStride(const DataLayout &DL) const
Value * getOperand() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isAligned(Align Lhs, uint64_t SizeInBytes)
Checks that SizeInBytes is a multiple of the alignment.
constexpr bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
gep_type_iterator gep_type_end(const User *GEP)
auto upper_bound(R &&Range, T &&Value)
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
uint64_t PowerOf2Ceil(uint64_t A)
Returns the power of two which is greater than or equal to the given value.
bool isAlpha(char C)
Checks if character C is a valid letter as classified by "C" locale.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
bool isDigit(char C)
Checks if character C is one of the 10 decimal digits.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
iterator_range< SplittingIterator > split(StringRef Str, StringRef Separator)
Split the specified string over a separator and return a range-compatible iterable over its partition...
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
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 T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
auto max_element(R &&Range)
Provide wrappers to std::max_element which take ranges instead of having to pass begin/end explicitly...
constexpr unsigned BitWidth
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
gep_type_iterator gep_type_begin(const User *GEP)
bool to_integer(StringRef S, N &Num, unsigned Base=0)
Convert the string S to an integer of the specified type using the radix Base. If Base is 0,...
@ 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.
static constexpr Align Constant()
Allow constructions of constexpr Align.
Pointer type specification.
APInt NullPtrValue
The null pointer bit representation for this address space.
bool HasUnstableRepresentation
Pointers in this address space don't have a well-defined bitwise representation (e....
LLVM_ABI bool operator==(const PointerSpec &Other) const
std::string AddrSpaceName
bool HasExternalState
Pointers in this address space have additional state bits that are located at a target-defined locati...
uint32_t IndexBitWidth
The index bit width also defines the address size in this address space.
Primitive type specification.
LLVM_ABI bool operator==(const PrimitiveSpec &Other) const
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.