LLVM API Documentation
#include <TargetData.h>


Public Member Functions | |
| TargetData () | |
| TargetData (const std::string &TargetDescription) | |
| Constructs a TargetData from a specification string. See init(). | |
| TargetData (const Module *M) | |
| Initialize target data from properties stored in the module. | |
| TargetData (const TargetData &TD) | |
| ~TargetData () | |
| void | init (const std::string &TargetDescription) |
| Parse a target data layout string and initialize TargetData alignments. | |
| bool | isLittleEndian () const |
| Target endianness... | |
| bool | isBigEndian () const |
| std::string | getStringRepresentation () const |
| unsigned char | getPointerABIAlignment () const |
| Target pointer alignment. | |
| unsigned char | getPointerPrefAlignment () const |
| Return target's alignment for stack-based pointers. | |
| unsigned char | getPointerSize () const |
| Target pointer size. | |
| unsigned char | getPointerSizeInBits () const |
| Target pointer size, in bits. | |
| uint64_t | getTypeSizeInBits (const Type *Ty) const |
| uint64_t | getTypeStoreSize (const Type *Ty) const |
| uint64_t | getTypeStoreSizeInBits (const Type *Ty) const |
| uint64_t | getABITypeSize (const Type *Ty) const |
| uint64_t | getABITypeSizeInBits (const Type *Ty) const |
| unsigned char | getABITypeAlignment (const Type *Ty) const |
| unsigned char | getCallFrameTypeAlignment (const Type *Ty) const |
| unsigned char | getPrefTypeAlignment (const Type *Ty) const |
| unsigned char | getPreferredTypeAlignmentShift (const Type *Ty) const |
| const Type * | getIntPtrType () const |
| uint64_t | getIndexedOffset (const Type *Ty, Value *const *Indices, unsigned NumIndices) const |
| const StructLayout * | getStructLayout (const StructType *Ty) const |
| void | InvalidateStructLayoutInfo (const StructType *Ty) const |
| unsigned | getPreferredAlignment (const GlobalVariable *GV) const |
| unsigned | getPreferredAlignmentLog (const GlobalVariable *GV) const |
Static Public Member Functions | |
| template<typename UIntTy> | |
| static UIntTy | RoundUpAlignment (UIntTy Val, unsigned Alignment) |
Static Public Attributes | |
| static char | ID = 0 |
Definition at line 66 of file TargetData.h.
| llvm::TargetData::TargetData | ( | ) | [inline] |
Default ctor.
Definition at line 112 of file TargetData.h.
| llvm::TargetData::TargetData | ( | const std::string & | TargetDescription | ) | [inline, explicit] |
Constructs a TargetData from a specification string. See init().
Definition at line 119 of file TargetData.h.
References init().
| TargetData::TargetData | ( | const Module * | M | ) | [explicit] |
Initialize target data from properties stored in the module.
Definition at line 235 of file TargetData.cpp.
References llvm::Module::getDataLayout(), and init().
| llvm::TargetData::TargetData | ( | const TargetData & | TD | ) | [inline] |
Definition at line 127 of file TargetData.h.
| TargetData::~TargetData | ( | ) |
Definition at line 349 of file TargetData.cpp.
References llvm::DenseMap< KeyT, ValueT, KeyInfoT, ValueInfoT >::begin(), E, llvm::DenseMap< KeyT, ValueT, KeyInfoT, ValueInfoT >::end(), llvm::DenseMap< KeyT, ValueT, KeyInfoT, ValueInfoT >::erase(), I, llvm::ManagedStaticBase::isConstructed(), and TheMap.
| void TargetData::init | ( | const std::string & | TargetDescription | ) |
Parse a target data layout string and initialize TargetData alignments.
A TargetDescription string consists of a sequence of hyphen-delimited specifiers for target endianness, pointer size and alignments, and various primitive type sizes and alignments. A typical string looks something like:
"E-p:32:32:32-i1:8:8-i8:8:8-i32:32:32-i64:32:64-f32:32:32-f64:32:64"
(note: this string is not fully specified and is only an example.) Alignments come in two flavors: ABI and preferred. ABI alignment (abi_align, below) dictates how a type will be aligned within an aggregate and when used as an argument. Preferred alignment (pref_align, below) determines a type's alignment when emitted as a global. Specifier string details:
[E|e]: Endianness. "E" specifies a big-endian target data model, "e" specifies a little-endian target data model.
p:<size>:<abi_align>:<pref_align>
<type><size>:<abi_align>:<pref_align>
The default string, fully specified is:
"E-p:64:64:64-a0:0:0-f32:32:32-f64:0:64" "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:0:64" "-v64:64:64-v128:128:128"
Note that in the case of aggregates, 0 is the default ABI and preferred alignment. This is a special case, where the aggregate's computed worst-case alignment will be used.
Definition at line 170 of file TargetData.cpp.
References llvm::AGGREGATE_ALIGN, llvm::FLOAT_ALIGN, llvm::getToken(), llvm::INTEGER_ALIGN, llvm::STACK_ALIGN, and llvm::VECTOR_ALIGN.
Referenced by TargetData().
| bool llvm::TargetData::isLittleEndian | ( | ) | const [inline] |
Target endianness...
Definition at line 142 of file TargetData.h.
Referenced by llvm::ELFWriter::ELFWriter(), FoldBitCast(), InstCombineLoadCast(), llvm::MachOCodeEmitter::MachOCodeEmitter(), llvm::MachOWriter::MachOWriter(), llvm::TargetLowering::SimplifySetCC(), llvm::ELFCodeEmitter::startFunction(), llvm::ExecutionEngine::StoreValueToMemory(), and llvm::TargetLowering::TargetLowering().
| bool llvm::TargetData::isBigEndian | ( | ) | const [inline] |
Definition at line 143 of file TargetData.h.
Referenced by llvm::AsmPrinter::EmitInt64(), and llvm::MachOWriter::InitMem().
| std::string TargetData::getStringRepresentation | ( | ) | const |
getStringRepresentation - Return the string representation of the TargetData. This representation is in the same format accepted by the string constructor above.
Definition at line 402 of file TargetData.cpp.
References I, llvm::itostr(), and llvm::utostr().
| unsigned char llvm::TargetData::getPointerABIAlignment | ( | ) | const [inline] |
| unsigned char llvm::TargetData::getPointerPrefAlignment | ( | ) | const [inline] |
| unsigned char llvm::TargetData::getPointerSize | ( | ) | const [inline] |
Target pointer size.
Definition at line 154 of file TargetData.h.
Referenced by CreateArgv(), llvm::X86RegisterInfo::emitFrameMoves(), llvm::X86TargetLowering::getReturnAddressFrameIndex(), llvm::MachOWriter::InitMem(), and llvm::AsmPrinter::printDataDirective().
| unsigned char llvm::TargetData::getPointerSizeInBits | ( | ) | const [inline] |
Target pointer size, in bits.
Definition at line 156 of file TargetData.h.
Referenced by llvm::ConstantFoldInstOperands(), llvm::ELFWriter::ELFWriter(), EmitGEPOffset(), EvaluateGEPOffsetExpression(), llvm::ExecutionEngine::getConstantValue(), getIntPtrType(), getTypeSizeInBits(), lle_X_sprintf(), llvm::MachOCodeEmitter::MachOCodeEmitter(), llvm::MachOWriter::MachOWriter(), and llvm::ELFCodeEmitter::startFunction().
| uint64_t TargetData::getTypeSizeInBits | ( | const Type * | Ty | ) | const |
getTypeSizeInBits - Return the number of bits necessary to hold the specified type. For example, returns 36 for i36 and 80 for x86_fp80.
Definition at line 420 of file TargetData.cpp.
References llvm::Type::ArrayTyID, llvm::Type::DoubleTyID, llvm::Type::FloatTyID, llvm::Type::FP128TyID, getABITypeSizeInBits(), llvm::SequentialType::getElementType(), llvm::ArrayType::getNumElements(), getPointerSizeInBits(), llvm::StructLayout::getSizeInBits(), getStructLayout(), llvm::Type::getTypeID(), llvm::Type::IntegerTyID, llvm::Type::isSized(), llvm::Type::LabelTyID, llvm::Type::PointerTyID, llvm::Type::PPC_FP128TyID, llvm::Type::StructTyID, llvm::Type::VectorTyID, llvm::Type::VoidTyID, and llvm::Type::X86_FP80TyID.
Referenced by llvm::ComputeMaskedBits(), llvm::SDISelAsmOperandInfo::getCallOperandValMVT(), getPreferredAlignment(), getTypeStoreSize(), and HasPadding().
| uint64_t llvm::TargetData::getTypeStoreSize | ( | const Type * | Ty | ) | const [inline] |
getTypeStoreSize - Return 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 165 of file TargetData.h.
References getTypeSizeInBits().
Referenced by llvm::AliasSetTracker::add(), getABITypeSize(), llvm::MemoryDependenceAnalysis::getDependency(), llvm::AliasAnalysis::getModRefInfo(), llvm::MemoryDependenceAnalysis::getNonLocalPointerDependency(), getTypeStoreSizeInBits(), llvm::InlineFunction(), llvm::ExecutionEngine::LoadValueFromMemory(), llvm::AliasSetTracker::remove(), llvm::EscapeAnalysis::runOnFunction(), and llvm::ExecutionEngine::StoreValueToMemory().
| uint64_t llvm::TargetData::getTypeStoreSizeInBits | ( | const Type * | Ty | ) | const [inline] |
getTypeStoreSizeInBits - Return the maximum number of bits that may be overwritten by storing the specified type; always a multiple of 8. For example, returns 40 for i36 and 80 for x86_fp80.
Definition at line 172 of file TargetData.h.
References getTypeStoreSize().
Referenced by llvm::FindAvailableLoadedValue().
| uint64_t llvm::TargetData::getABITypeSize | ( | const Type * | Ty | ) | const [inline] |
getABITypeSize - Return 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 180 of file TargetData.h.
References getABITypeAlignment(), getTypeStoreSize(), and RoundUpAlignment().
Referenced by calculateFunctionInfo(), ComputeValueVTs(), llvm::MachOCodeEmitter::emitConstantPool(), llvm::AsmPrinter::EmitConstantPool(), llvm::AsmPrinter::EmitConstantValueOnly(), EmitGEPOffset(), llvm::AsmPrinter::EmitGlobalConstant(), llvm::ExecutionEngine::EmitGlobalVariable(), EvaluateGEPOffsetExpression(), llvm::Interpreter::executeGEPOperation(), getABITypeSizeInBits(), llvm::MachineConstantPool::getConstantPoolIndex(), GetConstantPoolSizeInBytes(), getIndexedOffset(), llvm::JIT::getMemoryForGV(), llvm::ExecutionEngine::getMemoryForGV(), GetOffsetFromIndex(), llvm::JIT::getOrEmitGlobalVariable(), llvm::ExecutionEngine::InitializeMemory(), llvm::MachOWriter::InitMem(), IsConstantOffsetFromGlobal(), isObjectSmallerThan(), isSafeToEliminateVarargsCast(), llvm::TargetLowering::LowerArguments(), llvm::TargetLowering::LowerCallTo(), llvm::XCoreTargetAsmInfo::MergeableConstSection(), llvm::ELFTargetAsmInfo::MergeableConstSection(), llvm::DarwinTargetAsmInfo::MergeableConstSection(), llvm::ELFTargetAsmInfo::MergeableStringSection(), llvm::DarwinTargetAsmInfo::MergeableStringSection(), llvm::X86ATTAsmPrinter::printModuleLevelGV(), llvm::MipsTargetAsmInfo::SectionKindForGlobal(), llvm::FunctionLoweringInfo::set(), SRAGlobal(), TryToOptimizeStoreOfMallocToGlobal(), and llvm::Interpreter::visitAllocationInst().
| uint64_t llvm::TargetData::getABITypeSizeInBits | ( | const Type * | Ty | ) | const [inline] |
getABITypeSizeInBits - Return 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 189 of file TargetData.h.
References getABITypeSize().
Referenced by llvm::AsmPrinter::EmitConstantValueOnly(), getTypeSizeInBits(), and HasPadding().
getABITypeAlignment - Return the minimum ABI-required alignment for the specified type.
Definition at line 514 of file TargetData.cpp.
Referenced by getABITypeSize(), llvm::X86TargetLowering::getByValTypeAlignment(), getCallFrameTypeAlignment(), llvm::TargetLowering::LowerArguments(), llvm::TargetLowering::LowerCallTo(), MeetsMaxMemopRequirement(), and SRAGlobal().
getCallFrameTypeAlignment - Return the minimum ABI-required alignment for the specified type when it is part of a call frame.
Definition at line 518 of file TargetData.cpp.
References getABITypeAlignment(), and llvm::STACK_ALIGN.
Referenced by llvm::TargetLowering::getByValTypeAlignment().
getPrefTypeAlignment - Return the preferred stack/global alignment for the specified type. This is always at least as good as the ABI alignment.
Definition at line 526 of file TargetData.cpp.
Referenced by llvm::ComputeMaskedBits(), llvm::SelectionDAG::CreateStackTemporary(), getPreferredAlignment(), getPreferredTypeAlignmentShift(), llvm::InlineFunction(), llvm::ELFTargetAsmInfo::MergeableStringSection(), llvm::FunctionLoweringInfo::set(), and llvm::MachOCodeEmitter::startFunction().
getPreferredTypeAlignmentShift - Return the preferred alignment for the specified type, returned as log2 of the value (a shift amount).
Definition at line 530 of file TargetData.cpp.
References getPrefTypeAlignment(), and llvm::Log2_32().
Referenced by llvm::SelectionDAG::getConstantPool().
| const Type * TargetData::getIntPtrType | ( | ) | const |
getIntPtrType - Return an unsigned integer type that is the same size or greater to the host pointer size.
getIntPtrType - Return an unsigned integer type that is the same size or greater to the host pointer size.
Definition at line 538 of file TargetData.cpp.
References llvm::IntegerType::get(), and getPointerSizeInBits().
Referenced by llvm::IntrinsicLowering::AddPrototypes(), llvm::ConstantFoldCompareInstOperands(), llvm::AsmPrinter::EmitConstantValueOnly(), EmitGEPOffset(), EvaluateGEPOffsetExpression(), llvm::SelectionDAG::getMemcpy(), llvm::SelectionDAG::getMemmove(), llvm::SelectionDAG::getMemset(), llvm::FastISel::getRegForValue(), llvm::TargetLowering::getSetCCResultType(), isEliminableCastPair(), llvm::IntrinsicLowering::LowerIntrinsicCall(), MergeInType(), SymbolicallyEvaluateGEP(), and llvm::TargetLowering::TargetLowering().
| uint64_t TargetData::getIndexedOffset | ( | const Type * | Ty, | |
| Value *const * | Indices, | |||
| unsigned | NumIndices | |||
| ) | const |
getIndexedOffset - return the offset from the beginning of the type for the specified indices. This is used to implement getelementptr.
Definition at line 543 of file TargetData.cpp.
References llvm::gep_type_begin(), getABITypeSize(), llvm::StructLayout::getElementOffset(), getStructLayout(), llvm::Intrinsic::getType(), and llvm::Type::Int32Ty.
Referenced by llvm::AsmPrinter::EmitConstantValueOnly(), llvm::ExecutionEngine::getConstantValue(), llvm::MachOWriter::InitMem(), and SymbolicallyEvaluateGEP().
| const StructLayout * TargetData::getStructLayout | ( | const StructType * | Ty | ) | const |
getStructLayout - Return 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 366 of file TargetData.cpp.
References llvm::StructType::getNumElements(), L, and TheMap.
Referenced by ComputeValueVTs(), EmitGEPOffset(), EvaluateGEPOffsetExpression(), llvm::Interpreter::executeGEPOperation(), getIndexedOffset(), GetOffsetFromIndex(), getTypeSizeInBits(), HasPadding(), llvm::ExecutionEngine::InitializeMemory(), llvm::MachOWriter::InitMem(), IsConstantOffsetFromGlobal(), and SRAGlobal().
| void TargetData::InvalidateStructLayoutInfo | ( | const StructType * | Ty | ) | const |
InvalidateStructLayoutInfo - TargetData speculatively caches StructLayout objects. If a TargetData object is alive when types are being refined and removed, this method must be called whenever a StructType is removed to avoid a dangling pointer in this cache.
InvalidateStructLayoutInfo - TargetData speculatively caches StructLayout objects. If a TargetData object is alive when types are being refined and removed, this method must be called whenever a StructType is removed to avoid a dangling pointer in this cache.
Definition at line 390 of file TargetData.cpp.
References I, and llvm::ManagedStaticBase::isConstructed().
| unsigned TargetData::getPreferredAlignment | ( | const GlobalVariable * | GV | ) | const |
getPreferredAlignment - Return the preferred alignment of the specified global. This includes an explicitly requested alignment (if the global has one).
getPreferredAlignment - Return the preferred alignment of the specified global. This includes an explicitly requested alignment (if the global has one).
Definition at line 581 of file TargetData.cpp.
References Alignment, llvm::GlobalValue::getAlignment(), llvm::SequentialType::getElementType(), getPrefTypeAlignment(), llvm::GlobalValue::getType(), getTypeSizeInBits(), and llvm::GlobalVariable::hasInitializer().
Referenced by llvm::JIT::getOrEmitGlobalVariable(), getPreferredAlignmentLog(), and llvm::DarwinTargetAsmInfo::MergeableStringSection().
| unsigned TargetData::getPreferredAlignmentLog | ( | const GlobalVariable * | GV | ) | const |
getPreferredAlignmentLog - Return the preferred alignment of the specified global, returned in log form. This includes an explicitly requested alignment (if the global has one).
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 601 of file TargetData.cpp.
References getPreferredAlignment(), and llvm::Log2_32().
Referenced by llvm::X86IntelAsmPrinter::doFinalization(), and llvm::X86ATTAsmPrinter::printModuleLevelGV().
| static UIntTy llvm::TargetData::RoundUpAlignment | ( | UIntTy | Val, | |
| unsigned | Alignment | |||
| ) | [inline, static] |
RoundUpAlignment - Round the specified value up to the next alignment boundary specified by Alignment. For example, 7 rounded up to an alignment boundary of 4 is 8. 8 rounded up to the alignment boundary of 4 is 8 because it is already aligned.
Definition at line 248 of file TargetData.h.
Referenced by getABITypeSize().
char TargetData::ID = 0 [static] |
Definition at line 253 of file TargetData.h.
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.