LLVM  8.0.1
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 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 (unsigned Align) const
 Returns true if the given alignment exceeds the natural stack alignment. More...
 
unsigned getStackAlignment () const
 
unsigned getAllocaAddrSpace () const
 
unsigned getProgramAddressSpace () 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...
 
unsigned getPointerABIAlignment (unsigned AS) const
 Layout pointer alignment. More...
 
unsigned 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< unsignedgetNonIntegralAddressSpaces () const
 Return the address spaces containing non-integral pointers. More...
 
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
 
uint64_t getTypeSizeInBits (Type *Ty) const
 Size examples: More...
 
uint64_t getTypeStoreSize (Type *Ty) const
 Returns the maximum number of bytes that may be overwritten by storing the specified type. More...
 
uint64_t 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...
 
uint64_t getTypeAllocSize (Type *Ty) const
 Returns the offset in bytes between successive objects of the specified type, including alignment padding. More...
 
uint64_t 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...
 
unsigned 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...
 
unsigned getPreferredTypeAlignmentShift (Type *Ty) const
 Returns the preferred alignment for the specified type, returned as log2 of the value (a shift amount). 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...
 
unsigned getPreferredAlignment (const GlobalVariable *GV) const
 Returns the preferred alignment of the specified global. More...
 
unsigned getPreferredAlignmentLog (const GlobalVariable *GV) const
 Returns the preferred alignment of the specified global, returned in log form. More...
 

Static Public Member Functions

