llvm-extra-0.10: Utility functions for the llvm interface

Safe HaskellNone

LLVM.Extra.Marshal

Description

Transfer values between Haskell and JIT generated code in an LLVM-compatible format. E.g. Bool is stored as i1 and occupies a byte, Vector n Bool is stored as a bit vector, Vector n Word8 is stored in an order depending on machine endianess, and Haskell tuples are stored as LLVM structs.

Documentation

class (Value a, C (ValueOf a), Marshal (Struct a), IsSized (Struct a)) => C a whereSource

Methods

pack :: a -> Struct aSource

unpack :: Struct a -> aSource

Instances

C Bool 
C Double 
C Float 
C Int 
C Int8 
C Int16 
C Int32 
C Int64 
C Word 
C Word8 
C Word16 
C Word32 
C Word64 
C () 
C (StablePtr a) 
Storable a => C (Ptr a) 
IsFunction a => C (FunPtr a) 
IsType a => C (Ptr a) 
(IsSized (Struct a), IsSized (Struct b), C a, C b) => C (a, b) 
(Positive n, Natural (:*: n (SizeOf a)), Vector n a) => C (Vector n a) 
(IsSized (Struct a), IsSized (Struct b), IsSized (Struct c), C a, C b, C c) => C (a, b, c) 
(IsSized (Struct a), IsSized (Struct b), IsSized (Struct c), IsSized (Struct d), C a, C b, C c, C d) => C (a, b, c, d) 

peek :: (C a, Struct a ~ struct, Marshal struct) => Ptr struct -> IO aSource

poke :: (C a, Struct a ~ struct, Marshal struct) => Ptr struct -> a -> IO ()Source

class (C a, C a) => MV a Source

Instances

MV Double 
MV Float 
MV Int 
MV Int8 
MV Int16 
MV Int32 
MV Int64 
MV Word 
MV Word8 
MV Word16 
MV Word32 
MV Word64 
MV () 
MV (StablePtr a) 
Storable a => MV (Ptr a) 
IsFunction a => MV (FunPtr a) 
IsType a => MV (Ptr a) 
(IsSized (Struct a), IsSized (Struct b), MV a, MV b) => MV (a, b) 
(IsSized (Struct a), IsSized (Struct b), IsSized (Struct c), MV a, MV b, MV c) => MV (a, b, c) 
(IsSized (Struct a), IsSized (Struct b), IsSized (Struct c), IsSized (Struct d), MV a, MV b, MV c, MV d) => MV (a, b, c, d) 

class (Positive n, VectorValue n a, C (VectorValueOf n a), Marshal (VectorStruct n a), IsSized (VectorStruct n a)) => Vector n a whereSource

Methods

packVector :: Vector n a -> VectorStruct n aSource

unpackVector :: VectorStruct n a -> Vector n aSource

Instances

(Positive n, Natural (:*: n D64)) => Vector n Int64 
(Positive n, Natural (:*: n D32)) => Vector n Int32 
(Positive n, Natural (:*: n D16)) => Vector n Int16 
(Positive n, Natural (:*: n D8)) => Vector n Int8 
(Positive n, Natural (:*: n IntSize)) => Vector n Int 
(Positive n, Natural (:*: n D64)) => Vector n Word64 
(Positive n, Natural (:*: n D32)) => Vector n Word32 
(Positive n, Natural (:*: n D16)) => Vector n Word16 
(Positive n, Natural (:*: n D8)) => Vector n Word8 
(Positive n, Natural (:*: n IntSize)) => Vector n Word 
(Positive n, Natural (:*: n D64)) => Vector n Double 
(Positive n, Natural (:*: n D32)) => Vector n Float 
(Positive n, Natural (:*: n D1)) => Vector n Bool 
(Vector n a, Vector n b) => Vector n (a, b) 
(Vector n a, Vector n b, Vector n c) => Vector n (a, b, c) 

with :: C a => a -> (Ptr (Struct a) -> IO b) -> IO bSource

alloca :: IsType a => (Ptr a -> IO b) -> IO b