LLVM  13.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::DataLayout Class Reference

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

#include "llvm/IR/DataLayout.h"

Public Types

enum  FunctionPtrAlignType { FunctionPtrAlignType::Independent, FunctionPtrAlignType::MultipleOfFunctionAlign }
 

Public Member Functions

 DataLayout (StringRef LayoutDescription)
 Constructs a DataLayout from a specification string. See reset(). More...
 
 DataLayout (const Module *M)
 Initialize target data from properties stored in the module. More...
 
 DataLayout (const DataLayout &DL)
 
 ~DataLayout ()
 
DataLayoutoperator= (const DataLayout &DL)
 
bool operator== (const DataLayout &Other) const
 
bool operator!= (const DataLayout &Other) const
 
void init (const Module *M)
 
void reset (StringRef LayoutDescription)
 Parse a data layout string (with fallback to default values). More...
 
bool isLittleEndian () const
 Layout endianness... More...
 
bool isBigEndian () const
 
const std::string & getStringRepresentation () const
 Returns the string representation of the DataLayout. More...
 
bool isDefault () const
 Test if the DataLayout was constructed from an empty string. More...
 
bool isLegalInteger (uint64_t Width) const
 Returns true if the specified type is known to be a native integer type supported by the CPU. More...
 
bool isIllegalInteger (uint64_t Width) const
 
bool exceedsNaturalStackAlignment (Align Alignment) const
 Returns true if the given alignment exceeds the natural stack alignment. More...
 
Align getStackAlignment () const
 
unsigned getAllocaAddrSpace () const
 
MaybeAlign getFunctionPtrAlign () const
 Returns the alignment of function pointers, which may or may not be related to the alignment of functions. More...
 
FunctionPtrAlignType getFunctionPtrAlignType () const
 Return the type of function pointer alignment. More...
 
unsigned getProgramAddressSpace () const
 
unsigned getDefaultGlobalsAddressSpace () const
 
bool hasMicrosoftFastStdCallMangling () const
 
bool doNotMangleLeadingQuestionMark () const
 Returns true if symbols with leading question marks should not receive IR mangling. More...
 
bool hasLinkerPrivateGlobalPrefix () const
 
StringRef getLinkerPrivateGlobalPrefix () const
 
char getGlobalPrefix () const
 
StringRef getPrivateGlobalPrefix () const
 
bool fitsInLegalInteger (unsigned Width) const
 Returns true if the specified type fits in a native integer type supported by the CPU. More...
 
Align getPointerABIAlignment (unsigned AS) const
 Layout pointer alignment. More...
 
Align getPointerPrefAlignment (unsigned AS=0) const
 Return target's alignment for stack-based pointers FIXME: The defaults need to be removed once all of the backends/clients are updated. More...
 
unsigned getPointerSize (unsigned AS=0) const
 Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updated. More...
 
unsigned getMaxPointerSize () const
 Returns the maximum pointer size over all address spaces. More...
 
unsigned getIndexSize (unsigned AS) const
 
ArrayRef< unsigned > getNonIntegralAddressSpaces () const
 Return the address spaces containing non-integral pointers. More...
 
bool isNonIntegralAddressSpace (unsigned AddrSpace) const
 
bool isNonIntegralPointerType (PointerType *PT) const
 
bool isNonIntegralPointerType (Type *Ty) const
 
unsigned getPointerSizeInBits (unsigned AS=0) const
 Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients are updated. More...
 
unsigned getMaxPointerSizeInBits () const
 Returns the maximum pointer size over all address spaces. More...
 
unsigned getIndexSizeInBits (unsigned AS) const
 Size in bits of index used for address calculation in getelementptr. More...
 
unsigned getPointerTypeSizeInBits (Type *) const
 Layout pointer size, in bits, based on the type. More...
 
unsigned getIndexTypeSizeInBits (Type *Ty) const
 Layout size of the index used in GEP calculation. More...
 
unsigned getPointerTypeSize (Type *Ty) const
 
TypeSize getTypeSizeInBits (Type *Ty) const
 Size examples: More...
 
TypeSize getTypeStoreSize (Type *Ty) const
 Returns the maximum number of bytes that may be overwritten by storing the specified type. More...
 
