Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- class (Phi llvmValue, Undefined llvmValue, IsType (Struct llvmValue), IsSized (Struct llvmValue)) => C llvmValue where
- modify :: C llvmValue => (llvmValue -> CodeGenFunction r llvmValue) -> Value (Ptr (Struct llvmValue)) -> CodeGenFunction r ()
- type family Struct llvmValue
- type Record r o v = Element r o v v
- data Element r o v x
- 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 x
- loadRecord :: Record r o llvmValue -> Value (Ptr o) -> CodeGenFunction r llvmValue
- storeRecord :: Record r o llvmValue -> llvmValue -> Value (Ptr o) -> CodeGenFunction r ()
- decomposeRecord :: Record r o llvmValue -> Value o -> CodeGenFunction r llvmValue
- composeRecord :: IsType o => Record r o llvmValue -> llvmValue -> CodeGenFunction r (Value o)
- loadNewtype :: C a => (a -> llvmValue) -> Value (Ptr (Struct a)) -> CodeGenFunction r llvmValue
- storeNewtype :: C a => (llvmValue -> a) -> llvmValue -> Value (Ptr (Struct a)) -> CodeGenFunction r ()
- decomposeNewtype :: C a => (a -> llvmValue) -> Value (Struct a) -> CodeGenFunction r llvmValue
- composeNewtype :: C a => (llvmValue -> a) -> llvmValue -> CodeGenFunction r (Value (Struct a))
Documentation
class (Phi llvmValue, Undefined llvmValue, IsType (Struct llvmValue), IsSized (Struct llvmValue)) => C llvmValue where Source #
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.
load :: Value (Ptr (Struct llvmValue)) -> CodeGenFunction r llvmValue Source #
store :: llvmValue -> Value (Ptr (Struct llvmValue)) -> CodeGenFunction r () Source #
decompose :: Value (Struct llvmValue) -> CodeGenFunction r llvmValue Source #
In principle it holds:
decompose struct = do ptr <- LLVM.alloca LLVM.store struct ptr Memory.load ptr
but alloca
will blast your stack when used in a loop.
compose :: llvmValue -> CodeGenFunction r (Value (Struct llvmValue)) Source #
In principle it holds:
compose struct = do ptr <- LLVM.alloca Memory.store struct ptr LLVM.load ptr
but alloca
will blast your stack when used in a loop.
Instances
C () Source # | |
Defined in LLVM.Extra.Memory | |
C a => C (Complex a) Source # | |
Defined in LLVM.Extra.Memory load :: Value (Ptr (Struct (Complex a))) -> CodeGenFunction r (Complex a) Source # store :: Complex a -> Value (Ptr (Struct (Complex a))) -> CodeGenFunction r () Source # decompose :: Value (Struct (Complex a)) -> CodeGenFunction r (Complex a) Source # compose :: Complex a -> CodeGenFunction r (Value (Struct (Complex a))) Source # | |
IsSized a => C (Value a) Source # | |
Defined in LLVM.Extra.Memory load :: Value (Ptr (Struct (Value a))) -> CodeGenFunction r (Value a) Source # store :: Value a -> Value (Ptr (Struct (Value a))) -> CodeGenFunction r () Source # decompose :: Value (Struct (Value a)) -> CodeGenFunction r (Value a) Source # compose :: Value a -> CodeGenFunction r (Value (Struct (Value a))) Source # | |
C a => C (T a) Source # | |
Defined in LLVM.Extra.Memory | |
(Phi s, Undefined s, StructFields (StructStruct s), ConvertStruct (StructStruct s) D0 s) => C (T s) Source # | |
Defined in LLVM.Extra.Memory | |
C a => C (T a) Source # | |
Defined in LLVM.Extra.Memory | |
(IsType (Struct (Repr a)), IsSized (Struct (Repr a)), C a, C (Repr a)) => C (T a) Source # | |
Defined in LLVM.Extra.Memory | |
(C a, C b) => C (a, b) Source # | |
Defined in LLVM.Extra.Memory | |
(Natural n, C a, Natural (FromUnary n), Natural (FromUnary n :*: SizeOf (Struct a)), IsFirstClass (Struct a)) => C (T n a) Source # | |
Defined in LLVM.Extra.Memory | |
(C a, C b) => C (T a b) Source # | |
Defined in LLVM.Extra.Memory | |
(IsType (Struct (Repr n a)), IsSized (Struct (Repr n a)), Positive n, C a, C (Repr n a)) => C (T n a) Source # | |
Defined in LLVM.Extra.Memory | |
(C a, C b, C c) => C (a, b, c) Source # | |
Defined in LLVM.Extra.Memory load :: Value (Ptr (Struct (a, b, c))) -> CodeGenFunction r (a, b, c) Source # store :: (a, b, c) -> Value (Ptr (Struct (a, b, c))) -> CodeGenFunction r () Source # decompose :: Value (Struct (a, b, c)) -> CodeGenFunction r (a, b, c) Source # compose :: (a, b, c) -> CodeGenFunction r (Value (Struct (a, b, c))) Source # | |
(C a, C b, C c, C d) => C (a, b, c, d) Source # | |
Defined in LLVM.Extra.Memory load :: Value (Ptr (Struct (a, b, c, d))) -> CodeGenFunction r (a, b, c, d) Source # store :: (a, b, c, d) -> Value (Ptr (Struct (a, b, c, d))) -> CodeGenFunction r () Source # decompose :: Value (Struct (a, b, c, d)) -> CodeGenFunction r (a, b, c, d) Source # compose :: (a, b, c, d) -> CodeGenFunction r (Value (Struct (a, b, c, d))) Source # |
modify :: C llvmValue => (llvmValue -> CodeGenFunction r llvmValue) -> Value (Ptr (Struct llvmValue)) -> CodeGenFunction r () Source #
type family Struct llvmValue Source #
Instances
type Struct () Source # | |
Defined in LLVM.Extra.Memory type Struct () = Struct () | |
type Struct (Complex a) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (Value a) Source # | |
Defined in LLVM.Extra.Memory type Struct (Value a) = a | |
type Struct (T a) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (T s) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (T a) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (T a) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (a, b) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (T n a) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (T a b) Source # | |
type Struct (T n a) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (a, b, c) Source # | |
Defined in LLVM.Extra.Memory | |
type Struct (a, b, c, d) Source # | |
Instances
Functor (Element r o v) Source # | |
Applicative (Element r o v) Source # | |
Defined in LLVM.Extra.Memory pure :: a -> Element r o v a # (<*>) :: Element r o v (a -> b) -> Element r o v a -> Element r o v b # liftA2 :: (a -> b -> c) -> Element r o v a -> Element r o v b -> Element r o v c # (*>) :: Element r o v a -> Element r o v b -> Element r o v b # (<*) :: Element r o v a -> Element r o v b -> Element r o v a # |
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 x Source #
loadRecord :: Record r o llvmValue -> Value (Ptr o) -> CodeGenFunction r llvmValue Source #
storeRecord :: Record r o llvmValue -> llvmValue -> Value (Ptr o) -> CodeGenFunction r () Source #
decomposeRecord :: Record r o llvmValue -> Value o -> CodeGenFunction r llvmValue Source #
composeRecord :: IsType o => Record r o llvmValue -> llvmValue -> CodeGenFunction r (Value o) Source #
loadNewtype :: C a => (a -> llvmValue) -> Value (Ptr (Struct a)) -> CodeGenFunction r llvmValue Source #
storeNewtype :: C a => (llvmValue -> a) -> llvmValue -> Value (Ptr (Struct a)) -> CodeGenFunction r () Source #
decomposeNewtype :: C a => (a -> llvmValue) -> Value (Struct a) -> CodeGenFunction r llvmValue Source #
composeNewtype :: C a => (llvmValue -> a) -> llvmValue -> CodeGenFunction r (Value (Struct a)) Source #