class DataLayout

Declaration

class DataLayout { /* full declaration omitted */ };

Declared at: llvm/include/llvm/IR/DataLayout.h:111

Method Overview

Methods

DataLayout(const llvm::Module* M)

Description

Initialize target data from properties stored in the module.

Declared at: llvm/include/llvm/IR/DataLayout.h:200

Parameters

const llvm::Module* M

DataLayout(const llvm::DataLayout& DL)

Declared at: llvm/include/llvm/IR/DataLayout.h:202

Parameters

const llvm::DataLayout& DL

DataLayout(llvm::StringRef LayoutDescription)

Description

Constructs a DataLayout from a specification string. See reset().

Declared at: llvm/include/llvm/IR/DataLayout.h:195

Parameters

llvm::StringRef LayoutDescription

bool doNotMangleLeadingQuestionMark() const

Description

Returns true if symbols with leading question marks should not receive IR mangling. True for Windows mangling modes.

Declared at: llvm/include/llvm/IR/DataLayout.h:294

bool exceedsNaturalStackAlignment(
    llvm::Align Alignment) const

Description

Returns true if the given alignment exceeds the natural stack alignment.

Declared at: llvm/include/llvm/IR/DataLayout.h:264

Parameters

llvm::Align Alignment

bool fitsInLegalInteger(unsigned int Width) const

Description

Returns true if the specified type fits in a native integer type supported by the CPU. For example, if the CPU only supports i32 as a native integer type, then i27 fits in a legal integer type but i45 does not.

Declared at: llvm/include/llvm/IR/DataLayout.h:343

Parameters

unsigned int Width

llvm::Align getABIIntegerTypeAlignment(
    unsigned int BitWidth) const

Description

Returns the minimum ABI-required alignment for an integer type of the specified bitwidth.

Declared at: llvm/include/llvm/IR/DataLayout.h:515

Parameters

unsigned int BitWidth

unsigned int getABITypeAlignment(
    llvm::Type* Ty) const

Description

Returns the minimum ABI-required alignment for the specified type.

Declared at: llvm/include/llvm/IR/DataLayout.h:504

Parameters

llvm::Type* Ty

unsigned int getAllocaAddrSpace() const

Declared at: llvm/include/llvm/IR/DataLayout.h:273

llvm::MaybeAlign getFunctionPtrAlign() const

Description

Returns the alignment of function pointers, which may or may not be related to the alignment of functions.

Declared at: llvm/include/llvm/IR/DataLayout.h:278

llvm::DataLayout::FunctionPtrAlignType
getFunctionPtrAlignType() const

Description

Return the type of function pointer alignment.

Declared at: llvm/include/llvm/IR/DataLayout.h:282

char getGlobalPrefix() const

Declared at: llvm/include/llvm/IR/DataLayout.h:306

unsigned int getIndexSize(unsigned int AS) const

Declared at: llvm/include/llvm/IR/DataLayout.h:367

Parameters

unsigned int AS

unsigned int getIndexSizeInBits(
    unsigned int AS) const

Description

Size in bits of index used for address calculation in getelementptr.

Declared at: llvm/include/llvm/IR/DataLayout.h:402

Parameters

unsigned int AS

llvm::Type* getIndexType(llvm::Type* PtrTy) const

Description

Returns the type of a GEP index. If it was not specified explicitly, it will be the integer type of the pointer width - IntPtrType.

Declared at: llvm/include/llvm/IR/DataLayout.h:548

Parameters

llvm::Type* PtrTy

unsigned int getIndexTypeSizeInBits(
    llvm::Type* Ty) const

Description

Layout size of the index used in GEP calculation. The function should be called with pointer or vector of pointers type.

Declared at: llvm/include/llvm/IR/DataLayout.h:415

Parameters

llvm::Type* Ty

int64_t getIndexedOffsetInType(
    llvm::Type* ElemTy,
    ArrayRef<llvm::Value*> Indices) const

Description

Returns the offset from the beginning of the type for the specified indices. Note that this takes the element type, not the pointer type. This is used to implement getelementptr.

Declared at: llvm/include/llvm/IR/DataLayout.h:555

Parameters

llvm::Type* ElemTy
ArrayRef<llvm::Value*> Indices

llvm::Type* getIntPtrType(llvm::Type*) const

Description

Returns an integer (vector of integer) type with size at least as big as that of a pointer of the given pointer (vector of pointer) type.

Declared at: llvm/include/llvm/IR/DataLayout.h:529

Parameters

llvm::Type*

llvm::IntegerType* getIntPtrType(
    llvm::LLVMContext& C,
    unsigned int AddressSpace = 0) const

Description

Returns an integer type with size at least as big as that of a pointer in the given address space.

Declared at: llvm/include/llvm/IR/DataLayout.h:525

Parameters

llvm::LLVMContext& C
unsigned int AddressSpace = 0

