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

Safe HaskellNone

LLVM.Extra.Memory

Synopsis

Documentation

class (Phi llvmValue, Undefined llvmValue, IsType (Struct llvmValue), IsSized (Struct llvmValue)) => C llvmValue whereSource

An implementation of both MakeValueTuple and C must ensure that haskellValue is compatible with Stored (Struct haskellValue) (which we want to call llvmStruct). That is, writing and reading llvmStruct by LLVM must be the same as accessing haskellValue by Storable methods. ToDo: In future we may also require Storable constraint for llvmStruct.

We use a functional dependency in order to let type inference work nicely.

Associated Types

type Struct llvmValue :: *Source

Methods

load :: Value (Ptr (Struct llvmValue)) -> CodeGenFunction r llvmValueSource

store :: llvmValue -> Value (Ptr (Struct llvmValue)) -> CodeGenFunction r ()Source

decompose :: Value (Struct llvmValue) -> CodeGenFunction r llvmValueSource

compose :: llvmValue -> CodeGenFunction r (Value (Struct llvmValue))Source

Instances

C () 
(FirstClass a, IsSized (Stored a)) => C (Value a) 
C a => C (T a) 
C a => C (T a) 
C a => C (T a) 
(C a, C b) => C (a, b) 
(C a, C b) => C (T a b) 
C n a => C (T n a) 
(C a, C b, C c) => C (a, b, c) 

modify :: C llvmValue => (llvmValue -> CodeGenFunction r llvmValue) -> Value (Ptr (Struct llvmValue)) -> CodeGenFunction r ()Source

castStorablePtr :: (MakeValueTuple haskellValue, C (ValueTuple haskellValue)) => Ptr haskellValue -> Ptr (Struct (ValueTuple haskellValue))Source

type Record r o v = Element r o v vSource

data Element r o v x Source

Instances

Functor (Element r o v) 
Applicative (Element r o v) 

element :: (C x, GetValue o n, ValueType o n ~ Struct x, GetElementPtr o (n, ()), ElementPtrType o (n, ()) ~ Struct x) => (v -> x) -> n -> Element r o v xSource

loadRecord :: Record r o llvmValue -> Value (Ptr o) -> CodeGenFunction r llvmValueSource

storeRecord :: Record r o llvmValue -> llvmValue -> Value (Ptr o) -> CodeGenFunction r ()Source

decomposeRecord :: Record r o llvmValue -> Value o -> CodeGenFunction r llvmValueSource

composeRecord :: IsType o => Record r o llvmValue -> llvmValue -> CodeGenFunction r (Value o)Source

loadNewtype :: C a => (a -> llvmValue) -> Value (Ptr (Struct a)) -> CodeGenFunction r llvmValueSource

storeNewtype :: C a => (llvmValue -> a) -> llvmValue -> Value (Ptr (Struct a)) -> CodeGenFunction r ()Source

decomposeNewtype :: C a => (a -> llvmValue) -> Value (Struct a) -> CodeGenFunction r llvmValueSource

composeNewtype :: C a => (llvmValue -> a) -> llvmValue -> CodeGenFunction r (Value (Struct a))Source