llvm::DataLayout

A parsed version of the target data layout string in and methods for querying it.

Synopsis

Declared in <llvm/IR/DataLayout.h>

class DataLayout;

Description

The target data layout string is specified by the target - a frontend generating LLVM IR is required to generate the right target data for the target being codegen'd to.

Types

NameDescription
PointerSpec Pointer type specification.
PrimitiveSpec Primitive type specification.

Enums

NameDescription
FunctionPtrAlignType How function-pointer alignment relates to function alignment.

Member Functions

NameDescription
DataLayout [constructor]Constructors
~DataLayout [destructor]Destroys this DataLayout and its cached structure layouts.
operator= Copy-assigns another DataLayout into this one.
doNotMangleLeadingQuestionMark Returns true if symbols with leading question marks should not receive IR mangling. True for Windows mangling modes.
fitsInLegalInteger Returns true if the specified type fits in a native integer type supported by the CPU.
getABIIntegerTypeAlignment Returns the minimum ABI-required alignment for an integer type of the specified bitwidth.
getABITypeAlign Returns the minimum ABI-required alignment for the specified type.
getAddressSize Returns the integral address size in bytes for address space AS.
getAddressSizeInBits getAddressSizeInBits overloads
getAddressSpaceName Returns the symbolic name of address space AS, if any.
getAddressType getAddressType overloads
getAllocaAddrSpace Returns the address space used for alloca.
getAllocaPtrType Returns a pointer type suitable for alloca in Ctx.
getBytePtrType getBytePtrType overloads
getDefaultGlobalsAddressSpace Returns the default address space used for global variables.
getFunctionPtrAlign Returns the alignment of function pointers, which may or may not be related to the alignment of functions.
getFunctionPtrAlignType Return the type of function pointer alignment.
getGEPIndexForOffset Get a single GEP index to access Offset inside ElemTy.
getGEPIndicesForOffset Get GEP indices to access Offset inside ElemTy.
getGlobalPrefix Returns the global symbol prefix character for this layout.
getIndexSize Returns the index size in bytes used for address calculation in AS.
getIndexSizeInBits The size in bits of indices used for address calculation in getelementptr and for addresses in the given AS. See getIndexSize() for more information.
getIndexType getIndexType overloads
getIndexTypeSizeInBits Returns the size in bits of the index used in GEP calculation for Ty.
getIndexedOffsetInType Returns the offset from the beginning of the type for the specified indices.
getIntPtrType getIntPtrType overloads
getInternalSymbolPrefix Returns the prefix used for internal (local) symbols.
getLargestLegalIntType Returns the largest legal integer type, or null if none are set.
getLargestLegalIntTypeSizeInBits Returns the size of largest legal integer type size, or 0 if none are set.
getLinkerPrivateGlobalPrefix Returns the linker-private global prefix, or empty if none.
getNamedAddressSpace Returns the address space number for the given symbolic name, if any.
getNonStandardAddressSpaces Return the address spaces with special pointer semantics (such as being unstable or non-integral).
getNullPtrValue Returns the null pointer bit pattern for the given address space.
getPointerABIAlignment Layout pointer alignment.
getPointerPrefAlignment Return target's alignment for stack-based pointers FIXME: The defaults need to be removed once all of the backends/clients are updated.
getPointerSize Returns the pointer representation size in bytes for address space AS.
getPointerSizeInBits Returns the pointer representation size in bits for address space AS.
getPointerTypeSize Returns the pointer representation size in bytes for Ty.
getPointerTypeSizeInBits Returns the pointer representation size in bits for Ty.
getPrefTypeAlign Returns the preferred stack/global alignment for the specified type.
getPreferredAlign Returns the preferred alignment of the specified global.
getProgramAddressSpace Returns the address space used for program code.
getSmallestLegalIntType Returns the smallest integer type with size at least as big as Width bits.
getStackAlignment Returns the natural stack alignment, or MaybeAlign() if one wasn't specified.
getStringRepresentation Returns the string representation of the DataLayout.
getStructLayout Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of its fields.
getTypeAllocSize Returns the offset in bytes between successive objects of the specified type, including alignment padding.
getTypeAllocSizeInBits Returns the offset in bits between successive objects of the specified type, including alignment padding; always a multiple of 8.
getTypeSizeInBits Returns the number of bits necessary to hold the specified type.
getTypeStoreSize Returns the maximum number of bytes that may be overwritten by storing the specified type.
getTypeStoreSizeInBits Returns the maximum number of bits that may be overwritten by storing the specified type; always a multiple of 8.
getValueOrABITypeAlignment Helper function to return Alignment if it's set or the result of getABITypeAlign(Ty), in any case the result is a valid alignment.
hasExternalState hasExternalState overloads
hasLinkerPrivateGlobalPrefix Returns true if this layout has a linker-private global prefix.
hasMicrosoftFastStdCallMangling Returns true if this layout uses Microsoft fastcall/stdcall mangling.
hasUnstableRepresentation hasUnstableRepresentation overloads
isBigEndian Returns true if this layout is big-endian.
isDefault Test if the DataLayout was constructed from an empty string.
isIllegalInteger Returns true if the specified integer width is not a legal native width.
isLegalInteger Returns true if the specified type is known to be a native integer type supported by the CPU.
isLittleEndian Layout endianness...
isNonIntegralAddressSpace Returns whether address space AddrSpace has a non-integral pointer.
isNonIntegralPointerType isNonIntegralPointerType overloads
mustNotIntroduceIntToPtr mustNotIntroduceIntToPtr overloads
mustNotIntroducePtrToInt mustNotIntroducePtrToInt overloads
typeSizeEqualsStoreSize Returns true if no extra padding bits are needed when storing the specified type.
vectorsAreElementAligned Whether vectors are element aligned, rather than naturally aligned.
operator== Returns true if this DataLayout is equal to Other.
operator!= Returns true if this DataLayout is not equal to Other.

Static Member Functions

NameDescription
parse Parse a data layout string and return the layout. Return an error description on failure.

Non-Member Functions

NameDescription
ComputeValueTypesGiven an LLVM IR type, compute non-aggregate subtypes. Optionally also compute their offsets.
computeValueLLTsCompute a sequence of LLTs for the non-aggregate parts of an LLVM IR type.
computeValueLLTsCompute a sequence of LLTs for the non-aggregate parts of an LLVM IR type.
copyRangeMetadataCopy range metadata onto a replacement load.
decomposeLinearExpressionDecompose a pointer into a linear expression. This may look through multiple GEPs.
unwrapConvert an opaque LLVMTargetDataRef to a DataLayout pointer.
wrapConvert a DataLayout pointer to an opaque LLVMTargetDataRef.
PatternMatch::m_PtrToIntSameSizeMatches ptrtoint when the integer and pointer have the same size.
at::calculateFragmentIntersectCalculate the fragment of the variable in DVRAssign covered from (Dest + SliceOffsetInBits) to to (Dest + SliceOffsetInBits + SliceSizeInBits)
at::getAssignmentInfoReturn assignment info for a memory intrinsic, if it has static shape.
at::getAssignmentInfoReturn assignment info for a store, if it has static shape.
at::getAssignmentInfoReturn assignment info for an alloca used as a whole-object store.