TypeSize getTypeStoreSizeInBits (Type *Ty) const
 Returns the maximum number of bits that may be overwritten by storing the specified type; always a multiple of 8. More...
 
bool typeSizeEqualsStoreSize (Type *Ty) const
 Returns true if no extra padding bits are needed when storing the specified type. More...
 
TypeSize getTypeAllocSize (Type *Ty) const
 Returns the offset in bytes between successive objects of the specified type, including alignment padding. More...
 
TypeSize getTypeAllocSizeInBits (Type *Ty) const
 Returns the offset in bits between successive objects of the specified type, including alignment padding; always a multiple of 8. More...
 
unsigned getABITypeAlignment (Type *Ty) const
 Returns the minimum ABI-required alignment for the specified type. More...
 
Align getABITypeAlign (Type *Ty) const
 Returns the minimum ABI-required alignment for the specified type. More...
 
Align getValueOrABITypeAlignment (MaybeAlign Alignment, Type *Ty) const
 Helper function to return Alignment if it's set or the result of getABITypeAlignment(Ty), in any case the result is a valid alignment. More...
 
Align getABIIntegerTypeAlignment (unsigned BitWidth) const
 Returns the minimum ABI-required alignment for an integer type of the specified bitwidth. More...
 
unsigned getPrefTypeAlignment (Type *Ty) const
 Returns the preferred stack/global alignment for the specified type. More...
 
Align getPrefTypeAlign (Type *Ty) const
 Returns the preferred stack/global alignment for the specified type. More...
 