llvm::Type* getLargestLegalIntType(
    llvm::LLVMContext& C) const

Description

Returns the largest legal integer type, or null if none are set.

Declared at: llvm/include/llvm/IR/DataLayout.h:536

Parameters

llvm::LLVMContext& C

unsigned int getLargestLegalIntTypeSizeInBits()
    const

Description

Returns the size of largest legal integer type size, or 0 if none are set.

Declared at: llvm/include/llvm/IR/DataLayout.h:543

llvm::StringRef getLinkerPrivateGlobalPrefix()
    const

Declared at: llvm/include/llvm/IR/DataLayout.h:300

static const char* getManglingComponent(
    const llvm::Triple& T)

Declared at: llvm/include/llvm/IR/DataLayout.h:336

Parameters

const llvm::Triple& T

unsigned int getMaxPointerSize() const

Description

Returns the maximum pointer size over all address spaces.

Declared at: llvm/include/llvm/IR/DataLayout.h:364

unsigned int getMaxPointerSizeInBits() const

Description

Returns the maximum pointer size over all address spaces.

Declared at: llvm/include/llvm/IR/DataLayout.h:397

ArrayRef<unsigned int>
getNonIntegralAddressSpaces() const

Declared at: llvm/include/llvm/IR/DataLayout.h:371

llvm::Align getPointerABIAlignment(
    unsigned int AS) const

Description

Layout pointer alignment

Declared at: llvm/include/llvm/IR/DataLayout.h:351

Parameters

unsigned int AS

llvm::Align getPointerPrefAlignment(
    unsigned int AS = 0) const

Description

Return target's alignment for stack-based pointers FIXME: The defaults need to be removed once all of the backends/clients are updated.

Declared at: llvm/include/llvm/IR/DataLayout.h:356

Parameters

unsigned int AS = 0

unsigned int getPointerSize(
    unsigned int AS = 0) const

Description

Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updated.

Declared at: llvm/include/llvm/IR/DataLayout.h:361

Parameters

unsigned int AS = 0

unsigned int getPointerSizeInBits(
    unsigned int AS = 0) const

Description

Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients are updated.

Declared at: llvm/include/llvm/IR/DataLayout.h:392

Parameters

unsigned int AS = 0

unsigned int getPointerTypeSize(
    llvm::Type* Ty) const

Declared at: llvm/include/llvm/IR/DataLayout.h:417

Parameters

llvm::Type* Ty

unsigned int getPointerTypeSizeInBits(
    llvm::Type*) const

Description

Layout pointer size, in bits, based on the type. If this function is called with a pointer type, then the type size of the pointer is returned. If this function is called with a vector of pointers, then the type size of the pointer is returned. This should only be called with a pointer or vector of pointers.

Declared at: llvm/include/llvm/IR/DataLayout.h:411

Parameters

llvm::Type*

unsigned int getPrefTypeAlignment(
    llvm::Type* Ty) const

Description

Returns the preferred stack/global alignment for the specified type. This is always at least as good as the ABI alignment.

Declared at: llvm/include/llvm/IR/DataLayout.h:521

Parameters

llvm::Type* Ty

unsigned int getPreferredAlignment(
    const llvm::GlobalVariable* GV) const

Description

Returns the preferred alignment of the specified global. This includes an explicitly requested alignment (if the global has one).

Declared at: llvm/include/llvm/IR/DataLayout.h:566

Parameters

const llvm::GlobalVariable* GV

unsigned int getPreferredAlignmentLog(
    const llvm::GlobalVariable* GV) const

Description

Returns the preferred alignment of the specified global, returned in log form. This includes an explicitly requested alignment (if the global has one).

Declared at: llvm/include/llvm/IR/DataLayout.h:572

Parameters

const llvm::GlobalVariable* GV

llvm::StringRef getPrivateGlobalPrefix() const

Declared at: llvm/include/llvm/IR/DataLayout.h:320

unsigned int getProgramAddressSpace() const

Declared at: llvm/include/llvm/IR/DataLayout.h:286

llvm::Type* getSmallestLegalIntType(
    llvm::LLVMContext& C,
    unsigned int Width = 0) const

Description

Returns the smallest integer type with size at least as big as Width bits.

Declared at: llvm/include/llvm/IR/DataLayout.h:533

Parameters

llvm::LLVMContext& C
unsigned int Width = 0

llvm::Align getStackAlignment() const

Declared at: llvm/include/llvm/IR/DataLayout.h:268

const std::string& getStringRepresentation() const

Description

Returns the string representation of the DataLayout. This representation is in the same format accepted by the string constructor above. This should not be used to compare two DataLayout as different string can represent the same layout.

Declared at: llvm/include/llvm/IR/DataLayout.h:240

const llvm::StructLayout* getStructLayout(
    llvm::StructType* Ty) const

Description

Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of its fields. Note that this information is lazily cached.

Declared at: llvm/include/llvm/IR/DataLayout.h:561

