TargetData
public class TargetData
A TargetData encapsulates information about the data requirements of a
particular target architecture and can be used to retrieve information about
sizes and offsets of types with respect to this target.
-
Creates a Target Data object from an
LLVMTargetDataRefobject.Declaration
Swift
public init(llvm: LLVMTargetDataRef) -
Declaration
Swift
public func offsetOfElement(at index: Int, type: StructType) -> IntParameters
typeThe type of the structure to compute the offset with.
Return Value
The offset of the given element within the structure.
-
Declaration
Swift
public func elementAtOffset(_ offset: Int, type: StructType) -> IntParameters
typeThe type of the structure to compute the offset with.
Return Value
The offset of the given element within the structure.
-
Computes the number of bits necessary to hold a value of the given type for this target environment.
Declaration
Swift
public func sizeOfTypeInBits(_ type: IRType) -> IntParameters
typeThe type to compute the size of.
Return Value
The size of the type in bits.
-
Computes the minimum ABI-required number of bits necessary to hold a value of the given type for this target environment.
Declaration
Swift
public func abiSizeOfType(_ type: IRType) -> IntParameters
typeThe type to compute the size of.
Return Value
The minimum ABI-required size of the type in bytes.
-
The current platform byte order, either big or little endian.
Declaration
Swift
public var byteOrder: ByteOrder -
Creates a string representation of the target data.
Declaration
Swift
public var layoutString: String -
The integer type that is the same size as a pointer on this target. This is analoguous to the
intptr_ttype in C++. - parameters: - context: The context in which to derive the type (optional). - addressSpace: The address space in which to derive the type. - returns: An IntegerType that is the same size as the pointer type on this target.Declaration
Parameters
contextThe context in which to derive the type (optional).
addressSpaceThe address space in which to derive the type.
Return Value
An IntegerType that is the same size as the pointer type on this target.
-
Computes the preferred alignment of the given global for this target
Declaration
Swift
public func preferredAlignment(of global: Global) -> IntParameters
globalThe global variable
Return Value
The variable’s preferred alignment in this target
-
Computes the preferred alignment of the given type for this target
Declaration
Swift
public func preferredAlignment(of type: IRType) -> IntParameters
typeThe type for which you’re computing the alignment
Return Value
The type’s preferred alignment in this target
-
Computes the minimum ABI-required alignment for the specified type.
Declaration
Swift
public func abiAlignment(of type: IRType) -> IntParameters
typeThe type to whose ABI alignment you wish to compute.
Return Value
The minimum ABI-required alignment for the specified type.
-
Computes the minimum ABI-required alignment for the specified type.
This function is equivalent to
TargetData.abiAlignment(of:).Declaration
Swift
public func callFrameAlignment(of type: IRType) -> IntParameters
typeThe type to whose ABI alignment you wish to compute.
Return Value
The minimum ABI-required alignment for the specified type.
-
Computes the ABI size of a type in bytes for a target.
Declaration
Swift
public func abiSize(of type: IRType) -> IntParameters
typeThe type to whose ABI size you wish to compute.
Return Value
The ABI size for the specified type.
-
Computes the maximum number of bytes that may be overwritten by storing the specified type.
Declaration
Swift
public func storeSize(of type: IRType) -> IntParameters
typeThe type to whose store size you wish to compute.
Return Value
The store size of the type in the given target.
-
Computes the pointer size for the platform, optionally in a given address space.
Declaration
Swift
public func pointerSize(addressSpace: Int? = nil) -> IntParameters
addressSpaceThe address space in which to compute pointer size.
Return Value
The size of a pointer in the target address space.
TargetData Class Reference