IntegerTypegetIntPtrType (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. More...
 
TypegetIntPtrType (Type *) const
 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. More...
 
TypegetSmallestLegalIntType (LLVMContext &C, unsigned Width=0) const
 Returns the smallest integer type with size at least as big as Width bits. More...
 
TypegetLargestLegalIntType (LLVMContext &C) const
 Returns the largest legal integer type, or null if none are set. More...
 
unsigned getLargestLegalIntTypeSizeInBits () const
 Returns the size of largest legal integer type size, or 0 if none are set. More...
 
TypegetIndexType (Type *PtrTy) const
 Returns the type of a GEP index. More...
 
int64_t getIndexedOffsetInType (Type *ElemTy, ArrayRef< Value * > Indices) const
 Returns the offset from the beginning of the type for the specified indices. More...
 
const StructLayoutgetStructLayout (StructType *Ty) const
 Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of its fields. More...
 
Align getPreferredAlign (const GlobalVariable *GV) const
 Returns the preferred alignment of the specified global. More...
 
 LLVM_ATTRIBUTE_DEPRECATED (inline unsigned getPreferredAlignment(const GlobalVariable *GV) const, "Use getPreferredAlign instead")
 Returns the preferred alignment of the specified global. More...
 
 LLVM_ATTRIBUTE_DEPRECATED (inline unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const, "Inline where needed")
 Returns the preferred alignment of the specified global, returned in log form. More...
 

Static Public Member Functions

static Expected< DataLayoutparse (StringRef LayoutDescription)
 Parse a data layout string and return the layout. More...
 
static const char * getManglingComponent (const Triple &T)
 

Detailed Description

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

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.

Definition at line 112 of file DataLayout.h.

Member Enumeration Documentation

◆ FunctionPtrAlignType

Enumerator
Independent 

The function pointer alignment is independent of the function alignment.

MultipleOfFunctionAlign 

The function pointer alignment is a multiple of the function alignment.

Definition at line 114 of file DataLayout.h.

Constructor & Destructor Documentation

◆ DataLayout() [1/3]

llvm::DataLayout::DataLayout ( StringRef  LayoutDescription)
inlineexplicit

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

Definition at line 199 of file DataLayout.h.

References reset().

◆ DataLayout() [2/3]

DataLayout::DataLayout ( const Module M)
explicit

Initialize target data from properties stored in the module.

Definition at line 529 of file DataLayout.cpp.

References init(), and M.

◆ DataLayout() [3/3]

llvm::DataLayout::DataLayout ( const DataLayout DL)
inline

Definition at line 206 of file DataLayout.h.

References DL.

◆ ~DataLayout()

DataLayout::~DataLayout ( )

Definition at line 667 of file DataLayout.cpp.

Member Function Documentation

◆ doNotMangleLeadingQuestionMark()

bool llvm::DataLayout::doNotMangleLeadingQuestionMark ( ) const
inline

Returns true if symbols with leading question marks should not receive IR mangling.

True for Windows mangling modes.

Definition at line 303 of file DataLayout.h.

◆ exceedsNaturalStackAlignment()

bool llvm::DataLayout::exceedsNaturalStackAlignment ( Align  Alignment) const
inline

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

Definition at line 270 of file DataLayout.h.

◆ fitsInLegalInteger()

bool llvm::DataLayout::fitsInLegalInteger ( unsigned  Width) const
inline

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.

Definition at line 355 of file DataLayout.h.

◆ getABIIntegerTypeAlignment()

Align llvm::DataLayout::getABIIntegerTypeAlignment ( unsigned  BitWidth) const
inline

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

Definition at line 531 of file DataLayout.h.

References llvm::BitWidth.

Referenced by llvm::MachineJumpTableInfo::getEntryAlignment().

◆ getABITypeAlign()

Align DataLayout::getABITypeAlign ( Type Ty) const

◆ getABITypeAlignment()

unsigned DataLayout::getABITypeAlignment ( Type Ty) const

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

TODO: Remove this function once the transition to Align is over.

FIXME: Deprecate this function once migration to Align is over.

Definition at line 821 of file DataLayout.cpp.

References getABITypeAlign(), and llvm::Align::value().

Referenced by getTypeAllocSize().

◆ getAllocaAddrSpace()

unsigned llvm::DataLayout::getAllocaAddrSpace ( ) const
inline

◆ getDefaultGlobalsAddressSpace()

unsigned llvm::DataLayout::getDefaultGlobalsAddressSpace ( ) const
inline

Definition at line 293 of file DataLayout.h.

◆ getFunctionPtrAlign()

MaybeAlign llvm::DataLayout::getFunctionPtrAlign ( ) const
inline

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

See also
getFunctionPtrAlignType

Definition at line 284 of file DataLayout.h.

◆ getFunctionPtrAlignType()

FunctionPtrAlignType llvm::DataLayout::getFunctionPtrAlignType ( ) const
inline

Return the type of function pointer alignment.

See also
getFunctionPtrAlign

Definition at line 288 of file DataLayout.h.

◆ getGlobalPrefix()

char llvm::DataLayout::getGlobalPrefix ( ) const
inline

Definition at line 315 of file DataLayout.h.

References llvm_unreachable.

Referenced by llvm::emitLinkerFlagsForGlobalCOFF().

◆ getIndexedOffsetInType()

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

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.

Definition at line 875 of file DataLayout.cpp.

References assert(), llvm::gep_type_begin(), llvm::gep_type_end(), llvm::StructLayout::getElementOffset(), llvm::generic_gep_type_iterator< ItTy >::getIndexedType(), llvm::generic_gep_type_iterator< ItTy >::getOperand(), getStructLayout(), llvm::generic_gep_type_iterator< ItTy >::getStructTypeOrNull(), llvm::Value::getType(), getTypeAllocSize(), and llvm::Type::isIntegerTy().

◆ getIndexSize()

unsigned DataLayout::getIndexSize ( unsigned  AS) const

Definition at line 720 of file DataLayout.cpp.

References llvm::PointerAlignElem::IndexWidth.

Referenced by getIndexSizeInBits().

◆ getIndexSizeInBits()

unsigned llvm::DataLayout::getIndexSizeInBits ( unsigned  AS) const
inline

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

Definition at line 414 of file DataLayout.h.

References getIndexSize().

Referenced by llvm::GISelKnownBits::computeKnownBitsImpl(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getEstimatedNumberOfCaseClusters(), getIndexTypeSizeInBits(), and SimplifyGEPInst().

◆ getIndexType()

Type * DataLayout::getIndexType ( Type PtrTy) const

Returns the type of a GEP index.

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

Definition at line 865 of file DataLayout.cpp.

References assert(), llvm::IntegerType::get(), llvm::VectorType::get(), llvm::Type::getContext(), getIndexTypeSizeInBits(), and llvm::Type::isPtrOrPtrVectorTy().

Referenced by llvm::ObjectSizeOffsetEvaluator::compute(), llvm::ScalarEvolution::getEffectiveSCEVType(), and llvm::PtrUseVisitor< SliceBuilder >::visitPtr().

◆ getIndexTypeSizeInBits()

unsigned DataLayout::getIndexTypeSizeInBits ( Type Ty) const

Layout size of the index used in GEP calculation.

The function should be called with pointer or vector of pointers type.

Definition at line 724 of file DataLayout.cpp.

References assert(), getIndexSizeInBits(), llvm::Type::getScalarType(), and llvm::Type::isPtrOrPtrVectorTy().

Referenced by llvm::ObjectSizeOffsetVisitor::compute(), getIndexType(), llvm::ScalarEvolution::getTypeSizeInBits(), and llvm::ObjectSizeOffsetVisitor::visitGEPOperator().

◆ getIntPtrType() [1/2]

IntegerType * DataLayout::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.

Definition at line 838 of file DataLayout.cpp.

References llvm::IntegerType::get(), and getPointerSizeInBits().

Referenced by llvm::X86SelectionDAGInfo::EmitTargetCodeForMemset(), llvm::ScalarEvolution::getPtrToIntExpr(), llvm::IntrinsicLowering::LowerIntrinsicCall(), simplifyAllocaArraySize(), and SimplifyCastInst().

◆ getIntPtrType() [2/2]

Type * DataLayout::getIntPtrType ( Type Ty) const

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.

Definition at line 843 of file DataLayout.cpp.

References assert(), llvm::IntegerType::get(), llvm::VectorType::get(), llvm::Type::getContext(), getPointerTypeSizeInBits(), and llvm::Type::isPtrOrPtrVectorTy().

◆ getLargestLegalIntType()

Type* llvm::DataLayout::getLargestLegalIntType ( LLVMContext C) const
inline

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

Definition at line 561 of file DataLayout.h.

References llvm::Type::getIntNTy(), and getLargestLegalIntTypeSizeInBits().

◆ getLargestLegalIntTypeSizeInBits()

unsigned DataLayout::getLargestLegalIntTypeSizeInBits ( ) const

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

Definition at line 860 of file DataLayout.cpp.

Referenced by getLargestLegalIntType().

◆ getLinkerPrivateGlobalPrefix()

StringRef llvm::DataLayout::getLinkerPrivateGlobalPrefix ( ) const
inline

Definition at line 309 of file DataLayout.h.

◆ getManglingComponent()

const char * DataLayout::getManglingComponent ( const Triple T)
static

Definition at line 153 of file DataLayout.cpp.

References T, and llvm::Triple::x86.

Referenced by computeDataLayout(), and getDataLayoutString().

◆ getMaxPointerSize()

unsigned DataLayout::getMaxPointerSize ( ) const

Returns the maximum pointer size over all address spaces.

Definition at line 705 of file DataLayout.cpp.

References llvm::max(), and P.

Referenced by getMaxPointerSizeInBits().

◆ getMaxPointerSizeInBits()

unsigned llvm::DataLayout::getMaxPointerSizeInBits ( ) const
inline

Returns the maximum pointer size over all address spaces.

Definition at line 409 of file DataLayout.h.

References getMaxPointerSize().

◆ getNonIntegralAddressSpaces()

ArrayRef<unsigned> llvm::DataLayout::getNonIntegralAddressSpaces ( ) const
inline

Return the address spaces containing non-integral pointers.

Pointers in this address space don't have a well-defined bitwise representation.

Definition at line 383 of file DataLayout.h.

Referenced by isNonIntegralAddressSpace().

◆ getPointerABIAlignment()

Align DataLayout::getPointerABIAlignment ( unsigned  AS) const

Layout pointer alignment.

Definition at line 693 of file DataLayout.cpp.

References llvm::PointerAlignElem::ABIAlign.

Referenced by llvm::MachineJumpTableInfo::getEntryAlignment().

◆ getPointerPrefAlignment()

Align DataLayout::getPointerPrefAlignment ( unsigned  AS = 0) const

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

Definition at line 697 of file DataLayout.cpp.

References llvm::PointerAlignElem::PrefAlign.

◆ getPointerSize()

unsigned DataLayout::getPointerSize ( unsigned  AS = 0) const

◆ getPointerSizeInBits()

unsigned llvm::DataLayout::getPointerSizeInBits ( unsigned  AS = 0) const
inline

◆ getPointerTypeSize()

unsigned llvm::DataLayout::getPointerTypeSize ( Type Ty) const
inline

Definition at line 429 of file DataLayout.h.

References getPointerTypeSizeInBits().

◆ getPointerTypeSizeInBits()

unsigned DataLayout::getPointerTypeSizeInBits ( Type Ty) const

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.

Definition at line 713 of file DataLayout.cpp.

References assert(), getPointerSizeInBits(), llvm::Type::getScalarType(), and llvm::Type::isPtrOrPtrVectorTy().

Referenced by llvm::SelectionDAG::getGlobalAddress(), getIntPtrType(), getPointerTypeSize(), and llvm::SelectionDAG::InferPtrAlign().

◆ getPreferredAlign()

Align DataLayout::getPreferredAlign ( const GlobalVariable GV) const

Returns the preferred alignment of the specified global.

getPreferredAlign - Return the preferred alignment of the specified global.

This includes an explicitly requested alignment (if the global has one).

Definition at line 905 of file DataLayout.cpp.

References Align, getABITypeAlign(), llvm::GlobalObject::getAlign(), getPrefTypeAlign(), getTypeSizeInBits(), llvm::GlobalValue::getValueType(), llvm::GlobalVariable::hasInitializer(), llvm::GlobalObject::hasSection(), and llvm::max().

Referenced by getAlign(), getELFSectionNameForGlobal(), LLVM_ATTRIBUTE_DEPRECATED(), promoteToConstantPool(), llvm::TargetLoweringObjectFileMachO::SelectSectionForGlobal(), and llvm::TargetLoweringObjectFileXCOFF::SelectSectionForGlobal().

◆ getPrefTypeAlign()

Align DataLayout::getPrefTypeAlign ( Type Ty) const

Returns the preferred stack/global alignment for the specified type.

This is always at least as good as the ABI alignment.

Definition at line 834 of file DataLayout.cpp.

Referenced by llvm::PPCInstrInfo::finalizeInsInstrs(), llvm::SelectionDAG::getConstantPool(), getPreferredAlign(), getPrefTypeAlignment(), ReplaceLoadVector(), llvm::FunctionLoweringInfo::set(), and llvm::SelectionDAGBuilder::visitSPDescriptorParent().

◆ getPrefTypeAlignment()

unsigned DataLayout::getPrefTypeAlignment ( Type Ty) const

Returns the preferred stack/global alignment for the specified type.

TODO: Remove this function once the transition to Align is over.

This is always at least as good as the ABI alignment. FIXME: Deprecate this function once migration to Align is over.

Definition at line 830 of file DataLayout.cpp.

References getPrefTypeAlign(), and llvm::Align::value().

◆ getPrivateGlobalPrefix()

StringRef llvm::DataLayout::getPrivateGlobalPrefix ( ) const
inline

◆ getProgramAddressSpace()

unsigned llvm::DataLayout::getProgramAddressSpace ( ) const
inline

◆ getSmallestLegalIntType()

Type * DataLayout::getSmallestLegalIntType ( LLVMContext C,
unsigned  Width = 0 
) const

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

Definition at line 853 of file DataLayout.cpp.

References llvm::Type::getIntNTy().

◆ getStackAlignment()

Align llvm::DataLayout::getStackAlignment ( ) const
inline

Definition at line 274 of file DataLayout.h.

References assert().

Referenced by CC_AArch64_Custom_Block().

◆ getStringRepresentation()

const std::string& llvm::DataLayout::getStringRepresentation ( ) const
inline

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.

Definition at line 249 of file DataLayout.h.

Referenced by llvm::orc::LLJIT::applyDataLayout(), and llvm::orc::LLJITBuilderState::prepareForConstruction().

◆ getStructLayout()

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

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.

Definition at line 671 of file DataLayout.cpp.

References llvm::StructType::getNumElements(), and llvm::safe_malloc().

Referenced by getIndexedOffsetInType(), getTypeSizeInBits(), and llvm::ExecutionEngine::InitializeMemory().

◆ getTypeAllocSize()

TypeSize llvm::DataLayout::getTypeAllocSize ( Type Ty) const
inline

◆ getTypeAllocSizeInBits()

TypeSize llvm::DataLayout::getTypeAllocSizeInBits ( Type Ty) const
inline

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.

Definition at line 511 of file DataLayout.h.

References getTypeAllocSize().

Referenced by getTypeSizeInBits(), and llvm::PatternMatch::VScaleVal_match::match().

◆ getTypeSizeInBits()

TypeSize llvm::DataLayout::getTypeSizeInBits ( Type Ty) const
inline

Size examples:

Type SizeInBits StoreSizeInBits AllocSizeInBits[*]


i1 1 8 8 i8 8 8 8 i19 19 24 32 i32 32 32 32 i100 100 104 128 i128 128 128 128 Float 32 32 32 Double 64 64 64 X86_FP80 80 80 96

[*] The alloc size depends on the alignment, and thus on the target. These values are for x86-32 linux. 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).

Definition at line 674 of file DataLayout.h.

References llvm::Type::ArrayTyID, assert(), llvm::Type::BFloatTyID, llvm::Type::DoubleTyID, llvm::TypeSize::Fixed(), llvm::Type::FixedVectorTyID, llvm::Type::FloatTyID, llvm::Type::FP128TyID, llvm::VectorType::getElementCount(), llvm::ArrayType::getElementType(), llvm::VectorType::getElementType(), llvm::TypeSize::getFixedSize(), llvm::Type::getIntegerBitWidth(), llvm::LinearPolySize< LeafTy >::getKnownMinValue(), llvm::ArrayType::getNumElements(), llvm::Type::getPointerAddressSpace(), getPointerSizeInBits(), getStructLayout(), getTypeAllocSizeInBits(), llvm::Type::getTypeID(), llvm::Type::HalfTyID, llvm::Type::IntegerTyID, llvm::Type::isSized(), llvm::Type::LabelTyID, llvm_unreachable, llvm::Type::PointerTyID, llvm::Type::PPC_FP128TyID, llvm::Type::ScalableVectorTyID, llvm::Type::StructTyID, llvm::Type::X86_AMXTyID, llvm::Type::X86_FP80TyID, and llvm::Type::X86_MMXTyID.

Referenced by llvm::FastISel::canFoldAddIntoGEP(), llvm::ExecutionEngine::getConstantValue(), llvm::ARMTTIImpl::getInterleavedMemoryOpCost(), llvm::RISCVTTIImpl::getIntImmCost(), getPreferredAlign(), llvm::GCNTTIImpl::getShuffleCost(), llvm::ScalarEvolution::getTypeSizeInBits(), getTypeStoreSize(), llvm::HexagonTTIImpl::getUserCost(), llvm::GCNTTIImpl::getVectorInstrCost(), llvm::R600TTIImpl::getVectorInstrCost(), simplifyAMDGCNMemoryIntrinsicDemanded(), SimplifyGEPInst(), SimplifyICmpInst(), and typeSizeEqualsStoreSize().

◆ getTypeStoreSize()

TypeSize llvm::DataLayout::getTypeStoreSize ( Type Ty) const
inline

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.

Definition at line 466 of file DataLayout.h.

References llvm::TypeSize::getKnownMinSize(), getTypeSizeInBits(), and llvm::LinearPolySize< LeafTy >::isScalable().

Referenced by llvm::FastISel::createMachineMemOperandFor(), emitGlobalConstantLargeInt(), llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX2(), llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX512(), getTypeAllocSize(), getTypeStoreSizeInBits(), llvm::X86TTIImpl::isLegalNTLoad(), llvm::X86TTIImpl::isLegalNTStore(), llvm::ExecutionEngine::LoadValueFromMemory(), llvm::promoteLoopAccessesToScalars(), llvm::IRTranslator::runOnMachineFunction(), and llvm::ExecutionEngine::StoreValueToMemory().

◆ getTypeStoreSizeInBits()

TypeSize llvm::DataLayout::getTypeStoreSizeInBits ( Type Ty) const
inline

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.

Definition at line 478 of file DataLayout.h.

References getTypeStoreSize().

Referenced by typeSizeEqualsStoreSize().

◆ getValueOrABITypeAlignment()

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

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

Definition at line 524 of file DataLayout.h.

References getABITypeAlign().

◆ hasLinkerPrivateGlobalPrefix()

bool llvm::DataLayout::hasLinkerPrivateGlobalPrefix ( ) const
inline

Definition at line 307 of file DataLayout.h.

◆ hasMicrosoftFastStdCallMangling()

bool llvm::DataLayout::hasMicrosoftFastStdCallMangling ( ) const
inline

Definition at line 297 of file DataLayout.h.

◆ init()

void DataLayout::init ( const Module M)

Definition at line 533 of file DataLayout.cpp.

References M.

Referenced by DataLayout().

◆ isBigEndian()

bool llvm::DataLayout::isBigEndian ( ) const
inline

◆ isDefault()

bool llvm::DataLayout::isDefault ( ) const
inline

Test if the DataLayout was constructed from an empty string.

Definition at line 254 of file DataLayout.h.

Referenced by llvm::ExecutionEngine::getMangledName().

◆ isIllegalInteger()

bool llvm::DataLayout::isIllegalInteger ( uint64_t  Width) const
inline

Definition at line 267 of file DataLayout.h.

References isLegalInteger().

◆ isLegalInteger()

bool llvm::DataLayout::isLegalInteger ( uint64_t  Width) const
inline

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.

Definition at line 263 of file DataLayout.h.

References llvm::is_contained().

Referenced by isIllegalInteger(), and visitIVCast().

◆ isLittleEndian()

bool llvm::DataLayout::isLittleEndian ( ) const
inline

◆ isNonIntegralAddressSpace()

bool llvm::DataLayout::isNonIntegralAddressSpace ( unsigned  AddrSpace) const
inline

◆ isNonIntegralPointerType() [1/2]

bool llvm::DataLayout::isNonIntegralPointerType ( PointerType PT) const
inline

◆ isNonIntegralPointerType() [2/2]

bool llvm::DataLayout::isNonIntegralPointerType ( Type Ty) const
inline

Definition at line 396 of file DataLayout.h.

References isNonIntegralPointerType().

◆ LLVM_ATTRIBUTE_DEPRECATED() [1/2]

llvm::DataLayout::LLVM_ATTRIBUTE_DEPRECATED ( inline unsigned getPreferredAlignment(const GlobalVariable *GV) const  ,
"Use getPreferredAlign instead"   
)
inline

Returns the preferred alignment of the specified global.

This includes an explicitly requested alignment (if the global has one).

Definition at line 596 of file DataLayout.h.

References getPreferredAlign(), and llvm::Align::value().

◆ LLVM_ATTRIBUTE_DEPRECATED() [2/2]

llvm::DataLayout::LLVM_ATTRIBUTE_DEPRECATED ( inline unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const  ,
"Inline where needed  
)
inline

Returns the preferred alignment of the specified global, returned in log form.

This includes an explicitly requested alignment (if the global has one).

Definition at line 606 of file DataLayout.h.

References getPreferredAlign(), and llvm::Log2().

◆ operator!=()

bool llvm::DataLayout::operator!= ( const DataLayout Other) const
inline

Definition at line 229 of file DataLayout.h.

References Other.

◆ operator=()

DataLayout& llvm::DataLayout::operator= ( const DataLayout DL)
inline

Definition at line 210 of file DataLayout.h.

References DL.

◆ operator==()

bool DataLayout::operator== ( const DataLayout Other) const

Definition at line 535 of file DataLayout.cpp.

References Other, and llvm::MipsISD::Ret.

◆ parse()

Expected< DataLayout > DataLayout::parse ( StringRef  LayoutDescription)
static

Parse a data layout string and return the layout.

Return an error description on failure.

Definition at line 205 of file DataLayout.cpp.

◆ reset()

void DataLayout::reset ( StringRef  LayoutDescription)

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

Definition at line 178 of file DataLayout.cpp.

References llvm::SmallVectorImpl< T >::clear(), DefaultAlignments, E, Independent, and llvm::Optional< T >::reset().

Referenced by DataLayout(), and llvm::Module::setDataLayout().

◆ typeSizeEqualsStoreSize()

bool llvm::DataLayout::typeSizeEqualsStoreSize ( Type Ty) const
inline

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.

Definition at line 486 of file DataLayout.h.

References getTypeSizeInBits(), and getTypeStoreSizeInBits().


The documentation for this class was generated from the following files: