crucible-llvm-0.6: Support for translating and executing LLVM code in Crucible
Copyright(c) Galois Inc 2011-2016
LicenseBSD3
MaintainerRob Dockins <rdockins@galois.com>
Stabilityprovisional
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lang.Crucible.LLVM.DataLayout

Description

 
Synopsis

Alignments

data Alignment Source #

An Alignment represents a number of bytes that must be a power of two.

noAlignment :: Alignment Source #

1-byte alignment, which is the minimum possible.

padToAlignment :: Bytes -> Alignment -> Bytes Source #

padToAlignment x a returns the smallest value greater than or equal to x that is aligned to a.

toAlignment :: Bytes -> Maybe Alignment Source #

Convert a number of bytes into an alignment, if it is a power of 2.

fromAlignment :: Alignment -> Bytes Source #

Convert an alignment to a number of bytes.

exponentToAlignment :: Natural -> Alignment Source #

Convert an exponent n to an alignment of 2^n bytes.

Data layout declarations.

data EndianForm Source #

Flags byte orientation of target machine.

Constructors

BigEndian 
LittleEndian 

maxAlignment :: DataLayout -> Alignment Source #

Maximum alignment for any type (used by malloc).

ptrSize :: Lens' DataLayout Bytes Source #

Size of pointers in bytes.

ptrAlign :: Lens' DataLayout Alignment Source #

ABI pointer alignment in bytes.

defaultDataLayout :: DataLayout Source #

The default data layout if no spec is defined. From the LLVM Language Reference: "When constructing the data layout for a given target, LLVM starts with a default set of specifications which are then (possibly) overridden by the specifications in the datalayout keyword." http://llvm.org/docs/LangRef.html#langref-datalayout

parseDataLayout :: DataLayout -> DataLayout Source #

Create parsed data layout from layout spec AST.

integerAlignment :: DataLayout -> Natural -> Alignment Source #

Get alignment for the integer type of the specified bitwidth, using LLVM's rules for integer types: "If no match is found, and the type sought is an integer type, then the smallest integer type that is larger than the bitwidth of the sought type is used. If none of the specifications are larger than the bitwidth then the largest integer type is used." http://llvm.org/docs/LangRef.html#langref-datalayout

vectorAlignment :: DataLayout -> Natural -> Alignment Source #

Get alignment for a vector type of the specified bitwidth, using LLVM's rules for vector types: "If no match is found, and the type sought is a vector type, then the largest vector type that is smaller than the sought vector type will be used as a fall back." http://llvm.org/docs/LangRef.html#langref-datalayout

floatAlignment :: DataLayout -> Natural -> Maybe Alignment Source #

Get alignment for a float type of the specified bitwidth.

aggregateAlignment :: DataLayout -> Alignment Source #

Get the basic alignment for aggregate types.

intWidthSize :: Natural -> Bytes Source #

The size of an integer of the given bitwidth, in bytes.