LLVM: llvm::DataLayout Class Reference (original) (raw)
A parsed version of the target data layout string in and methods for querying it. More...
#include "[llvm/IR/DataLayout.h](DataLayout%5F8h%5Fsource.html)"
| Public Types | |
|---|---|
| enum class | FunctionPtrAlignType { Independent, MultipleOfFunctionAlign } |
| Public Member Functions | |
|---|---|
| LLVM_ABI | DataLayout () |
| Constructs a DataLayout with default values. | |
| LLVM_ABI | DataLayout (StringRef LayoutString) |
| Constructs a DataLayout from a specification string. | |
| DataLayout (const DataLayout &DL) | |
| LLVM_ABI | ~DataLayout () |
| LLVM_ABI DataLayout & | operator= (const DataLayout &Other) |
| LLVM_ABI bool | operator== (const DataLayout &Other) const |
| bool | operator!= (const DataLayout &Other) const |
| bool | isLittleEndian () const |
| Layout endianness... | |
| bool | isBigEndian () const |
| const std::string & | getStringRepresentation () const |
| Returns the string representation of the DataLayout. | |
| bool | isDefault () const |
| Test if the DataLayout was constructed from an empty string. | |
| bool | isLegalInteger (uint64_t Width) const |
| Returns true if the specified type is known to be a native integer type supported by the CPU. | |
| bool | isIllegalInteger (uint64_t Width) const |
| MaybeAlign | getStackAlignment () const |
| Returns the natural stack alignment, or MaybeAlign() if one wasn't specified. | |
| unsigned | getAllocaAddrSpace () const |
| PointerType * | getAllocaPtrType (LLVMContext &Ctx) const |
| MaybeAlign | getFunctionPtrAlign () const |
| Returns the alignment of function pointers, which may or may not be related to the alignment of functions. | |
| FunctionPtrAlignType | getFunctionPtrAlignType () const |
| Return the type of function pointer alignment. | |
| 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. | |
| 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. | |
| LLVM_ABI Align | getPointerABIAlignment (unsigned AS) const |
| Layout pointer alignment. | |
| 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 the backends/clients are updated. | |
| LLVM_ABI unsigned | getPointerSize (unsigned AS=0) const |
| The pointer representation size in bytes, rounded up to a whole number of bytes. | |
| LLVM_ABI unsigned | getIndexSize (unsigned AS) const |
| The index size in bytes used for address calculation, rounded up to a whole number of bytes. | |
| unsigned | getAddressSize (unsigned AS) const |
| The integral size of a pointer in a given address space in bytes, which is defined to be the same as getIndexSize(). | |
| SmallVector< unsigned, 8 > | getNonStandardAddressSpaces () const |
| Return the address spaces with special pointer semantics (such as being unstable or non-integral). | |
| bool | isNonIntegralAddressSpace (unsigned AddrSpace) const |
| Returns whether this address space has a non-integral pointer representation, i.e. | |
| bool | hasUnstableRepresentation (unsigned AddrSpace) const |
| Returns whether this address space has an "unstable" pointer representation. | |
| bool | hasUnstableRepresentation (Type *Ty) const |
| bool | hasExternalState (unsigned AddrSpace) const |
| Returns whether this address space has external state (implies having a non-integral pointer representation). | |
| bool | hasExternalState (Type *Ty) const |
| bool | mustNotIntroduceIntToPtr (unsigned AddrSpace) const |
| Returns whether passes must avoid introducing inttoptr instructions for this address space (unless they have target-specific knowledge). | |
| bool | mustNotIntroducePtrToInt (unsigned AddrSpace) const |
| Returns whether passes must avoid introducing ptrtoint instructions for this address space (unless they have target-specific knowledge). | |
| bool | isNonIntegralPointerType (PointerType *PT) const |
| bool | isNonIntegralPointerType (Type *Ty) const |
| bool | mustNotIntroducePtrToInt (Type *Ty) const |
| bool | mustNotIntroduceIntToPtr (Type *Ty) const |
| unsigned | getPointerSizeInBits (unsigned AS=0) const |
| The size in bits of the pointer representation in a given address space. | |
| unsigned | getIndexSizeInBits (unsigned AS) const |
| The size in bits of indices used for address calculation in getelementptr and for addresses in the given AS. | |
| unsigned | getAddressSizeInBits (unsigned AS) const |
| The size in bits of an address in for the given AS. | |
| LLVM_ABI unsigned | getPointerTypeSizeInBits (Type *) const |
| The pointer representation size in bits for this type. | |
| LLVM_ABI unsigned | getIndexTypeSizeInBits (Type *Ty) const |
| The size in bits of the index used in GEP calculation for this type. | |
| unsigned | getAddressSizeInBits (Type *Ty) const |
| The size in bits of an address for this type. | |
| unsigned | getPointerTypeSize (Type *Ty) const |
| 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. | |
| 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. | |
| bool | typeSizeEqualsStoreSize (Type *Ty) const |
| Returns true if no extra padding bits are needed when storing the specified type. | |
| LLVM_ABI TypeSize | getTypeAllocSize (Type *Ty) const |
| Returns the offset in bytes between successive objects of the specified type, including alignment padding. | |
| 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. | |
| LLVM_ABI Align | getABITypeAlign (Type *Ty) const |
| Returns the minimum ABI-required alignment for the specified type. | |
| Align | getValueOrABITypeAlignment (MaybeAlign Alignment, Type *Ty) const |
| Helper function to return Alignment if it's set or the result of getABITypeAlign(Ty), in any case the result is a valid alignment. | |
| Align | getABIIntegerTypeAlignment (unsigned BitWidth) const |
| Returns the minimum ABI-required alignment for an integer type of the specified bitwidth. | |
| LLVM_ABI Align | getPrefTypeAlign (Type *Ty) const |
| Returns the preferred stack/global alignment for the specified type. | |
| 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 Type * | getIntPtrType (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. | |
| LLVM_ABI Type * | getSmallestLegalIntType (LLVMContext &C, unsigned Width=0) const |
| Returns the smallest integer type with size at least as big as Width bits. | |
| Type * | getLargestLegalIntType (LLVMContext &C) const |
| Returns the largest legal integer type, or null if none are set. | |
| LLVM_ABI unsigned | getLargestLegalIntTypeSizeInBits () const |
| Returns the size of largest legal integer type size, or 0 if none are set. | |
| LLVM_ABI IntegerType * | getIndexType (LLVMContext &C, unsigned AddressSpace) const |
| Returns the type of a GEP index in AddressSpace. | |
| IntegerType * | getAddressType (LLVMContext &C, unsigned AddressSpace) const |
| Returns the type of an address in AddressSpace. | |
| LLVM_ABI Type * | getIndexType (Type *PtrTy) const |
| Returns the type of a GEP index. | |
| Type * | getAddressType (Type *PtrTy) const |
| Returns the type of an address in AddressSpace. | |
| 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 SmallVector< APInt > | getGEPIndicesForOffset (Type *&ElemTy, APInt &Offset) const |
| Get GEP indices to access Offset inside ElemTy. | |
| LLVM_ABI std::optional< APInt > | getGEPIndexForOffset (Type *&ElemTy, APInt &Offset) const |
| Get single GEP index to access Offset inside ElemTy. | |
| LLVM_ABI const StructLayout * | getStructLayout (StructType *Ty) const |
| Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of its fields. | |
| LLVM_ABI Align | getPreferredAlign (const GlobalVariable *GV) const |
| Returns the preferred alignment of the specified global. |
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 63 of file DataLayout.h.
◆ 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 98 of file DataLayout.h.
| DataLayout::DataLayout | ( | ) |
|---|
◆ DataLayout() [2/3]
| DataLayout::DataLayout ( StringRef LayoutString) | explicit |
|---|
◆ DataLayout() [3/3]
◆ ~DataLayout()
| DataLayout::~DataLayout | ( | ) |
|---|
◆ 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 267 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 320 of file DataLayout.h.
◆ getABIIntegerTypeAlignment()
| Align llvm::DataLayout::getABIIntegerTypeAlignment ( unsigned BitWidth) const | inline |
|---|
◆ getABITypeAlign()
| Align DataLayout::getABITypeAlign | ( | Type * | Ty | ) | const |
|---|
◆ getAddressSize()
The integral size of a pointer in a given address space in bytes, which is defined to be the same as getIndexSize().
This exists as a separate function to make it clearer when reading code that the size of an address is being requested. While targets exist where index size and the underlying address width are not identical (e.g. AMDGPU fat pointers with 48-bit addresses and 32-bit offsets indexing), there is currently no need to differentiate these properties in LLVM.
See also
DataLayout::getAddressSizeInBits
Definition at line 365 of file DataLayout.h.
References getIndexSize().
◆ getAddressSizeInBits() [1/2]
| unsigned llvm::DataLayout::getAddressSizeInBits ( Type * Ty) const | inline |
|---|
The size in bits of an address for this type.
This is defined to return the same value as getIndexTypeSizeInBits(), but separate functions exist for code clarity.
Definition at line 516 of file DataLayout.h.
References getIndexTypeSizeInBits().
◆ getAddressSizeInBits() [2/2]
The size in bits of an address in for the given AS.
This is defined to return the same value as getIndexSizeInBits() since there is currently no target that requires these two properties to have different values. See getIndexSize() for more information.
See also
DataLayout::getIndexSizeInBits()
Definition at line 496 of file DataLayout.h.
References getIndexSizeInBits().
Referenced by simplifyGEPInst().
◆ getAddressType() [1/2]
◆ getAddressType() [2/2]
| Type * llvm::DataLayout::getAddressType ( Type * PtrTy) const | inline |
|---|
◆ getAllocaAddrSpace()
| unsigned llvm::DataLayout::getAllocaAddrSpace ( ) const | inline |
|---|
◆ getAllocaPtrType()
◆ getDefaultGlobalsAddressSpace()
| unsigned llvm::DataLayout::getDefaultGlobalsAddressSpace ( ) const | inline |
|---|
◆ 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
Definition at line 248 of file DataLayout.h.
◆ getFunctionPtrAlignType()
| FunctionPtrAlignType llvm::DataLayout::getFunctionPtrAlignType ( ) const | inline |
|---|
Return the type of function pointer alignment.
See also
Definition at line 252 of file DataLayout.h.
◆ getGEPIndexForOffset()
| std::optional< APInt > DataLayout::getGEPIndexForOffset | ( | Type *& | ElemTy, |
|---|---|---|---|
| APInt & | Offset ) const |
◆ getGEPIndicesForOffset()
◆ getGlobalPrefix()
| char llvm::DataLayout::getGlobalPrefix ( ) const | inline |
|---|
◆ 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 946 of file DataLayout.cpp.
References assert(), llvm::cast(), llvm::gep_type_begin(), llvm::gep_type_end(), llvm::StructLayout::getElementOffset(), llvm::generic_gep_type_iterator< ItTy >::getOperand(), llvm::generic_gep_type_iterator< ItTy >::getSequentialElementStride(), getStructLayout(), llvm::generic_gep_type_iterator< ItTy >::getStructTypeOrNull(), llvm::Value::getType(), and llvm::Type::isIntegerTy().
◆ getIndexSize()
The index size in bytes used for address calculation, rounded up to a whole number of bytes.
This not only defines the size used in getelementptr operations, but also the size of addresses in this AS. For example, a 64-bit CHERI-enabled target has 128-bit pointers of which only 64 are used to represent the address and the remaining ones are used for metadata such as bounds and access permissions. In this case getPointerSize() returns 16, but getIndexSize() returns 8. To help with code understanding, the alias getAddressSize() can be used instead of getIndexSize() to clarify that an address width is needed.
Definition at line 765 of file DataLayout.cpp.
References llvm::divideCeil().
Referenced by getAddressSize().
◆ getIndexSizeInBits()
◆ getIndexType() [1/2]
◆ getIndexType() [2/2]
| Type * DataLayout::getIndexType | ( | Type * | PtrTy | ) | const |
|---|
◆ getIndexTypeSizeInBits()
| unsigned DataLayout::getIndexTypeSizeInBits | ( | Type * | Ty | ) | const |
|---|
The size in bits of the index used in GEP calculation for this type.
The function should be called with pointer or vector of pointers type. This is defined to return the same value as getAddressSizeInBits(), but separate functions exist for code clarity.
Definition at line 769 of file DataLayout.cpp.
References assert(), llvm::cast(), getAddressSpace(), and getIndexSizeInBits().
Referenced by computeKnownBitsFromOperator(), getAddressSizeInBits(), getIndexType(), llvm::ScalarEvolution::getTypeSizeInBits(), getUnknownStore(), isNonEqualPointersWithRecursiveGEP(), llvm::simplifyBinaryIntrinsic(), and llvm::simplifyLoadInst().
◆ getIntPtrType() [1/2]
Returns an integer type with size at least as big as that of a pointer in the given address space.
Definition at line 904 of file DataLayout.cpp.
References llvm::CallingConv::C, llvm::IntegerType::get(), and getPointerSizeInBits().
Referenced by llvm::ARMSelectionDAGInfo::EmitSpecializedLibcall(), llvm::AArch64SelectionDAGInfo::EmitStreamingCompatibleMemLibCall(), llvm::HexagonSelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::XCoreSelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::SelectionDAG::getAtomicMemcpy(), llvm::SelectionDAG::getAtomicMemmove(), llvm::ScalarEvolution::getLosslessPtrToIntExpr(), llvm::SelectionDAG::getMemcmp(), and insertSpills().
◆ getIntPtrType() [2/2]
| Type * DataLayout::getIntPtrType | ( | Type * | Ty | ) | const |
|---|
◆ getLargestLegalIntType()
| Type * llvm::DataLayout::getLargestLegalIntType ( LLVMContext & C) const | inline |
|---|
◆ getLargestLegalIntTypeSizeInBits()
| unsigned DataLayout::getLargestLegalIntTypeSizeInBits | ( | ) | const |
|---|
◆ getLinkerPrivateGlobalPrefix()
| StringRef llvm::DataLayout::getLinkerPrivateGlobalPrefix ( ) const | inline |
|---|
◆ getNonStandardAddressSpaces()
◆ getPointerABIAlignment()
◆ 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 750 of file DataLayout.cpp.
◆ getPointerSize()
◆ getPointerSizeInBits()
◆ getPointerTypeSize()
| unsigned llvm::DataLayout::getPointerTypeSize ( Type * Ty) const | inline |
|---|
◆ getPointerTypeSizeInBits()
| unsigned DataLayout::getPointerTypeSizeInBits | ( | Type * | Ty | ) | const |
|---|
The pointer representation size in bits for this 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 758 of file DataLayout.cpp.
References assert(), llvm::cast(), getAddressSpace(), and getPointerSizeInBits().
Referenced by computeKnownBits(), computeKnownBitsFromOperator(), ComputeNumSignBitsImpl(), llvm::SelectionDAG::getGlobalAddress(), getIntPtrType(), getPointerTypeSize(), and llvm::SelectionDAG::InferPtrAlign().
◆ getPreferredAlign()
◆ getPrefTypeAlign()
| Align DataLayout::getPrefTypeAlign | ( | Type * | Ty | ) | const |
|---|
◆ getPrivateGlobalPrefix()
| StringRef llvm::DataLayout::getPrivateGlobalPrefix ( ) const | inline |
|---|
◆ getProgramAddressSpace()
| unsigned llvm::DataLayout::getProgramAddressSpace ( ) const | inline |
|---|
◆ getSmallestLegalIntType()
◆ getStackAlignment()
| MaybeAlign llvm::DataLayout::getStackAlignment ( ) const | inline |
|---|
Returns the natural stack alignment, or MaybeAlign() if one wasn't specified.
Definition at line 237 of file DataLayout.h.
◆ 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 215 of file DataLayout.h.
◆ getStructLayout()
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 724 of file DataLayout.cpp.
References llvm::safe_malloc(), and llvm::TrailingObjects< StructLayout, TypeSize >::totalSizeToAlloc().
Referenced by computeKnownBitsFromOperator(), getGEPIndexForOffset(), getIndexedOffsetInType(), llvm::ScalarEvolution::getOffsetOfExpr(), getTypeAllocSize(), getTypeSizeInBits(), llvm::ExecutionEngine::InitializeMemory(), isGEPKnownNonNull(), and solveDIType().
◆ getTypeAllocSize()
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.
Definition at line 858 of file DataLayout.cpp.
References A(), llvm::alignTo(), llvm::Type::ArrayTyID, llvm::BitWidth, llvm::cast(), llvm::divideCeil(), getABITypeAlign(), llvm::StructLayout::getAlignment(), llvm::TypeSize::getFixed(), getPointerABIAlignment(), getPointerSize(), llvm::StructLayout::getSizeInBytes(), getStructLayout(), getTypeAllocSize(), getTypeStoreSize(), llvm::Type::IntegerTyID, llvm::Type::PointerTyID, Size, llvm::Type::StructTyID, and llvm::Type::TargetExtTyID.
Referenced by llvm::analyzeArguments(), llvm::ExecutionEngine::emitGlobalVariable(), llvm::CSKYAsmPrinter::emitMachineConstantPoolValue(), llvm::SystemZAsmPrinter::emitMachineConstantPoolValue(), llvm::ARMAsmPrinter::emitXXStructor(), getGEPIndexForOffset(), getGEPIndicesForOffset(), getTypeAllocSize(), getTypeAllocSizeInBits(), llvm::ExecutionEngine::InitializeMemory(), llvm::HexagonTargetObjectFile::isGlobalInSmallSection(), llvm::RISCVELFTargetObjectFile::isGlobalInSmallSection(), llvm::SparcTargetLowering::LowerCall_32(), llvm::X86TargetLowering::markLibCallAttributes(), performGlobalAddressCombine(), promoteToConstantPool(), simplifyGEPInst(), and llvm::Interpreter::visitAllocaInst().
◆ 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 603 of file DataLayout.h.
References getTypeAllocSize().
Referenced by getTypeSizeInBits().
◆ 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 760 of file DataLayout.h.
References llvm::Type::ArrayTyID, assert(), llvm::Type::BFloatTyID, llvm::cast(), llvm::Type::DoubleTyID, llvm::Type::FixedVectorTyID, llvm::Type::FloatTyID, llvm::Type::FP128TyID, llvm::VectorType::getElementCount(), llvm::ArrayType::getElementType(), llvm::VectorType::getElementType(), llvm::TypeSize::getFixed(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getFixedValue(), llvm::ArrayType::getNumElements(), getPointerSizeInBits(), llvm::StructLayout::getSizeInBits(), getStructLayout(), getTypeAllocSizeInBits(), getTypeSizeInBits(), llvm::Type::HalfTyID, llvm::Type::IntegerTyID, llvm::Type::LabelTyID, llvm_unreachable, llvm::Type::PointerTyID, llvm::Type::PPC_FP128TyID, llvm::Type::ScalableVectorTyID, llvm::Type::StructTyID, llvm::Type::TargetExtTyID, llvm::Type::X86_AMXTyID, and llvm::Type::X86_FP80TyID.
Referenced by buildFrameDebugInfo(), computeKnownBits(), computeKnownBitsForHorizontalOperation(), computeKnownBitsFromOperator(), ComputeNumSignBitsImpl(), llvm::AArch64TTIImpl::getIntrinsicInstrCost(), getOrCreateRefVariable(), getPreferredAlign(), getTypeSizeInBits(), llvm::ScalarEvolution::getTypeSizeInBits(), getTypeStoreSizeInBits(), isKnownNonZeroFromOperator(), simplifyAMDGCNMemoryIntrinsicDemanded(), simplifyGEPInst(), simplifyICmpInst(), solveDIType(), tocDataChecks(), 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 557 of file DataLayout.h.
References llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getKnownMinValue(), getTypeStoreSizeInBits(), and llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::isScalable().
Referenced by emitGlobalConstantLargeInt(), getTypeAllocSize(), llvm::ExecutionEngine::LoadValueFromMemory(), llvm::SPIRVCallLowering::lowerCall(), llvm::promoteLoopAccessesToScalars(), and llvm::ExecutionEngine::StoreValueToMemory().
◆ getTypeStoreSizeInBits()
| TypeSize llvm::DataLayout::getTypeStoreSizeInBits ( Type * Ty) const | inline |
|---|
◆ 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.
Definition at line 612 of file DataLayout.h.
References getABITypeAlign().
◆ hasExternalState() [1/2]
| bool llvm::DataLayout::hasExternalState ( Type * Ty) const | inline |
|---|
◆ hasExternalState() [2/2]
| bool llvm::DataLayout::hasExternalState ( unsigned AddrSpace) const | inline |
|---|
Returns whether this address space has external state (implies having a non-integral pointer representation).
These pointer types must be loaded and stored using appropriate instructions and cannot use integer loads/stores as this would not propagate the out-of-band state. An example of such a pointer type is a CHERI capability that contain bounds, permissions and an out-of-band validity bit that is invalidated whenever an integer/FP store is performed to the associated memory location.
Definition at line 422 of file DataLayout.h.
Referenced by hasExternalState(), and mustNotIntroduceIntToPtr().
◆ hasLinkerPrivateGlobalPrefix()
| bool llvm::DataLayout::hasLinkerPrivateGlobalPrefix ( ) const | inline |
|---|
◆ hasMicrosoftFastStdCallMangling()
| bool llvm::DataLayout::hasMicrosoftFastStdCallMangling ( ) const | inline |
|---|
◆ hasUnstableRepresentation() [1/2]
| bool llvm::DataLayout::hasUnstableRepresentation ( Type * Ty) const | inline |
|---|
◆ hasUnstableRepresentation() [2/2]
| bool llvm::DataLayout::hasUnstableRepresentation ( unsigned AddrSpace) const | inline |
|---|
◆ isBigEndian()
| bool llvm::DataLayout::isBigEndian ( ) const | inline |
|---|
Definition at line 208 of file DataLayout.h.
Referenced by llvm::DwarfExpression::addConstantFP(), canCombineShuffleToExtendVectorInreg(), combineShuffleToAnyExtendVectorInreg(), combineShuffleToZeroExtendVectorInReg(), combineTruncationShuffle(), createGPRPairNode(), createGPRPairNodei64(), emitGlobalConstantFP(), foldVecExtTruncToExtElt(), foldVecTruncToExtElt(), getCopyFromParts(), getCopyToParts(), getFoldedOpcode(), getPPCf128HiElementSelector(), isExtendedBUILD_VECTOR(), LowerPredicateLoad(), LowerPredicateStore(), llvm::CombinerHelper::matchLoadOrCombine(), matchPERM(), narrowExtractedVectorLoad(), optimizeIntegerToVectorInsertions(), optimizeVectorResizeWithIntegerBitCasts(), PerformBITCASTCombine(), PerformSTORECombine(), PerformTruncatingStoreCombine(), PerformVMOVRRDCombine(), llvm::AArch64TargetLowering::ReconstructShuffle(), reduceBuildVecToShuffleWithZero(), ReplaceATOMIC_LOAD_128Results(), ReplaceCMP_SWAP_128Results(), ReplaceCMP_SWAP_64Results(), llvm::LegalizerHelper::scalarizeVectorBooleanStore(), and SkipExtensionForVMULL().
◆ isDefault()
| bool llvm::DataLayout::isDefault ( ) const | inline |
|---|
◆ isIllegalInteger()
| bool llvm::DataLayout::isIllegalInteger ( uint64_t Width) const | inline |
|---|
◆ 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 229 of file DataLayout.h.
References llvm::is_contained().
Referenced by isIllegalInteger(), and visitIVCast().
◆ isLittleEndian()
| bool llvm::DataLayout::isLittleEndian ( ) const | inline |
|---|
Layout endianness...
Definition at line 207 of file DataLayout.h.
Referenced by addShuffleForVecExtend(), llvm::SparcTargetLowering::bitcastConstantFPToInt(), combineBVOfVecSExt(), llvm::SelectionDAG::computeKnownBits(), computeKnownBitsFromOperator(), llvm::SelectionDAG::ComputeNumSignBits(), llvm::TargetLowering::expandUnalignedLoad(), llvm::TargetLowering::expandUnalignedStore(), llvm::SelectionDAG::FoldConstantArithmetic(), llvm::SelectionDAG::FoldConstantBuildVector(), llvm::TargetLowering::forceExpandWideMUL(), getMemsetStringVal(), llvm::PPC::getSplatIdxForPPCMnemonics(), llvm::TargetInstrInfo::getStackSlotRange(), llvm::PPC::isVMRGEOShuffleMask(), llvm::PPC::isVMRGHShuffleMask(), llvm::PPC::isVMRGLShuffleMask(), llvm::PPC::isVPKUDUMShuffleMask(), llvm::PPC::isVPKUHUMShuffleMask(), llvm::PPC::isVPKUWUMShuffleMask(), llvm::PPC::isVSLDOIShuffleMask(), LowerF64Op(), LowerFNEGorFABS(), llvm::SparcTargetLowering::LowerFormalArguments_32(), LowerSTORE(), performUzpCombine(), ShrinkLoadReplaceStoreWithStore(), llvm::TargetLowering::SimplifyDemandedBits(), llvm::TargetLowering::SimplifyDemandedVectorElts(), llvm::TargetLowering::SimplifyMultipleUseDemandedBits(), and llvm::TargetLowering::SimplifySetCC().
◆ isNonIntegralAddressSpace()
| bool llvm::DataLayout::isNonIntegralAddressSpace ( unsigned AddrSpace) const | inline |
|---|
Returns whether this address space has a non-integral pointer representation, i.e.
the pointer is not just an integer address but some other bitwise representation. When true, passes cannot assume that all bits of the representation map directly to the allocation address. NOTE: This also returns true for "unstable" pointers where the representation may be just an address, but this value can change at any given time (e.g. due to copying garbage collection). Examples include AMDGPU buffer descriptors with a 128-bit fat pointer and a 32-bit offset or CHERI capabilities that contain bounds, permissions and an out-of-band validity bit.
In general, more specialized functions such as mustNotIntroduceIntToPtr(), mustNotIntroducePtrToInt(), or hasExternalState() should be preferred over this one when reasoning about the behavior of IR analysis/transforms. TODO: should remove/deprecate this once all uses have migrated.
Definition at line 395 of file DataLayout.h.
Referenced by isNonIntegralPointerType().
◆ isNonIntegralPointerType() [1/2]
| bool llvm::DataLayout::isNonIntegralPointerType ( PointerType * PT) const | inline |
|---|
◆ isNonIntegralPointerType() [2/2]
| bool llvm::DataLayout::isNonIntegralPointerType ( Type * Ty) const | inline |
|---|
◆ mustNotIntroduceIntToPtr() [1/2]
| bool llvm::DataLayout::mustNotIntroduceIntToPtr ( Type * Ty) const | inline |
|---|
◆ mustNotIntroduceIntToPtr() [2/2]
| bool llvm::DataLayout::mustNotIntroduceIntToPtr ( unsigned AddrSpace) const | inline |
|---|
Returns whether passes must avoid introducing inttoptr instructions for this address space (unless they have target-specific knowledge).
This is currently the case for non-integral pointer representations with external state (hasExternalState()) since inttoptr cannot recreate the external state bits. New inttoptr instructions should also be avoided for "unstable" bitwise representations ([hasUnstableRepresentation()](#a67b3a43a7b0fd0b7c721330eaedae866 "Returns whether this address space has an "unstable" pointer representation.")) unless the pass knows it is within a critical section that retains the current representation.
Definition at line 439 of file DataLayout.h.
References hasExternalState(), and hasUnstableRepresentation().
Referenced by mustNotIntroduceIntToPtr().
◆ mustNotIntroducePtrToInt() [1/2]
| bool llvm::DataLayout::mustNotIntroducePtrToInt ( Type * Ty) const | inline |
|---|
◆ mustNotIntroducePtrToInt() [2/2]
| bool llvm::DataLayout::mustNotIntroducePtrToInt ( unsigned AddrSpace) const | inline |
|---|
Returns whether passes must avoid introducing ptrtoint instructions for this address space (unless they have target-specific knowledge).
This is currently the case for pointer address spaces that have an "unstable" representation ([hasUnstableRepresentation()](#a67b3a43a7b0fd0b7c721330eaedae866 "Returns whether this address space has an "unstable" pointer representation.")) since the bitwise pattern of such pointers could change unless the pass knows it is within a critical section that retains the current representation.
Definition at line 450 of file DataLayout.h.
References hasUnstableRepresentation().
Referenced by mustNotIntroducePtrToInt().
◆ operator!=()
◆ operator=()
◆ operator==()
◆ parse()
◆ typeSizeEqualsStoreSize()
| bool llvm::DataLayout::typeSizeEqualsStoreSize ( Type * Ty) const | inline |
|---|
The documentation for this class was generated from the following files:
- include/llvm/IR/DataLayout.h
- lib/IR/DataLayout.cpp