Parameters

llvm::StructType* Ty

llvm::TypeSize getTypeAllocSize(
    llvm::Type* Ty) const

Description

Returns the offset in bytes between successive objects of the specified type, including alignment padding. If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size. This is the amount that alloca reserves for this type. For example, returns 12 or 16 for x86_fp80, depending on alignment.

Declared at: llvm/include/llvm/IR/DataLayout.h:486

Parameters

llvm::Type* Ty

llvm::TypeSize getTypeAllocSizeInBits(
    llvm::Type* Ty) const

Description

Returns the offset in bits between successive objects of the specified type, including alignment padding; always a multiple of 8. If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size. This is the amount that alloca reserves for this type. For example, returns 96 or 128 for x86_fp80, depending on alignment.

Declared at: llvm/include/llvm/IR/DataLayout.h:499

Parameters

llvm::Type* Ty

llvm::TypeSize getTypeSizeInBits(
    llvm::Type* Ty) const

Description

Returns the number of bits necessary to hold the specified type. If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size. For example, returns 36 for i36 and 80 for x86_fp80. The type passed must have a size (Type::isSized() must return true).

Declared at: llvm/include/llvm/IR/DataLayout.h:445

Parameters

llvm::Type* Ty

llvm::TypeSize getTypeStoreSize(
    llvm::Type* Ty) const

Description

Returns the maximum number of bytes that may be overwritten by storing the specified type. If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size. For example, returns 5 for i36 and 10 for x86_fp80.

Declared at: llvm/include/llvm/IR/DataLayout.h:454

Parameters

llvm::Type* Ty

llvm::TypeSize getTypeStoreSizeInBits(
    llvm::Type* Ty) const

Description

Returns the maximum number of bits that may be overwritten by storing the specified type; always a multiple of 8. If Ty is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size. For example, returns 40 for i36 and 80 for x86_fp80.

Declared at: llvm/include/llvm/IR/DataLayout.h:466

Parameters

llvm::Type* Ty

inline llvm::Align getValueOrABITypeAlignment(
    llvm::MaybeAlign Alignment,
    llvm::Type* Ty) const

Description

Helper function to return `Alignment` if it's set or the result of `getABITypeAlignment(Ty)`, in any case the result is a valid alignment.

Declared at: llvm/include/llvm/IR/DataLayout.h:508

Parameters

llvm::MaybeAlign Alignment
llvm::Type* Ty

bool hasLinkerPrivateGlobalPrefix() const

Declared at: llvm/include/llvm/IR/DataLayout.h:298

bool hasMicrosoftFastStdCallMangling() const

Declared at: llvm/include/llvm/IR/DataLayout.h:288

void init(const llvm::Module* M)

Declared at: llvm/include/llvm/IR/DataLayout.h:226

Parameters

const llvm::Module* M

bool isBigEndian() const

Declared at: llvm/include/llvm/IR/DataLayout.h:233

bool isDefault() const

Description

Test if the DataLayout was constructed from an empty string.

Declared at: llvm/include/llvm/IR/DataLayout.h:245

bool isIllegalInteger(uint64_t Width) const

Declared at: llvm/include/llvm/IR/DataLayout.h:261

Parameters

uint64_t Width

bool isLegalInteger(uint64_t Width) const

Description

Returns true if the specified type is known to be a native integer type supported by the CPU. For example, i64 is not native on most 32-bit CPUs and i37 is not native on any known one. This returns false if the integer width is not legal. The width is specified in bits.

Declared at: llvm/include/llvm/IR/DataLayout.h:254

Parameters

uint64_t Width

bool isLittleEndian() const

Description

Layout endianness...

Declared at: llvm/include/llvm/IR/DataLayout.h:232

bool isNonIntegralAddressSpace(
    unsigned int AddrSpace) const

Declared at: llvm/include/llvm/IR/DataLayout.h:375

Parameters

unsigned int AddrSpace

bool isNonIntegralPointerType(
    llvm::Type* Ty) const

Declared at: llvm/include/llvm/IR/DataLayout.h:384

Parameters

llvm::Type* Ty

bool isNonIntegralPointerType(
    llvm::PointerType* PT) const

Declared at: llvm/include/llvm/IR/DataLayout.h:380

Parameters

llvm::PointerType* PT

void reset(llvm::StringRef LayoutDescription)

Description

Parse a data layout string (with fallback to default values).

Declared at: llvm/include/llvm/IR/DataLayout.h:229

Parameters

llvm::StringRef LayoutDescription

bool typeSizeEqualsStoreSize(llvm::Type* Ty) const

Description

Returns true if no extra padding bits are needed when storing the specified type. For example, returns false for i19 that has a 24-bit store size.

Declared at: llvm/include/llvm/IR/DataLayout.h:474

Parameters

llvm::Type* Ty

~DataLayout()

Declared at: llvm/include/llvm/IR/DataLayout.h:204