LLVM
15.0.0git
|
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 () | |
DataLayout & | operator= (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 in bytes, rounded up to a whole number of bytes. More... | |
unsigned | getMaxIndexSize () const |
Returns the maximum index size over all address spaces. More... | |
unsigned | getIndexSize (unsigned AS) const |
rounded up to a whole number of bytes. More... | |
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 | getMaxIndexSizeInBits () const |
Returns the maximum index 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... | |
uint64_t | 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... | |
uint64_t | 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... | |
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. More... | |
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. More... | |
Type * | getSmallestLegalIntType (LLVMContext &C, unsigned Width=0) const |
Returns the smallest integer type with size at least as big as Width bits. More... | |
Type * | getLargestLegalIntType (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... | |
Type * | getIndexType (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... | |
SmallVector< APInt > | getGEPIndicesForOffset (Type *&ElemTy, APInt &Offset) const |
Get GEP indices to access Offset inside ElemTy. More... | |
Optional< APInt > | getGEPIndexForOffset (Type *&ElemTy, APInt &Offset) const |
Get single GEP index to access Offset inside ElemTy. More... | |
const StructLayout * | getStructLayout (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... | |
Static Public Member Functions | |
static Expected< DataLayout > | parse (StringRef LayoutDescription) |
Parse a data layout string and return the layout. More... | |
static const char * | getManglingComponent (const Triple &T) |
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 113 of file DataLayout.h.
|
strong |
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 115 of file DataLayout.h.
|
inlineexplicit |
Constructs a DataLayout from a specification string. See reset().
Definition at line 202 of file DataLayout.h.
References reset().
Initialize target data from properties stored in the module.
Definition at line 534 of file DataLayout.cpp.
|
inline |
Definition at line 209 of file DataLayout.h.
References DL.
DataLayout::~DataLayout | ( | ) |
Definition at line 674 of file DataLayout.cpp.
|
inline |
Returns true if symbols with leading question marks should not receive IR mangling.
True for Windows mangling modes.
Definition at line 306 of file DataLayout.h.
|
inline |
Returns true if the given alignment exceeds the natural stack alignment.
Definition at line 273 of file DataLayout.h.
|
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 361 of file DataLayout.h.
|
inline |
Returns the minimum ABI-required alignment for an integer type of the specified bitwidth.
Definition at line 539 of file DataLayout.h.
References llvm::BitWidth.
Referenced by llvm::MachineJumpTableInfo::getEntryAlignment().
Returns the minimum ABI-required alignment for the specified type.
Definition at line 829 of file DataLayout.cpp.
Referenced by llvm::analyzeArguments(), llvm::FastISel::createMachineMemOperandFor(), getABITypeAlignment(), llvm::SelectionDAG::getConstantPool(), llvm::SelectionDAG::getEVTAlign(), getMemsetStores(), getPreferredAlign(), getValueOrABITypeAlignment(), llvm::PPCTargetLowering::PerformDAGCombine(), and llvm::InstCombinerImpl::visitAtomicRMWInst().
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 825 of file DataLayout.cpp.
References getABITypeAlign(), and llvm::Align::value().
Referenced by getTypeAllocSize().
|
inline |
Definition at line 282 of file DataLayout.h.
Referenced by llvm::TargetMachine::getAllocaPointerSize(), and llvm::MachinePointerInfo::getUnknownStack().
|
inline |
Definition at line 296 of file DataLayout.h.
|
inline |
Returns the alignment of function pointers, which may or may not be related to the alignment of functions.
Definition at line 287 of file DataLayout.h.
|
inline |
Return the type of function pointer alignment.
Definition at line 291 of file DataLayout.h.
Get single GEP index to access Offset inside ElemTy.
Returns None if index cannot be computed, e.g. because the type is not an aggregate. ElemTy is updated to be the result element type and Offset to be the residual offset.
Definition at line 928 of file DataLayout.cpp.
References llvm::TypeSize::Fixed(), llvm::StructLayout::getElementContainingOffset(), getElementIndex(), llvm::StructLayout::getElementOffset(), llvm::TypeSize::getFixedSize(), llvm::StructLayout::getSizeInBytes(), getStructLayout(), getTypeAllocSize(), getTypeSizeInBits(), and llvm::None.
Referenced by getGEPIndicesForOffset().
SmallVector< APInt > DataLayout::getGEPIndicesForOffset | ( | Type *& | ElemTy, |
APInt & | Offset | ||
) | const |
Get GEP indices to access Offset inside ElemTy.
ElemTy is updated to be the result element type and Offset to be the residual offset.
Definition at line 961 of file DataLayout.cpp.
References assert(), getElementIndex(), getGEPIndexForOffset(), getTypeAllocSize(), and llvm::Type::isSized().
|
inline |
Definition at line 318 of file DataLayout.h.
References llvm_unreachable.
Referenced by llvm::emitLinkerFlagsForGlobalCOFF().
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 879 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().
unsigned DataLayout::getIndexSize | ( | unsigned | AS | ) | const |
rounded up to a whole number of bytes.
Definition at line 728 of file DataLayout.cpp.
References llvm::divideCeil().
|
inline |
Size in bits of index used for address calculation in getelementptr.
Definition at line 422 of file DataLayout.h.
References llvm::PointerAlignElem::IndexBitWidth.
Referenced by llvm::GISelKnownBits::computeKnownBitsImpl(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getEstimatedNumberOfCaseClusters(), getIndexTypeSizeInBits(), and simplifyGEPInst().
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 869 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().
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 732 of file DataLayout.cpp.
References assert(), llvm::AVR::getAddressSpace(), getIndexSizeInBits(), llvm::Type::getScalarType(), and llvm::Type::isPtrOrPtrVectorTy().
Referenced by llvm::ObjectSizeOffsetVisitor::compute(), getIndexType(), llvm::ScalarEvolution::getTypeSizeInBits(), and simplifyLoadInst().
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 842 of file DataLayout.cpp.
References llvm::IntegerType::get(), and getPointerSizeInBits().
Referenced by llvm::ScalarEvolution::getLosslessPtrToIntExpr(), llvm::IntrinsicLowering::LowerIntrinsicCall(), simplifyAllocaArraySize(), simplifyCastInst(), and llvm::ObjectSizeOffsetEvaluator::visitAllocaInst().
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 847 of file DataLayout.cpp.
References assert(), llvm::IntegerType::get(), llvm::VectorType::get(), llvm::Type::getContext(), getPointerTypeSizeInBits(), and llvm::Type::isPtrOrPtrVectorTy().
|
inline |
Returns the largest legal integer type, or null if none are set.
Definition at line 569 of file DataLayout.h.
References llvm::Type::getIntNTy(), and getLargestLegalIntTypeSizeInBits().
unsigned DataLayout::getLargestLegalIntTypeSizeInBits | ( | ) | const |
Returns the size of largest legal integer type size, or 0 if none are set.
Definition at line 864 of file DataLayout.cpp.
Referenced by getLargestLegalIntType().
|
inline |
Definition at line 312 of file DataLayout.h.
Definition at line 153 of file DataLayout.cpp.
References llvm::Triple::x86.
Referenced by computeDataLayout(), and getDataLayoutString().
unsigned DataLayout::getMaxIndexSize | ( | ) | const |
Returns the maximum index size over all address spaces.
Definition at line 712 of file DataLayout.cpp.
References llvm::divideCeil(), llvm::max(), and P.
Referenced by getMaxIndexSizeInBits().
|
inline |
Returns the maximum index size over all address spaces.
Definition at line 417 of file DataLayout.h.
References getMaxIndexSize().
|
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 391 of file DataLayout.h.
Referenced by isNonIntegralAddressSpace().
Align DataLayout::getPointerABIAlignment | ( | unsigned | AS | ) | const |
Layout pointer alignment.
Definition at line 700 of file DataLayout.cpp.
References llvm::PointerAlignElem::ABIAlign.
Referenced by llvm::MachineJumpTableInfo::getEntryAlignment().
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 704 of file DataLayout.cpp.
References llvm::PointerAlignElem::PrefAlign.
unsigned DataLayout::getPointerSize | ( | unsigned | AS = 0 | ) | const |
Layout pointer size in bytes, rounded up to a whole number of bytes.
FIXME: The defaults need to be removed once all of the backends/clients are updated.
Definition at line 708 of file DataLayout.cpp.
References llvm::divideCeil().
Referenced by llvm::DwarfCompileUnit::addLocationAttribute(), llvm::TargetLoweringBase::emitPatchPoint(), llvm::TargetMachine::getAllocaPointerSize(), llvm::MachineJumpTableInfo::getEntrySize(), llvm::TargetMachine::getPointerSize(), llvm::TargetMachine::getProgramPointerSize(), llvm::AsmPrinter::GetSizeOfEncodedValue(), and isTargetNullPtr().
|
inline |
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients are updated.
Definition at line 412 of file DataLayout.h.
References llvm::PointerAlignElem::TypeBitWidth.
Referenced by llvm::InstructionSelector::executeMatchTable(), llvm::ExecutionEngine::getConstantValue(), getIntPtrType(), llvm::TargetMachine::getPointerSizeInBits(), getPointerTypeSizeInBits(), getTypeSizeInBits(), lle_X_sprintf(), llvm::GCNTTIImpl::rewriteIntrinsicWithAddressSpace(), simplifyGEPInst(), and unpackFromMemLoc().
|
inline |
Definition at line 437 of file DataLayout.h.
References 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 721 of file DataLayout.cpp.
References assert(), llvm::AVR::getAddressSpace(), getPointerSizeInBits(), llvm::Type::getScalarType(), and llvm::Type::isPtrOrPtrVectorTy().
Referenced by llvm::TargetTransformInfoImplBase::getCastInstrCost(), llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getGEPCost(), llvm::SelectionDAG::getGlobalAddress(), getIntPtrType(), getPointerTypeSize(), and llvm::SelectionDAG::InferPtrAlign().
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 978 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(), promoteToConstantPool(), llvm::TargetLoweringObjectFileMachO::SelectSectionForGlobal(), and llvm::TargetLoweringObjectFileXCOFF::SelectSectionForGlobal().
Returns the preferred stack/global alignment for the specified type.
This is always at least as good as the ABI alignment.
Definition at line 838 of file DataLayout.cpp.
Referenced by llvm::PPCInstrInfo::finalizeInsInstrs(), llvm::SelectionDAG::getConstantPool(), getPreferredAlign(), getPrefTypeAlign(), getPrefTypeAlignment(), llvm::X86TTIImpl::getVectorInstrCost(), ReplaceLoadVector(), llvm::FunctionLoweringInfo::set(), and llvm::SelectionDAGBuilder::visitSPDescriptorParent().
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 834 of file DataLayout.cpp.
References getPrefTypeAlign(), and llvm::Align::value().
Referenced by solveDIType().
|
inline |
Definition at line 334 of file DataLayout.h.
References llvm_unreachable.
Referenced by llvm::TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(), llvm::TargetLoweringObjectFile::getSymbolWithGlobalValueBase(), and llvm::MipsAsmPrinter::printOperand().
|
inline |
Definition at line 295 of file DataLayout.h.
Referenced by llvm::Module::getOrInsertFunction(), llvm::TargetMachine::getProgramPointerSize(), and maybePrintCallAddrSpace().
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 857 of file DataLayout.cpp.
References llvm::Type::getIntNTy().
|
inline |
Definition at line 277 of file DataLayout.h.
References assert().
Referenced by CC_AArch64_Custom_Block().
|
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 252 of file DataLayout.h.
Referenced by llvm::orc::LLJIT::applyDataLayout(), and llvm::orc::LLJITBuilderState::prepareForConstruction().
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 678 of file DataLayout.cpp.
References llvm::StructType::getNumElements(), and llvm::safe_malloc().
Referenced by llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getGEPCost(), getGEPIndexForOffset(), getIndexedOffsetInType(), getTypeSizeInBits(), llvm::ExecutionEngine::InitializeMemory(), and solveDIType().
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 506 of file DataLayout.h.
References llvm::alignTo(), getABITypeAlignment(), and getTypeStoreSize().
Referenced by llvm::GCNTTIImpl::adjustInliningThreshold(), llvm::analyzeArguments(), llvm::ExecutionEngine::emitGlobalVariable(), llvm::CSKYAsmPrinter::emitMachineConstantPoolValue(), llvm::SystemZAsmPrinter::emitMachineConstantPoolValue(), llvm::ARMAsmPrinter::emitXXStructor(), llvm::ARMTTIImpl::getGatherScatterOpCost(), llvm::TargetTransformInfoImplCRTPBase< AMDGPUTTIImpl >::getGEPCost(), getGEPIndexForOffset(), getGEPIndicesForOffset(), getIndexedOffsetInType(), getTypeAllocSizeInBits(), llvm::AMDGPUTTIImpl::getUnrollingPreferences(), llvm::ExecutionEngine::InitializeMemory(), llvm::RISCVELFTargetObjectFile::isGlobalInSmallSection(), llvm::HexagonTargetObjectFile::isGlobalInSmallSection(), llvm::SparcTargetLowering::LowerCall_32(), llvm::X86TargetLowering::markLibCallAttributes(), performGlobalAddressCombine(), promoteToConstantPool(), llvm::FunctionLoweringInfo::set(), simplifyGEPInst(), llvm::Interpreter::visitAllocaInst(), llvm::ObjectSizeOffsetVisitor::visitAllocaInst(), llvm::ObjectSizeOffsetEvaluator::visitAllocaInst(), llvm::ObjectSizeOffsetVisitor::visitArgument(), and llvm::ObjectSizeOffsetVisitor::visitGlobalVariable().
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 519 of file DataLayout.h.
References getTypeAllocSize().
Referenced by getTypeSizeInBits(), and llvm::PatternMatch::VScaleVal_match::match().
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 673 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::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 buildFrameDebugInfo(), llvm::FastISel::canFoldAddIntoGEP(), llvm::TargetTransformInfoImplBase::getCastInstrCost(), llvm::ExecutionEngine::getConstantValue(), getGEPIndexForOffset(), llvm::X86TTIImpl::getInterleavedMemoryOpCost(), llvm::ARMTTIImpl::getInterleavedMemoryOpCost(), llvm::RISCVTTIImpl::getIntImmCost(), llvm::X86TTIImpl::getMemoryOpCost(), getPreferredAlign(), llvm::X86TTIImpl::getReplicationShuffleCost(), llvm::GCNTTIImpl::getShuffleCost(), llvm::ScalarEvolution::getTypeSizeInBits(), getTypeStoreSize(), llvm::HexagonTTIImpl::getUserCost(), llvm::R600TTIImpl::getVectorInstrCost(), llvm::GCNTTIImpl::getVectorInstrCost(), simplifyAMDGCNMemoryIntrinsicDemanded(), simplifyGEPInst(), simplifyICmpInst(), solveDIType(), and typeSizeEqualsStoreSize().
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 474 of file DataLayout.h.
References llvm::divideCeil(), llvm::TypeSize::getKnownMinSize(), getTypeSizeInBits(), and llvm::LinearPolySize< LeafTy >::isScalable().
Referenced by llvm::FastISel::createMachineMemOperandFor(), emitGlobalConstantLargeInt(), llvm::X86TTIImpl::getInterleavedMemoryOpCostAVX512(), getTypeAllocSize(), getTypeStoreSizeInBits(), llvm::RISCVTTIImpl::isLegalMaskedGatherScatter(), llvm::RISCVTTIImpl::isLegalMaskedLoadStore(), llvm::X86TTIImpl::isLegalNTLoad(), llvm::TargetTransformInfoImplBase::isLegalNTLoad(), llvm::X86TTIImpl::isLegalNTStore(), llvm::TargetTransformInfoImplBase::isLegalNTStore(), llvm::ExecutionEngine::LoadValueFromMemory(), llvm::SPIRVCallLowering::lowerCall(), llvm::promoteLoopAccessesToScalars(), llvm::IRTranslator::runOnMachineFunction(), and llvm::ExecutionEngine::StoreValueToMemory().
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 486 of file DataLayout.h.
References getTypeStoreSize().
Referenced by llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getMemoryOpCost(), and typeSizeEqualsStoreSize().
|
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 532 of file DataLayout.h.
References getABITypeAlign().
|
inline |
Definition at line 310 of file DataLayout.h.
|
inline |
Definition at line 300 of file DataLayout.h.
|
inline |
Definition at line 245 of file DataLayout.h.
Referenced by llvm::DwarfExpression::addConstantFP(), combineShuffleToVectorExtend(), combineTruncationShuffle(), createGPRPairNode(), emitGlobalConstantFP(), foldVecTruncToExtElt(), getCopyFromParts(), getCopyToParts(), getPPCf128HiElementSelector(), isExtendedBUILD_VECTOR(), isVMOVModifiedImm(), llvm::LegalizerHelper::lowerLoad(), LowerPredicateLoad(), LowerPredicateStore(), llvm::CombinerHelper::matchLoadOrCombine(), narrowExtractedVectorLoad(), optimizeIntegerToVectorInsertions(), optimizeVectorResizeWithIntegerBitCasts(), PerformBITCASTCombine(), PerformSTORECombine(), PerformTruncatingStoreCombine(), PerformVMOVRRDCombine(), llvm::LegalizerHelper::reduceLoadStoreWidth(), ReplaceCMP_SWAP_128Results(), ReplaceCMP_SWAP_64Results(), llvm::TargetLowering::scalarizeVectorLoad(), llvm::TargetLowering::scalarizeVectorStore(), and SkipExtensionForVMULL().
|
inline |
Test if the DataLayout was constructed from an empty string.
Definition at line 257 of file DataLayout.h.
Referenced by llvm::ExecutionEngine::getMangledName().
|
inline |
Definition at line 270 of file DataLayout.h.
References isLegalInteger().
|
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 266 of file DataLayout.h.
References llvm::is_contained().
Referenced by llvm::TargetTransformInfoImplBase::getCastInstrCost(), isIllegalInteger(), and visitIVCast().
|
inline |
Layout endianness...
Definition at line 244 of file DataLayout.h.
Referenced by llvm::DwarfUnit::addConstantValue(), addShuffleForVecExtend(), llvm::SparcTargetLowering::bitcastConstantFPToInt(), combineBVOfVecSExt(), llvm::SelectionDAG::computeKnownBits(), llvm::SelectionDAG::ComputeNumSignBits(), llvm::TargetLowering::expandUnalignedLoad(), llvm::TargetLowering::expandUnalignedStore(), llvm::SelectionDAG::FoldConstantArithmetic(), getMemsetStringVal(), llvm::PPC::getSplatIdxForPPCMnemonics(), llvm::TargetInstrInfo::getStackSlotRange(), llvm::PPCTTIImpl::instCombineIntrinsic(), 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(), llvm::IRTranslator::runOnMachineFunction(), ShrinkLoadReplaceStoreWithStore(), llvm::TargetLowering::SimplifyDemandedBits(), llvm::TargetLowering::SimplifyDemandedVectorElts(), llvm::TargetLowering::SimplifyMultipleUseDemandedBits(), and llvm::TargetLowering::SimplifySetCC().
|
inline |
Definition at line 395 of file DataLayout.h.
References getNonIntegralAddressSpaces(), and llvm::is_contained().
Referenced by llvm::GISelKnownBits::computeKnownBitsImpl(), isNonIntegralPointerType(), and llvm::LegalizerHelper::lowerMergeValues().
|
inline |
Definition at line 400 of file DataLayout.h.
References llvm::PointerType::getAddressSpace(), and isNonIntegralAddressSpace().
Referenced by isNonIntegralPointerType().
|
inline |
Definition at line 404 of file DataLayout.h.
References isNonIntegralPointerType().
|
inline |
Definition at line 232 of file DataLayout.h.
References Other.
|
inline |
Definition at line 213 of file DataLayout.h.
References DL.
bool DataLayout::operator== | ( | const DataLayout & | Other | ) | const |
Definition at line 540 of file DataLayout.cpp.
References Other, and llvm::MipsISD::Ret.
|
static |
Parse a data layout string and return the layout.
Return an error description on failure.
Definition at line 207 of file DataLayout.cpp.
void DataLayout::reset | ( | StringRef | LayoutDescription | ) |
Parse a data layout string (with fallback to default values).
Definition at line 180 of file DataLayout.cpp.
References llvm::SmallVectorImpl< T >::clear(), DefaultAlignments, E, Independent, and llvm::Optional< T >::reset().
Referenced by DataLayout(), and llvm::Module::setDataLayout().
|
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 494 of file DataLayout.h.
References getTypeSizeInBits(), and getTypeStoreSizeInBits().