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

Safe HaskellNone




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

An implementation of both Value 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


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


C () 
(IsSized a, IsFirstClass a) => C (Value a) 
C a => C (T a) 
C a => C (T a) 
(C a, C (ValueOf a)) => C (T a) 
(C a, C b) => C (a, b) 
(Natural n, C a, Natural (FromUnary n), Natural (:*: (FromUnary n) (SizeOf (Struct a))), IsFirstClass (Struct a)) => C (T n a) 
(C a, C b) => C (T a b) 
(Positive n, C a, C (VectorValueOf n a)) => C (T n a) 
(C a, C b, C c) => C (a, b, c) 
(C a, C b, C c, C d) => C (a, b, c, d) 

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

type Record r o v = Element r o v vSource

data Element r o v x Source


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