static const chargetManglingComponent (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 111 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 186 of file DataLayout.h.

◆ DataLayout() [2/3]

DataLayout::DataLayout ( const Module M)
explicit

Initialize target data from properties stored in the module.

Definition at line 425 of file DataLayout.cpp.

References llvm::cl::init().

◆ DataLayout() [3/3]

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

Definition at line 193 of file DataLayout.h.

◆ ~DataLayout()

DataLayout::~DataLayout ( )

Definition at line 584 of file DataLayout.cpp.

References clear().

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 268 of file DataLayout.h.

Referenced by llvm::Mangler::getNameWithPrefix(), and getNameWithPrefixImpl().

◆ exceedsNaturalStackAlignment()

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

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

Definition at line 253 of file DataLayout.h.

Referenced by enforceKnownAlignment(), and getMemcpyLoadsAndStores().

◆ 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 317 of file DataLayout.h.

References getMaxPointerSize(), and getPointerSize().

Referenced by llvm::MemoryDependenceResults::getLoadLoadClobberFullWidthSize(), ReduceSwitchRange(), and switchToSelect().

◆ getABIIntegerTypeAlignment()

unsigned DataLayout::getABIIntegerTypeAlignment ( unsigned  BitWidth) const

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

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

Definition at line 736 of file DataLayout.cpp.

References llvm::INTEGER_ALIGN.

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

◆ getABITypeAlignment()

unsigned DataLayout::getABITypeAlignment ( Type Ty) const

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

Definition at line 730 of file DataLayout.cpp.

References llvm::StructLayout::getAlignment().

Referenced by llvm::AMDGPUMachineFunction::allocateLDSGlobal(), llvm::TargetLoweringBase::allowsMemoryAccess(), llvm::AMDGPUTargetLowering::analyzeFormalArgumentsCompute(), llvm::analyzeStandardArguments(), buildPCRelGlobalAddress(), llvm::FastISel::createMachineMemOperandFor(), llvm::createScalarizerPass(), dump(), llvm::XCoreTargetLowering::EmitInstrWithCustomInserter(), findLoadAlignment(), findMatchingInlineAsmOperand(), findStoreAlignment(), llvm::MipsTargetLowering::getABIAlignmentForCallingConv(), llvm::ARMTargetLowering::getABIAlignmentForCallingConv(), llvm::TargetLoweringBase::getABIAlignmentForCallingConv(), getAdjustedAlignment(), getBuildPairElt(), llvm::X86TargetLowering::getByValTypeAlignment(), llvm::TargetLoweringBase::getByValTypeAlignment(), llvm::SelectionDAG::getConstantPool(), llvm::SelectionDAG::getEVTAlignment(), getMemcpyLoadsAndStores(), getMemmoveLoadsAndStores(), getOpenCLAlignment(), llvm::Value::getPointerAlignment(), llvm::NVPTXTargetLowering::getPrototype(), getTypePartition(), INITIALIZE_PASS(), isAligned(), isCallPromotable(), llvm::isDereferenceableAndAlignedPointer(), llvm::HexagonTargetLowering::isLegalAddressingMode(), llvm::isSafeToLoadUnconditionally(), isSupportedType(), isWordAligned(), isWorthFoldingADDlow(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::NVPTXTargetLowering::LowerFormalArguments(), llvm::NVPTXTargetLowering::LowerReturn(), mergeConditionalStoreToAddress(), mergeInlinedArrayAllocas(), moveUp(), numVectorEltsOrZero(), llvm::PPCTargetLowering::PerformDAGCombine(), promotedOpIsNUW(), llvm::promoteLoopAccessesToScalars(), llvm::CallLowering::setArgFlags(), ShrinkLoadReplaceStoreWithStore(), SRAGlobal(), StackMallocSizeClass(), tryToElideArgumentCopy(), TypeSizeToSizeIndex(), unpackLoadToAggregate(), unpackStoreToAggregate(), llvm::InnerLoopVectorizer::vectorizeMemoryInstruction(), llvm::sroa::AllocaSliceRewriter::visit(), VisitGlobalVariableForEmission(), and XFormVExtractWithShuffleIntoLoad().

◆ getAllocaAddrSpace()

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

◆ getGlobalPrefix()

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

◆ getIndexedOffsetInType()

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

◆ getIndexSize()

unsigned DataLayout::getIndexSize ( unsigned  AS) const

Definition at line 653 of file DataLayout.cpp.

References assert(), and I.

◆ getIndexSizeInBits()

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

◆ 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 777 of file DataLayout.cpp.

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

◆ getIndexTypeSizeInBits()

unsigned DataLayout::getIndexTypeSizeInBits ( Type Ty) const

◆ 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 750 of file DataLayout.cpp.

References llvm::IntegerType::get().

Referenced by llvm::IntrinsicLowering::AddPrototypes(), canTransformToMemCmp(), llvm::VNCoercion::coerceAvailableValueToLoadTypeHelper(), llvm::ObjectSizeOffsetEvaluator::compute(), llvm::ConstantFoldCompareInstOperands(), llvm::ConstantFoldLoadFromConstPtr(), llvm::ConstantFoldLoadThroughBitcast(), ConvertDoubleToBytes(), llvm::convertPointerToIntegerType(), convertValue(), llvm::createEfficiencySanitizerPass(), createMaskInstrs(), llvm::createThreadSanitizerLegacyPassPass(), llvm::emitCalloc(), llvm::emitFReadUnlocked(), llvm::emitFWrite(), llvm::emitFWriteUnlocked(), llvm::EmitGEPOffset(), llvm::emitMalloc(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemCpyChk(), llvm::ARMSelectionDAGInfo::EmitSpecializedLibcall(), llvm::emitStrLen(), llvm::emitStrNCmp(), llvm::XCoreSelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::HexagonSelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::AArch64SelectionDAGInfo::EmitTargetCodeForMemset(), llvm::X86SelectionDAGInfo::EmitTargetCodeForMemset(), evaluateGEPOffsetExpression(), llvm::SelectionDAG::getAtomicMemcpy(), llvm::SelectionDAG::getAtomicMemmove(), llvm::SelectionDAG::getAtomicMemset(), getBoundsCheckCond(), GetConstantInt(), llvm::IRBuilderBase::getIntPtrTy(), llvm::SelectionDAG::getMemcpy(), llvm::SelectionDAG::getMemmove(), llvm::SelectionDAG::getMemset(), GetRMWLibcall(), llvm::VNCoercion::getStoreValueForLoadHelper(), INITIALIZE_PASS(), llvm::DenseMapInfo< VTableSlot >::isEqual(), llvm::CastInst::isNoopCast(), isWordAligned(), llvm::LibCallSimplifier::LibCallSimplifier(), llvm::AsmPrinter::lowerConstant(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::AArch64TargetLowering::lowerInterleavedStore(), llvm::ARMTargetLowering::lowerInterleavedStore(), llvm::IntrinsicLowering::LowerIntrinsicCall(), matchesOr(), PerformHeapAllocSRoA(), simplifyAllocaArraySize(), SimplifyBranchOnICmpChain(), SimplifyCastInst(), stripAndComputeConstantOffsets(), tryToOptimizeStoreOfMallocToGlobal(), unifyBitWidth(), and llvm::PtrUseVisitor< SliceBuilder >::visitPtr().

◆ 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 755 of file DataLayout.cpp.

References assert(), llvm::IntegerType::get(), llvm::VectorType::get(), llvm::Type::getContext(), 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 480 of file DataLayout.h.

References llvm::Type::getIntNTy().

◆ getLargestLegalIntTypeSizeInBits()

unsigned DataLayout::getLargestLegalIntTypeSizeInBits ( ) const

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

Definition at line 772 of file DataLayout.cpp.

Referenced by canUseSizedAtomicCall(), CC_RISCV(), and despeculateCountZeros().

◆ getLinkerPrivateGlobalPrefix()

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

Definition at line 274 of file DataLayout.h.

Referenced by llvm::MachineFunction::getJTISymbol(), and getNameWithPrefixImpl().

◆ getManglingComponent()

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

◆ getMaxPointerSize()

unsigned DataLayout::getMaxPointerSize ( ) const

Returns the maximum pointer size over all address spaces.

Definition at line 638 of file DataLayout.cpp.

References llvm::max(), and P.

◆ getMaxPointerSizeInBits()

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

Returns the maximum pointer size over all address spaces.

Definition at line 368 of file DataLayout.h.

References getMaxPointerSize().

Referenced by 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 345 of file DataLayout.h.

Referenced by getParentPad().

◆ getPointerABIAlignment()

unsigned DataLayout::getPointerABIAlignment ( unsigned  AS) const

Layout pointer alignment.

Definition at line 611 of file DataLayout.cpp.

References assert(), and I.

Referenced by llvm::TargetLoweringObjectFileELF::emitPersonalityValue(), and llvm::MachineJumpTableInfo::getEntryAlignment().

◆ getPointerPrefAlignment()

unsigned 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 620 of file DataLayout.cpp.

References assert(), and I.

Referenced by llvm::AsmPrinter::EmitSpecialLLVMGlobal(), and getOpenCLAlignment().

◆ 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 388 of file DataLayout.h.

Referenced by llvm::AsmPrinter::EmitGlobalVariable().

◆ 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 646 of file DataLayout.cpp.

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

Referenced by llvm::ObjectSizeOffsetVisitor::compute(), llvm::ConstantFoldCastOperand(), ConvertDoubleToBytes(), llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getGEPCost(), llvm::SelectionDAG::getGlobalAddress(), llvm::TargetTransformInfoImplBase::getOperationCost(), and llvm::CastInst::isBitOrNoopPointerCastable().

◆ getPreferredAlignment()

unsigned DataLayout::getPreferredAlignment ( const GlobalVariable GV) const

Returns the preferred alignment of the specified global.

getPreferredAlignment - Return the preferred alignment of the specified global.

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

Definition at line 818 of file DataLayout.cpp.

References llvm::GlobalObject::getAlignment(), llvm::GlobalValue::getValueType(), llvm::GlobalVariable::hasInitializer(), llvm::GlobalObject::hasSection(), and llvm::max().

Referenced by getAlignment(), llvm::Value::getPointerAlignment(), promoteToConstantPool(), selectELFSectionForGlobal(), llvm::TargetLoweringObjectFileMachO::SelectSectionForGlobal(), and llvm::ExecutionEngine::~ExecutionEngine().

◆ getPreferredAlignmentLog()

unsigned DataLayout::getPreferredAlignmentLog ( const GlobalVariable GV) const

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

getPreferredAlignmentLog - Return 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 856 of file DataLayout.cpp.

References llvm::Log2_32().

Referenced by getGVAlignmentLog2().

◆ getPreferredTypeAlignmentShift()

unsigned DataLayout::getPreferredTypeAlignmentShift ( Type Ty) const

Returns the preferred alignment for the specified type, returned as log2 of the value (a shift amount).

Definition at line 744 of file DataLayout.cpp.

References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, assert(), and llvm::Log2_32().

◆ getPrefTypeAlignment()

unsigned DataLayout::getPrefTypeAlignment ( Type Ty) const

◆ 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 765 of file DataLayout.cpp.

References llvm::Type::getIntNTy().

Referenced by getRelevantOperands().

◆ getStackAlignment()

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

◆ 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 229 of file DataLayout.h.

Referenced by llvm::Module::getDataLayoutStr().

◆ getStructLayout()

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

◆ getTypeAllocSize()

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

Returns the offset in bytes between successive objects of the specified type, including alignment padding.

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 436 of file DataLayout.h.

References llvm::alignTo().

Referenced by llvm::GEPOperator::accumulateConstantOffset(), addByteCountSuffix(), llvm::LoopAccessInfo::addRuntimeChecks(), llvm::AMDGPUMachineFunction::allocateLDSGlobal(), llvm::AMDGPUTargetLowering::analyzeFormalArgumentsCompute(), llvm::analyzeStandardArguments(), branchMaxOffsets(), canReplaceGEPIdxWithZero(), CC_RISCV(), computeArraySize(), computeValueLLTs(), llvm::ComputeValueVTs(), llvm::ConstantFoldLoadFromConstPtr(), llvm::ConstantFoldLoadThroughBitcast(), ConvertDoubleToBytes(), llvm::createAMDGPUFunctionInliningPass(), llvm::createEfficiencySanitizerPass(), dump(), llvm::AsmPrinter::EmitConstantPool(), llvm::EmitGEPOffset(), llvm::AsmPrinter::EmitGlobalConstant(), emitGlobalConstantArray(), emitGlobalConstantDataSequential(), emitGlobalConstantFP(), emitGlobalConstantImpl(), emitGlobalConstantLargeInt(), emitGlobalConstantStruct(), emitGlobalConstantVector(), llvm::AsmPrinter::emitGlobalGOTEquivs(), llvm::AsmPrinter::EmitGlobalVariable(), llvm::SystemZAsmPrinter::EmitMachineConstantPoolValue(), llvm::ARMAsmPrinter::EmitMachineConstantPoolValue(), emitPostSt(), llvm::ARMAsmPrinter::EmitXXStructor(), evaluateGEPOffsetExpression(), findArgumentCopyElisionCandidates(), getAllocaSizeInBytes(), llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getGEPCost(), llvm::getGEPInductionOperand(), getMaxPointerSize(), getMinVisibility(), getNaturalGEPRecursively(), getNaturalGEPWithOffset(), GetOffsetFromIndex(), getOpenCLAlignment(), llvm::NVPTXTargetLowering::getPrototype(), llvm::MachineConstantPoolEntry::getSectionKind(), getTypePartition(), getUniformBase(), llvm::AMDGPUTTIImpl::getUnrollingPreferences(), hasIrregularType(), hasUndefContents(), instrumentMaskedLoadOrStore(), isCallPromotable(), llvm::LanaiTargetObjectFile::isConstantInSmallSection(), llvm::MipsTargetObjectFile::IsConstantInSmallSection(), llvm::MipsTargetObjectFile::IsGlobalInSmallSection(), llvm::InductionDescriptor::isInductionPHI(), isKnownTypeIdMember(), llvm::XCoreTargetLowering::isLegalAddressingMode(), isObjectSizeLessThanOrEq(), isSafeDependenceDistance(), isSafeToEliminateVarargsCast(), llvm::isSafeToLoadUnconditionally(), IsSmallObject(), llvm::NVPTXTargetLowering::LowerCall(), llvm::SparcTargetLowering::LowerCall_32(), llvm::AsmPrinter::lowerConstant(), llvm::AMDGPUCallLowering::lowerFormalArguments(), llvm::X86TargetLowering::markLibCallAttributes(), matchesOr(), mayTailCallThisCC(), moveUp(), performGlobalAddressCombine(), PerformHeapAllocSRoA(), promoteToConstantPool(), RedzoneSizeForScale(), replaceFrameSize(), llvm::ARMTargetLowering::ReplaceNodeResults(), replaceShuffleOfInsert(), llvm::WholeProgramDevirtPass::run(), llvm::FunctionLoweringInfo::set(), llvm::CallLowering::setArgFlags(), llvm::HexagonTargetObjectFile::shouldPutJumpTableInFunctionSection(), SimplifyGEPInst(), AllocaSlices::SliceBuilder::SliceBuilder(), SRAGlobal(), StackMallocSizeClass(), stripAggregateTypeWrapping(), tryToElideArgumentCopy(), tryToOptimizeStoreOfMallocToGlobal(), TypeSizeToSizeIndex(), unifyBitWidth(), unpackLoadToAggregate(), unpackStoreToAggregate(), llvm::Interpreter::visitAllocaInst(), llvm::ObjectSizeOffsetVisitor::visitAllocaInst(), llvm::ObjectSizeOffsetEvaluator::visitAllocaInst(), llvm::ObjectSizeOffsetVisitor::visitArgument(), llvm::ObjectSizeOffsetVisitor::visitGlobalVariable(), VisitGlobalVariableForEmission(), and llvm::ExecutionEngine::~ExecutionEngine().

◆ getTypeAllocSizeInBits()

uint64_t 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.

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 446 of file DataLayout.h.

References C.

Referenced by llvm::ConstantFoldLoadThroughBitcast(), ConvertDoubleToBytes(), llvm::AllocaInst::getAllocationSizeInBits(), llvm::HexagonTargetLowering::getTgtMemIntrinsic(), hasIrregularType(), isDenselyPacked(), isRepeatedByteSequence(), llvm::NVPTXTargetLowering::LowerCall(), llvm::AsmPrinter::lowerConstant(), llvm::NVPTXTargetLowering::LowerReturn(), SRAGlobal(), and valueCoversEntireFragment().

◆ getTypeSizeInBits()

uint64_t 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.

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 568 of file DataLayout.h.

References llvm::Type::ArrayTyID, assert(), llvm::Type::DoubleTyID, llvm::Type::FloatTyID, llvm::Type::FP128TyID, llvm::SequentialType::getElementType(), llvm::Type::getIntegerBitWidth(), llvm::SequentialType::getNumElements(), llvm::Type::getPointerAddressSpace(), 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::StructTyID, llvm::Type::VectorTyID, llvm::Type::X86_FP80TyID, and llvm::Type::X86_MMXTyID.

Referenced by llvm::IVUsers::AddUsersImpl(), llvm::sroa::AllocaSliceRewriter::AllocaSliceRewriter(), llvm::VNCoercion::analyzeLoadFromClobberingLoad(), llvm::VNCoercion::analyzeLoadFromClobberingStore(), llvm::VNCoercion::analyzeLoadFromClobberingWrite(), llvm::VNCoercion::canCoerceMustAliasedValueToLoad(), canConvertValue(), llvm::FastISel::canFoldAddIntoGEP(), llvm::VNCoercion::coerceAvailableValueToLoadTypeHelper(), combineLoadToOperationType(), computeRecurrenceType(), llvm::ConstantFoldLoadFromConstPtr(), llvm::ConstantFoldLoadThroughBitcast(), llvm::InnerLoopVectorizer::createBitOrPointerCast(), llvm::createScalarizerPass(), llvm::getCallsiteCost(), llvm::ARMTTIImpl::getInterleavedMemoryOpCost(), llvm::getLLTForType(), getMemCmpLoad(), llvm::VNCoercion::getMemInstValueForLoadHelper(), getMemSetPatternValue(), getNaturalGEPRecursively(), getNumBytes(), llvm::AArch64TargetLowering::getNumInterleavedAccesses(), llvm::ARMTargetLowering::getNumInterleavedAccesses(), llvm::TargetTransformInfoImplBase::getOperationCost(), llvm::GCNTTIImpl::getShuffleCost(), llvm::LoopVectorizationCostModel::getSmallestAndWidestTypes(), llvm::VNCoercion::getStoreValueForLoadHelper(), llvm::ARMTargetLowering::getTgtMemIntrinsic(), getTypePartition(), llvm::HexagonTTIImpl::getUserCost(), llvm::GCNTTIImpl::getVectorInstrCost(), llvm::R600TTIImpl::getVectorInstrCost(), hasIrregularType(), isBitCastSemanticsPreserving(), isContiguous(), isDenselyPacked(), isIntegerWideningViable(), llvm::AArch64TargetLowering::isLegalAddressingMode(), llvm::AArch64TargetLowering::isLegalInterleavedAccessType(), llvm::ARMTargetLowering::isLegalInterleavedAccessType(), isLoadInvariantInLoop(), isSimpleEnoughValueToCommitHelper(), isVectorPromotionViable(), llvm::TargetLowering::ParseConstraints(), processDbgDeclares(), promotedOpIsNUW(), llvm::LoopPredicationPass::run(), SimplifyGEPInst(), SimplifyICmpInst(), splitMergedValStore(), stripAggregateTypeWrapping(), TypeSizeToSizeIndex(), and llvm::sroa::AllocaSliceRewriter::visit().

◆ getTypeStoreSize()

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

Returns the maximum number of bytes that may be overwritten by storing the specified type.

For example, returns 5 for i36 and 10 for x86_fp80.

Definition at line 419 of file DataLayout.h.

Referenced by aliasSameBasePointerGEPs(), llvm::VNCoercion::analyzeLoadFromClobberingLoad(), CanShareConstantPoolEntry(), computeValueLLTs(), llvm::IRBuilder< TargetFolder >::CreateExtractInteger(), llvm::FastISel::createMachineMemOperandFor(), createMaskInstrs(), llvm::createScalarizerPass(), llvm::NVPTXAsmPrinter::doFinalization(), emitGlobalConstantFP(), llvm::Evaluator::EvaluateBlock(), extractInteger(), findArgumentCopyElisionCandidates(), llvm::FindAvailablePtrLoadStore(), llvm::StackSafetyInfo::FunctionInfo::FunctionInfo(), getAtomicOpAlign(), getAtomicOpSize(), getBoundsCheckCond(), llvm::getConstantDataArrayInfo(), llvm::VNCoercion::getConstantLoadValueForLoad(), llvm::MemoryLocation::getForArgument(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getInterleavedMemoryOpCost(), llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX2(), llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX512(), llvm::VNCoercion::getLoadValueForLoad(), llvm::Value::getPointerDereferenceableBytes(), llvm::X86TTIImpl::getShuffleCost(), getUniformBase(), HandleByValArgumentInit(), hasIrregularType(), hasOnlySelectUsers(), INITIALIZE_PASS(), insertInteger(), llvm::isConsecutiveAccess(), llvm::isDereferenceableAndAlignedPointer(), isDereferenceableForAllocaSize(), isIntegerWideningViableForSlice(), llvm::SITargetLowering::isLegalAddressingMode(), isPointerValueDeadOnEntryToFunction(), llvm::isSafeToLoadUnconditionally(), lookupFunction(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::AMDGPUCallLowering::lowerReturn(), moveUp(), llvm::AAEvaluator::run(), llvm::HexagonTargetLowering::shouldExpandAtomicCmpXchgInIR(), AllocaSlices::SliceBuilder::SliceBuilder(), TypeSizeToSizeIndex(), and llvm::sroa::AllocaSliceRewriter::visit().

◆ getTypeStoreSizeInBits()

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

◆ hasLinkerPrivateGlobalPrefix()

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

Definition at line 272 of file DataLayout.h.

Referenced by llvm::AsmPrinter::EmitJumpTableInfo().

◆ hasMicrosoftFastStdCallMangling()

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

Definition at line 262 of file DataLayout.h.

Referenced by llvm::Mangler::getNameWithPrefix().

◆ init()

void DataLayout::init ( const Module M)

Definition at line 429 of file DataLayout.cpp.

References llvm::Module::getDataLayout().

◆ 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 234 of file DataLayout.h.

Referenced by llvm::orc::LLJIT::applyDataLayout(), and llvm::ExecutionEngine::getMangledName().

◆ isIllegalInteger()

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

Definition at line 250 of file DataLayout.h.

Referenced by llvm::SCEVExpander::getRelatedExistingExpansion().

◆ 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 243 of file DataLayout.h.

Referenced by llvm::IVUsers::AddUsersImpl(), combineLoadToOperationType(), FindLoopCounter(), llvm::TargetTransformInfoImplBase::getOperationCost(), getRelevantOperands(), getTypePartition(), isIntegerWideningViable(), llvm::sroa::AllocaSliceRewriter::visit(), and visitIVCast().

◆ isLittleEndian()

bool llvm::DataLayout::isLittleEndian ( ) 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 355 of file DataLayout.h.

References llvm::dyn_cast().

◆ operator!=()

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

Definition at line 213 of file DataLayout.h.

References llvm::cl::init().

◆ operator=()

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

Definition at line 197 of file DataLayout.h.

References clear(), isBigEndian(), llvm::LayoutAlignElem::operator==(), and Other.

◆ operator==()

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

◆ reset()

void DataLayout::reset ( StringRef  LayoutDescription)

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

Definition at line 180 of file DataLayout.cpp.

References clear(), and E.

Referenced by llvm::Module::setDataLayout().


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