-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Utility functions for the llvm interface -- -- The Low-Level Virtual-Machine is a compiler back-end with optimizer. -- You may also call it a high-level portable assembler. This package -- provides various utility functions for the Haskell interface to LLVM, -- for example: -- -- @package llvm-extra @version 0.11 -- | Alternative to defineFunction that creates the final ret -- instruction for you. module LLVM.Extra.Function -- |
--   CodeGen (a->b->...-> IO z) =
--      Value a -> Value b -> ... CodeGenFunction r (Value z)@.
--   
class FunctionArgs f => C f type family CodeGen f define :: C f => Function f -> CodeGen f -> CodeGenModule () create :: C f => Linkage -> CodeGen f -> CodeGenModule (Function f) createNamed :: C f => Linkage -> String -> CodeGen f -> CodeGenModule (Function f) class (IsFirstClass a) => Return a type family Result a ret :: Return a => Result a -> CodeGenFunction a () instance LLVM.Extra.Function.Return a => LLVM.Extra.Function.C (GHC.Types.IO a) instance LLVM.Extra.Function.Return () instance LLVM.Extra.Function.Return GHC.Types.Bool instance LLVM.Extra.Function.Return GHC.Types.Int instance LLVM.Extra.Function.Return GHC.Int.Int8 instance LLVM.Extra.Function.Return GHC.Int.Int16 instance LLVM.Extra.Function.Return GHC.Int.Int32 instance LLVM.Extra.Function.Return GHC.Int.Int64 instance LLVM.Extra.Function.Return GHC.Types.Word instance LLVM.Extra.Function.Return GHC.Word.Word8 instance LLVM.Extra.Function.Return GHC.Word.Word16 instance LLVM.Extra.Function.Return GHC.Word.Word32 instance LLVM.Extra.Function.Return GHC.Word.Word64 instance LLVM.Extra.Function.Return GHC.Types.Float instance LLVM.Extra.Function.Return GHC.Types.Double instance LLVM.Extra.Function.Return (GHC.Ptr.Ptr a) instance LLVM.Core.Type.IsType a => LLVM.Extra.Function.Return (LLVM.Core.Data.Ptr a) instance LLVM.Core.Type.IsFunction a => LLVM.Extra.Function.Return (GHC.Ptr.FunPtr a) instance LLVM.Extra.Function.Return (GHC.Stable.StablePtr a) instance (LLVM.Extra.Function.C b, LLVM.Core.Type.IsFirstClass a) => LLVM.Extra.Function.C (a -> b) -- | These functions work in arbitrary monads but are especially helpful -- when working with the CodeGenFunction monad. -- | Deprecated: use utility-ht:Control.Monad.HT module LLVM.Extra.Monad chain :: Monad m => [a -> m a] -> a -> m a liftR2 :: Monad m => (a -> b -> m c) -> m a -> m b -> m c liftR3 :: Monad m => (a -> b -> c -> m d) -> m a -> m b -> m c -> m d -- | Useful control structures additionally to those in -- LLVM.Util.Loop. module LLVM.Extra.Control arrayLoop :: (Phi a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr b) -> a -> (Value (Ptr b) -> a -> CodeGenFunction r a) -> CodeGenFunction r a arrayLoop2 :: (Phi s, IsType a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> CodeGenFunction r s) -> CodeGenFunction r s arrayLoopWithExit :: (Phi s, IsType a, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr a) -> s -> (Value (Ptr a) -> s -> CodeGenFunction r (Value Bool, s)) -> CodeGenFunction r (Value i, s) arrayLoop2WithExit :: (Phi s, IsType a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> CodeGenFunction r (Value Bool, s)) -> CodeGenFunction r (Value i, s) fixedLengthLoop :: (Phi s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> s -> (s -> CodeGenFunction r s) -> CodeGenFunction r s whileLoop :: Phi a => a -> (a -> CodeGenFunction r (Value Bool)) -> (a -> CodeGenFunction r a) -> CodeGenFunction r a -- | This is a variant of whileLoop that may be more convient, -- because you only need one lambda expression for both loop condition -- and loop body. whileLoopShared :: Phi a => a -> (a -> (CodeGenFunction r (Value Bool), CodeGenFunction r a)) -> CodeGenFunction r a -- | This is a loop with a single point for exit from within the loop. The -- Bool value indicates whether the loop shall be continued. loopWithExit :: Phi a => a -> (a -> CodeGenFunction r (Value Bool, b)) -> (b -> CodeGenFunction r a) -> CodeGenFunction r b -- | This construct starts new blocks, so be prepared when continueing -- after an ifThenElse. ifThenElse :: Phi a => Value Bool -> CodeGenFunction r a -> CodeGenFunction r a -> CodeGenFunction r a ifThen :: Phi a => Value Bool -> a -> CodeGenFunction r a -> CodeGenFunction r a class Phi a => Select a select :: Select a => Value Bool -> a -> a -> CodeGenFunction r a selectTraversable :: (Select a, Traversable f, Applicative f) => Value Bool -> f a -> f a -> CodeGenFunction r (f a) -- | Branch-free variant of ifThen that is faster if the enclosed -- block is very simply, say, if it contains at most two instructions. It -- can only be used as alternative to ifThen if the enclosed block -- is free of side effects. ifThenSelect :: Select a => Value Bool -> a -> CodeGenFunction r a -> CodeGenFunction r a -- | ret terminates a basic block which interferes badly with other -- control structures in this module. If you use the control structures -- then better use LLVM.Extra.Function. ret :: Value a -> CodeGenFunction a () retVoid :: CodeGenFunction () () instance (LLVM.Core.Instructions.CmpRet a, LLVM.Core.Type.IsPrimitive a) => LLVM.Extra.Control.Select (LLVM.Core.CodeGen.Value a) instance LLVM.Extra.Control.Select () instance (LLVM.Extra.Control.Select a, LLVM.Extra.Control.Select b) => LLVM.Extra.Control.Select (a, b) instance (LLVM.Extra.Control.Select a, LLVM.Extra.Control.Select b, LLVM.Extra.Control.Select c) => LLVM.Extra.Control.Select (a, b, c) module LLVM.Extra.Tuple class Phi a phi :: Phi a => BasicBlock -> a -> CodeGenFunction r a addPhi :: Phi a => BasicBlock -> a -> a -> CodeGenFunction r () phiTraversable :: (Phi a, Traversable f) => BasicBlock -> f a -> CodeGenFunction r (f a) addPhiFoldable :: (Phi a, Foldable f, Applicative f) => BasicBlock -> f a -> f a -> CodeGenFunction r () class Undefined a undef :: Undefined a => a undefPointed :: (Undefined a, Applicative f) => f a class Zero a zero :: Zero a => a zeroPointed :: (Zero a, Applicative f) => f a class (Undefined (ValueOf a)) => Value a where { type family ValueOf a; } valueOf :: Value a => a -> ValueOf a valueOfFunctor :: (Value h, Functor f) => f h -> f (ValueOf h) class (Positive n, Undefined (VectorValueOf n a)) => VectorValue n a where { type family VectorValueOf n a; } vectorValueOf :: VectorValue n a => Vector n a -> VectorValueOf n a instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Tuple.VectorValue n a, LLVM.Extra.TuplePrivate.Undefined (LLVM.Extra.Tuple.VectorValueOf n a)) => LLVM.Extra.Tuple.Value (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Positive m, Type.Data.Num.Decimal.Number.Positive (n Type.Data.Num.Decimal.Number.:*: m), LLVM.Extra.TuplePrivate.Undefined (LLVM.Core.Data.Vector (n Type.Data.Num.Decimal.Number.:*: m) a)) => LLVM.Extra.Tuple.VectorValue n (LLVM.Core.Data.Vector m a) instance (LLVM.Extra.Tuple.VectorValue n a, LLVM.Extra.Tuple.VectorValue n b) => LLVM.Extra.Tuple.VectorValue n (a, b) instance (LLVM.Extra.Tuple.VectorValue n a, LLVM.Extra.Tuple.VectorValue n b, LLVM.Extra.Tuple.VectorValue n c) => LLVM.Extra.Tuple.VectorValue n (a, b, c) instance LLVM.Extra.Tuple.VectorValue n tuple => LLVM.Extra.Tuple.VectorValue n (Foreign.Storable.Record.Tuple.Tuple tuple) instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Types.Float instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Types.Double instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Types.Bool instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n Data.Bool8.Bool8 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Types.Int instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Int.Int8 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Int.Int16 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Int.Int32 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Int.Int64 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Types.Word instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Word.Word8 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Word.Word16 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Word.Word32 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.VectorValue n GHC.Word.Word64 instance (LLVM.Extra.Tuple.Value a, LLVM.Extra.Tuple.Value b) => LLVM.Extra.Tuple.Value (a, b) instance (LLVM.Extra.Tuple.Value a, LLVM.Extra.Tuple.Value b, LLVM.Extra.Tuple.Value c) => LLVM.Extra.Tuple.Value (a, b, c) instance (LLVM.Extra.Tuple.Value a, LLVM.Extra.Tuple.Value b, LLVM.Extra.Tuple.Value c, LLVM.Extra.Tuple.Value d) => LLVM.Extra.Tuple.Value (a, b, c, d) instance LLVM.Extra.Tuple.Value tuple => LLVM.Extra.Tuple.Value (Foreign.Storable.Record.Tuple.Tuple tuple) instance LLVM.Extra.Tuple.Value a => LLVM.Extra.Tuple.Value (GHC.Maybe.Maybe a) instance (LLVM.Extra.Tuple.Value a, LLVM.Extra.Tuple.Value b) => LLVM.Extra.Tuple.Value (Data.Either.Either a b) instance LLVM.Extra.Tuple.Value GHC.Types.Float instance LLVM.Extra.Tuple.Value GHC.Types.Double instance LLVM.Extra.Tuple.Value GHC.Types.Bool instance LLVM.Extra.Tuple.Value Data.Bool8.Bool8 instance LLVM.Extra.Tuple.Value GHC.Types.Int instance LLVM.Extra.Tuple.Value GHC.Int.Int8 instance LLVM.Extra.Tuple.Value GHC.Int.Int16 instance LLVM.Extra.Tuple.Value GHC.Int.Int32 instance LLVM.Extra.Tuple.Value GHC.Int.Int64 instance LLVM.Extra.Tuple.Value GHC.Types.Word instance LLVM.Extra.Tuple.Value GHC.Word.Word8 instance LLVM.Extra.Tuple.Value GHC.Word.Word16 instance LLVM.Extra.Tuple.Value GHC.Word.Word32 instance LLVM.Extra.Tuple.Value GHC.Word.Word64 instance LLVM.Extra.Tuple.Value () instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.Value (LLVM.Core.Data.IntN n) instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Tuple.Value (LLVM.Core.Data.WordN n) instance LLVM.Extra.Tuple.Value (GHC.Ptr.Ptr a) instance LLVM.Core.Type.IsType a => LLVM.Extra.Tuple.Value (LLVM.Core.Data.Ptr a) instance LLVM.Core.Type.IsFunction a => LLVM.Extra.Tuple.Value (GHC.Ptr.FunPtr a) instance LLVM.Extra.Tuple.Value (GHC.Stable.StablePtr a) instance LLVM.Extra.Tuple.Value a => LLVM.Extra.Tuple.Value (Data.Tagged.Tagged tag a) instance (LLVM.Core.Type.IsInteger w, LLVM.Core.CodeGen.IsConst w, GHC.Num.Num w, GHC.Enum.Enum e) => LLVM.Extra.Tuple.Value (Data.Enum.Storable.T w e) instance (LLVM.Core.Type.IsInteger w, LLVM.Core.CodeGen.IsConst w) => LLVM.Extra.Tuple.Value (Data.EnumBitSet.T w i) instance LLVM.Extra.Tuple.Value a => LLVM.Extra.Tuple.Value (Data.Complex.Complex a) -- | In contrast to Struct it allows to store high-level values and -- thus allows to implement arbitrary-sized tuples of MultiValue's. module LLVM.Extra.Struct newtype T struct Cons :: struct -> T struct class Undefined struct undef :: Undefined struct => struct class Zero struct zero :: Zero struct => struct class Phi struct phi :: Phi struct => BasicBlock -> struct -> CodeGenFunction r struct addPhi :: Phi struct => BasicBlock -> struct -> struct -> CodeGenFunction r () class (Undefined (ValueOf struct)) => Value struct where { type family ValueOf struct; } valueOf :: Value struct => struct -> ValueOf struct instance LLVM.Extra.Struct.Value struct => LLVM.Extra.Tuple.Value (LLVM.Extra.Struct.T struct) instance (LLVM.Extra.Tuple.Value a, LLVM.Extra.Struct.Value as) => LLVM.Extra.Struct.Value (a, as) instance LLVM.Extra.Struct.Value () instance LLVM.Extra.Struct.Phi struct => LLVM.Extra.TuplePrivate.Phi (LLVM.Extra.Struct.T struct) instance (LLVM.Extra.TuplePrivate.Phi a, LLVM.Extra.Struct.Phi as) => LLVM.Extra.Struct.Phi (a, as) instance LLVM.Extra.Struct.Phi () instance LLVM.Extra.Struct.Zero struct => LLVM.Extra.TuplePrivate.Zero (LLVM.Extra.Struct.T struct) instance (LLVM.Extra.TuplePrivate.Zero a, LLVM.Extra.Struct.Zero as) => LLVM.Extra.Struct.Zero (a, as) instance LLVM.Extra.Struct.Zero () instance LLVM.Extra.Struct.Undefined struct => LLVM.Extra.TuplePrivate.Undefined (LLVM.Extra.Struct.T struct) instance (LLVM.Extra.TuplePrivate.Undefined a, LLVM.Extra.Struct.Undefined as) => LLVM.Extra.Struct.Undefined (a, as) instance LLVM.Extra.Struct.Undefined () -- | LLVM counterpart to Maybe datatype. module LLVM.Extra.Maybe -- | If isJust = False, then fromJust is an -- undefTuple. data T a Cons :: Value Bool -> a -> T a [isJust] :: T a -> Value Bool [fromJust] :: T a -> a -- | counterpart to maybe run :: Phi b => T a -> CodeGenFunction r b -> (a -> CodeGenFunction r b) -> CodeGenFunction r b for :: T a -> (a -> CodeGenFunction r ()) -> CodeGenFunction r () -- | counterpart to fromMaybe with swapped arguments select :: Select a => T a -> a -> CodeGenFunction r a alternative :: Select a => T a -> T a -> CodeGenFunction r (T a) -- | counterpart to Data.Maybe.HT.toMaybe fromBool :: Value Bool -> a -> T a toBool :: T a -> (Value Bool, a) getIsNothing :: T a -> CodeGenFunction r (Value Bool) just :: a -> T a nothing :: Undefined a => T a sequence :: T (CodeGenFunction r a) -> CodeGenFunction r (T a) traverse :: (a -> CodeGenFunction r b) -> T a -> CodeGenFunction r (T b) lift2 :: (a -> b -> c) -> T a -> T b -> CodeGenFunction r (T c) liftM2 :: (a -> b -> CodeGenFunction r c) -> T a -> T b -> CodeGenFunction r (T c) loopWithExit :: Phi a => a -> (a -> CodeGenFunction r (T c, b)) -> ((c, b) -> CodeGenFunction r a) -> CodeGenFunction r b module LLVM.Extra.Array size :: Natural n => Value (Array n a) -> Int -- | construct an array out of single elements -- -- You must assert that the length of the list matches the array size. -- -- This can be considered the inverse of extractAll. assemble :: (Natural n, IsSized a) => [Value a] -> CodeGenFunction r (Value (Array n a)) -- | provide the elements of an array as a list of individual virtual -- registers -- -- This can be considered the inverse of assemble. extractAll :: (Natural n, IsSized a) => Value (Array n a) -> CodeGenFunction r [Value a] -- | The loop is unrolled, since insertvalue and extractvalue -- expect constant indices. map :: (Natural n, IsSized a, IsSized b) => (Value a -> CodeGenFunction r (Value b)) -> Value (Array n a) -> CodeGenFunction r (Value (Array n b)) -- | LLVM counterpart to Either datatype. module LLVM.Extra.Either -- | If isRight, then fromLeft is an undefTuple. -- If not isRight, then fromRight is an -- undefTuple. I would prefer a union type, but it was -- temporarily removed in LLVM-2.8 and did not return since then. data T a b Cons :: Value Bool -> a -> b -> T a b [isRight] :: T a b -> Value Bool [fromLeft] :: T a b -> a [fromRight] :: T a b -> b -- | counterpart to either run :: Phi c => T a b -> (a -> CodeGenFunction r c) -> (b -> CodeGenFunction r c) -> CodeGenFunction r c getIsLeft :: T a b -> CodeGenFunction r (Value Bool) mapLeft :: (a0 -> a1) -> T a0 b -> T a1 b mapRight :: (b0 -> b1) -> T a b0 -> T a b1 left :: Undefined b => a -> T a b right :: Undefined a => b -> T a b module LLVM.Extra.Vector class (Positive (Size v), Phi v, Undefined v) => Simple v shuffleMatch :: Simple v => ConstValue (Vector (Size v) Word32) -> v -> CodeGenFunction r v extract :: Simple v => Value Word32 -> v -> CodeGenFunction r (Element v) -- | Allow to work on records of vectors as if they are vectors of records. -- This is a reasonable approach for records of different element types -- since processor vectors can only be built from elements of the same -- type. But also, say, for chunked stereo signal this makes sense. In -- this case we would work on Stereo (Value a). -- -- Formerly we used a two-way dependency Vector - (Element, Size). -- Now we have only the dependency Vector -> (Element, Size). This -- means that we need some more type annotations as in -- umul32to64/assemble, on the other hand we can allow multiple vector -- types with respect to the same element type. E.g. we can provide a -- vector type with pair elements where the pair elements are interleaved -- in the vector. class (Simple v) => C v insert :: C v => Value Word32 -> Element v -> v -> CodeGenFunction r v type family Element v type family Size v class (n ~ Size (Construct n a), a ~ Element (Construct n a), C (Construct n a)) => Canonical n a type family Construct n a size :: Positive n => Value (Vector n a) -> Int sizeInTuple :: Simple v => v -> Int -- | Manually assemble a vector of equal values. Better use -- ScalarOrVector.replicate. replicate :: C v => Element v -> CodeGenFunction r v iterate :: C v => (Element v -> CodeGenFunction r (Element v)) -> Element v -> CodeGenFunction r v -- | construct a vector out of single elements -- -- You must assert that the length of the list matches the vector size. -- -- This can be considered the inverse of extractAll. assemble :: C v => [Element v] -> CodeGenFunction r v -- | Manually implement vector shuffling using insertelement and -- extractelement. In contrast to LLVM's built-in instruction it supports -- distinct vector sizes, but it allows only one input vector (or a tuple -- of vectors, but we cannot shuffle between them). For more complex -- shuffling we recommend extractAll and assemble. shuffle :: (C v, C w, Element v ~ Element w) => v -> ConstValue (Vector (Size w) Word32) -> CodeGenFunction r w -- | Rotate one element towards the higher elements. -- -- I don't want to call it rotateLeft or rotateRight, because there is no -- prefered layout for the vector elements. In Intel's instruction manual -- vector elements are indexed like the bits, that is from right to left. -- However, when working with Haskell list and enumeration syntax, the -- start index is left. rotateUp :: Simple v => v -> CodeGenFunction r v rotateDown :: Simple v => v -> CodeGenFunction r v reverse :: Simple v => v -> CodeGenFunction r v shiftUp :: C v => Element v -> v -> CodeGenFunction r (Element v, v) shiftDown :: C v => Element v -> v -> CodeGenFunction r (Element v, v) shiftUpMultiZero :: (C v, Zero (Element v)) => Int -> v -> CodeGenFunction r v shiftDownMultiZero :: (C v, Zero (Element v)) => Int -> v -> CodeGenFunction r v shuffleMatchTraversable :: (Simple v, Traversable f) => ConstValue (Vector (Size v) Word32) -> f v -> CodeGenFunction r (f v) -- | Implement the shuffleMatch method using the methods of the -- C class. shuffleMatchAccess :: C v => ConstValue (Vector (Size v) Word32) -> v -> CodeGenFunction r v shuffleMatchPlain1 :: (Positive n, IsPrimitive a) => Value (Vector n a) -> ConstValue (Vector n Word32) -> CodeGenFunction r (Value (Vector n a)) shuffleMatchPlain2 :: (Positive n, IsPrimitive a) => Value (Vector n a) -> Value (Vector n a) -> ConstValue (Vector n Word32) -> CodeGenFunction r (Value (Vector n a)) insertTraversable :: (C v, Traversable f, Applicative f) => Value Word32 -> f (Element v) -> f v -> CodeGenFunction r (f v) extractTraversable :: (Simple v, Traversable f) => Value Word32 -> f v -> CodeGenFunction r (f (Element v)) -- | provide the elements of a vector as a list of individual virtual -- registers -- -- This can be considered the inverse of assemble. extractAll :: Simple v => v -> CodeGenFunction r [Element v] data Constant n a constant :: Positive n => a -> Constant n a insertChunk :: (C c, C v, Element c ~ Element v) => Int -> c -> v -> CodeGenFunction r v modify :: C v => Value Word32 -> (Element v -> CodeGenFunction r (Element v)) -> v -> CodeGenFunction r v -- | Like LLVM.Util.Loop.mapVector but the loop is unrolled, which is -- faster since it can be packed by the code generator. map :: (C v, C w, Size v ~ Size w) => (Element v -> CodeGenFunction r (Element w)) -> v -> CodeGenFunction r w mapChunks :: (C ca, C cb, Size ca ~ Size cb, C va, C vb, Size va ~ Size vb, Element ca ~ Element va, Element cb ~ Element vb) => (ca -> CodeGenFunction r cb) -> va -> CodeGenFunction r vb zipChunksWith :: (C ca, C cb, C cc, Size ca ~ Size cb, Size cb ~ Size cc, C va, C vb, C vc, Size va ~ Size vb, Size vb ~ Size vc, Element ca ~ Element va, Element cb ~ Element vb, Element cc ~ Element vc) => (ca -> cb -> CodeGenFunction r cc) -> va -> vb -> CodeGenFunction r vc -- | If the target vector type is a native type then the chop operation -- produces no actual machine instruction. (nop) If the vector cannot be -- evenly divided into chunks the last chunk will be padded with -- undefined values. chop :: (C c, C v, Element c ~ Element v) => v -> [CodeGenFunction r c] -- | The target size is determined by the type. If the chunk list provides -- more data, the exceeding data is dropped. If the chunk list provides -- too few data, the target vector is filled with undefined elements. concat :: (C c, C v, Element c ~ Element v) => [c] -> CodeGenFunction r v signedFraction :: (IsFloating a, IsConst a, Real a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) -- | Needs (log n) vector additions cumulate1 :: (IsArithmetic a, IsPrimitive a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) -- | The order of addition is chosen for maximum efficiency. We do not try -- to prevent cancelations. class (IsArithmetic a, IsPrimitive a) => Arithmetic a sum :: (Arithmetic a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value a) -- | The first result value is the sum of all vector elements from 0 to -- div n 2 + 1 and the second result value is the sum of vector -- elements from div n 2 to n-1. n must be at least D2. sumToPair :: (Arithmetic a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value a, Value a) -- | Treat the vector as concatenation of pairs and all these pairs are -- added. Useful for stereo signal processing. n must be at least D2. sumInterleavedToPair :: (Arithmetic a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value a, Value a) cumulate :: (Arithmetic a, Positive n) => Value a -> Value (Vector n a) -> CodeGenFunction r (Value a, Value (Vector n a)) dotProduct :: (Arithmetic a, Positive n) => Value (Vector n a) -> Value (Vector n a) -> CodeGenFunction r (Value a) mul :: (Arithmetic a, Positive n) => Value (Vector n a) -> Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) class (Arithmetic a, CmpRet a, IsPrimitive a, IsConst a) => Real a min :: (Real a, Positive n) => Value (Vector n a) -> Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) max :: (Real a, Positive n) => Value (Vector n a) -> Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) abs :: (Real a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) signum :: (Real a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) truncate :: (Real a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) floor :: (Real a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) fraction :: (Real a, Positive n) => Value (Vector n a) -> CodeGenFunction r (Value (Vector n a)) instance LLVM.Extra.Vector.Real GHC.Types.Float instance LLVM.Extra.Vector.Real GHC.Types.Double instance LLVM.Extra.Vector.Real GHC.Types.Int instance LLVM.Extra.Vector.Real GHC.Int.Int8 instance LLVM.Extra.Vector.Real GHC.Int.Int16 instance LLVM.Extra.Vector.Real GHC.Int.Int32 instance LLVM.Extra.Vector.Real GHC.Int.Int64 instance LLVM.Extra.Vector.Real GHC.Types.Word instance LLVM.Extra.Vector.Real GHC.Word.Word8 instance LLVM.Extra.Vector.Real GHC.Word.Word16 instance LLVM.Extra.Vector.Real GHC.Word.Word32 instance LLVM.Extra.Vector.Real GHC.Word.Word64 instance LLVM.Extra.Vector.Arithmetic GHC.Types.Float instance LLVM.Extra.Vector.Arithmetic GHC.Types.Double instance LLVM.Extra.Vector.Arithmetic GHC.Types.Int instance LLVM.Extra.Vector.Arithmetic GHC.Int.Int8 instance LLVM.Extra.Vector.Arithmetic GHC.Int.Int16 instance LLVM.Extra.Vector.Arithmetic GHC.Int.Int32 instance LLVM.Extra.Vector.Arithmetic GHC.Int.Int64 instance LLVM.Extra.Vector.Arithmetic GHC.Types.Word instance LLVM.Extra.Vector.Arithmetic GHC.Word.Word8 instance LLVM.Extra.Vector.Arithmetic GHC.Word.Word16 instance LLVM.Extra.Vector.Arithmetic GHC.Word.Word32 instance LLVM.Extra.Vector.Arithmetic GHC.Word.Word64 instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Core.Type.IsPrimitive a) => LLVM.Extra.Vector.Canonical n (LLVM.Core.CodeGen.Value a) instance (LLVM.Extra.Vector.Canonical n a0, LLVM.Extra.Vector.Canonical n a1) => LLVM.Extra.Vector.Canonical n (a0, a1) instance (LLVM.Extra.Vector.Canonical n a0, LLVM.Extra.Vector.Canonical n a1, LLVM.Extra.Vector.Canonical n a2) => LLVM.Extra.Vector.Canonical n (a0, a1, a2) instance GHC.Base.Functor (LLVM.Extra.Vector.Constant n) instance GHC.Base.Applicative (LLVM.Extra.Vector.Constant n) instance Data.Foldable.Foldable (LLVM.Extra.Vector.Constant n) instance Data.Traversable.Traversable (LLVM.Extra.Vector.Constant n) instance LLVM.Extra.TuplePrivate.Phi a => LLVM.Extra.TuplePrivate.Phi (LLVM.Extra.Vector.Constant n a) instance LLVM.Extra.TuplePrivate.Undefined a => LLVM.Extra.TuplePrivate.Undefined (LLVM.Extra.Vector.Constant n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.TuplePrivate.Phi a, LLVM.Extra.TuplePrivate.Undefined a) => LLVM.Extra.Vector.Simple (LLVM.Extra.Vector.Constant n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Core.Type.IsPrimitive a) => LLVM.Extra.Vector.C (LLVM.Core.CodeGen.Value (LLVM.Core.Data.Vector n a)) instance (LLVM.Extra.Vector.C v0, LLVM.Extra.Vector.C v1, LLVM.Extra.Vector.Size v0 Data.Type.Equality.~ LLVM.Extra.Vector.Size v1) => LLVM.Extra.Vector.C (v0, v1) instance (LLVM.Extra.Vector.C v0, LLVM.Extra.Vector.C v1, LLVM.Extra.Vector.C v2, LLVM.Extra.Vector.Size v0 Data.Type.Equality.~ LLVM.Extra.Vector.Size v1, LLVM.Extra.Vector.Size v1 Data.Type.Equality.~ LLVM.Extra.Vector.Size v2) => LLVM.Extra.Vector.C (v0, v1, v2) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Core.Type.IsPrimitive a) => LLVM.Extra.Vector.Simple (LLVM.Core.CodeGen.Value (LLVM.Core.Data.Vector n a)) instance (LLVM.Extra.Vector.Simple v0, LLVM.Extra.Vector.Simple v1, LLVM.Extra.Vector.Size v0 Data.Type.Equality.~ LLVM.Extra.Vector.Size v1) => LLVM.Extra.Vector.Simple (v0, v1) instance (LLVM.Extra.Vector.Simple v0, LLVM.Extra.Vector.Simple v1, LLVM.Extra.Vector.Simple v2, LLVM.Extra.Vector.Size v0 Data.Type.Equality.~ LLVM.Extra.Vector.Size v1, LLVM.Extra.Vector.Size v1 Data.Type.Equality.~ LLVM.Extra.Vector.Size v2) => LLVM.Extra.Vector.Simple (v0, v1, v2) -- | Support for unified handling of scalars and vectors. -- -- Attention: The rounding and fraction functions only work for floating -- point values with maximum magnitude of maxBound :: Int32. -- This way we save expensive handling of possibly seldom cases. module LLVM.Extra.ScalarOrVector class (Real a, IsFloating a) => Fraction a truncate :: Fraction a => Value a -> CodeGenFunction r (Value a) fraction :: Fraction a => Value a -> CodeGenFunction r (Value a) -- | The fraction has the same sign as the argument. This is not particular -- useful but fast on IEEE implementations. signedFraction :: Fraction a => Value a -> CodeGenFunction r (Value a) -- | increment (first operand) may be negative, phase must always be -- non-negative addToPhase :: Fraction a => Value a -> Value a -> CodeGenFunction r (Value a) -- | both increment and phase must be non-negative incPhase :: Fraction a => Value a -> Value a -> CodeGenFunction r (Value a) truncateToInt :: (IsFloating a, IsInteger i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i) floorToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i) ceilingToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i) -- | Rounds to the next integer. For numbers of the form n+0.5, we -- choose one of the neighboured integers such that the overall -- implementation is most efficient. roundToIntFast :: (IsFloating a, RationalConstant a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i) splitFractionToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i, Value a) type family Scalar vector :: Type class Replicate vector replicate :: Replicate vector => Value (Scalar vector) -> CodeGenFunction r (Value vector) replicateConst :: Replicate vector => ConstValue (Scalar vector) -> ConstValue vector replicateOf :: (IsConst (Scalar v), Replicate v) => Scalar v -> Value v class (IsArithmetic a) => Real a min :: Real a => Value a -> Value a -> CodeGenFunction r (Value a) max :: Real a => Value a -> Value a -> CodeGenFunction r (Value a) abs :: Real a => Value a -> CodeGenFunction r (Value a) signum :: Real a => Value a -> CodeGenFunction r (Value a) class (IsInteger a) => Saturated a addSat :: Saturated a => Value a -> Value a -> CodeGenFunction r (Value a) subSat :: Saturated a => Value a -> Value a -> CodeGenFunction r (Value a) class (IsArithmetic (Scalar v), IsArithmetic v) => PseudoModule v scale :: (PseudoModule v, a ~ Scalar v) => Value a -> Value v -> CodeGenFunction r (Value v) scaleConst :: (PseudoModule v, a ~ Scalar v) => ConstValue a -> ConstValue v -> CodeGenFunction r (ConstValue v) class (IsConst a) => IntegerConstant a constFromInteger :: IntegerConstant a => Integer -> ConstValue a class (IntegerConstant a) => RationalConstant a constFromRational :: RationalConstant a => Rational -> ConstValue a class (RationalConstant a) => TranscendentalConstant a constPi :: TranscendentalConstant a => ConstValue a instance LLVM.Extra.ScalarOrVector.TranscendentalConstant GHC.Types.Float instance LLVM.Extra.ScalarOrVector.TranscendentalConstant GHC.Types.Double instance (LLVM.Extra.ScalarOrVector.TranscendentalConstant a, LLVM.Core.Type.IsPrimitive a, Type.Data.Num.Decimal.Number.Positive n) => LLVM.Extra.ScalarOrVector.TranscendentalConstant (LLVM.Core.Data.Vector n a) instance LLVM.Extra.ScalarOrVector.RationalConstant GHC.Types.Float instance LLVM.Extra.ScalarOrVector.RationalConstant GHC.Types.Double instance (LLVM.Extra.ScalarOrVector.RationalConstant a, LLVM.Core.Type.IsPrimitive a, Type.Data.Num.Decimal.Number.Positive n) => LLVM.Extra.ScalarOrVector.RationalConstant (LLVM.Core.Data.Vector n a) instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Types.Word instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Word.Word8 instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Word.Word16 instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Word.Word32 instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Word.Word64 instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Types.Int instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Int.Int8 instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Int.Int16 instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Int.Int32 instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Int.Int64 instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Types.Float instance LLVM.Extra.ScalarOrVector.IntegerConstant GHC.Types.Double instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.ScalarOrVector.IntegerConstant (LLVM.Core.Data.WordN n) instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.ScalarOrVector.IntegerConstant (LLVM.Core.Data.IntN n) instance (LLVM.Extra.ScalarOrVector.IntegerConstant a, LLVM.Core.Type.IsPrimitive a, Type.Data.Num.Decimal.Number.Positive n) => LLVM.Extra.ScalarOrVector.IntegerConstant (LLVM.Core.Data.Vector n a) instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Types.Word instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Word.Word8 instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Word.Word16 instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Word.Word32 instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Word.Word64 instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Types.Int instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Int.Int8 instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Int.Int16 instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Int.Int32 instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Int.Int64 instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Types.Float instance LLVM.Extra.ScalarOrVector.PseudoModule GHC.Types.Double instance (LLVM.Core.Type.IsArithmetic a, LLVM.Core.Type.IsPrimitive a, Type.Data.Num.Decimal.Number.Positive n) => LLVM.Extra.ScalarOrVector.PseudoModule (LLVM.Core.Data.Vector n a) instance LLVM.Extra.ScalarOrVector.Saturated GHC.Types.Int instance LLVM.Extra.ScalarOrVector.Saturated GHC.Int.Int8 instance LLVM.Extra.ScalarOrVector.Saturated GHC.Int.Int16 instance LLVM.Extra.ScalarOrVector.Saturated GHC.Int.Int32 instance LLVM.Extra.ScalarOrVector.Saturated GHC.Int.Int64 instance LLVM.Extra.ScalarOrVector.Saturated GHC.Types.Word instance LLVM.Extra.ScalarOrVector.Saturated GHC.Word.Word8 instance LLVM.Extra.ScalarOrVector.Saturated GHC.Word.Word16 instance LLVM.Extra.ScalarOrVector.Saturated GHC.Word.Word32 instance LLVM.Extra.ScalarOrVector.Saturated GHC.Word.Word64 instance Type.Data.Num.Decimal.Number.Positive d => LLVM.Extra.ScalarOrVector.Saturated (LLVM.Core.Data.IntN d) instance Type.Data.Num.Decimal.Number.Positive d => LLVM.Extra.ScalarOrVector.Saturated (LLVM.Core.Data.WordN d) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Core.Type.IsPrimitive a, LLVM.Extra.ScalarOrVector.Saturated a, GHC.Enum.Bounded a, LLVM.Core.Instructions.CmpRet a, LLVM.Core.CodeGen.IsConst a) => LLVM.Extra.ScalarOrVector.Saturated (LLVM.Core.Data.Vector n a) instance LLVM.Extra.ScalarOrVector.Fraction GHC.Types.Float instance LLVM.Extra.ScalarOrVector.Fraction GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Vector.Real a, LLVM.Core.Type.IsFloating a, LLVM.Core.CodeGen.IsConst a) => LLVM.Extra.ScalarOrVector.Fraction (LLVM.Core.Data.Vector n a) instance LLVM.Extra.ScalarOrVector.Real GHC.Types.Float instance LLVM.Extra.ScalarOrVector.Real GHC.Types.Double instance LLVM.Extra.ScalarOrVector.Real LLVM.Core.Data.FP128 instance LLVM.Extra.ScalarOrVector.Real GHC.Types.Int instance LLVM.Extra.ScalarOrVector.Real GHC.Int.Int8 instance LLVM.Extra.ScalarOrVector.Real GHC.Int.Int16 instance LLVM.Extra.ScalarOrVector.Real GHC.Int.Int32 instance LLVM.Extra.ScalarOrVector.Real GHC.Int.Int64 instance LLVM.Extra.ScalarOrVector.Real GHC.Types.Word instance LLVM.Extra.ScalarOrVector.Real GHC.Word.Word8 instance LLVM.Extra.ScalarOrVector.Real GHC.Word.Word16 instance LLVM.Extra.ScalarOrVector.Real GHC.Word.Word32 instance LLVM.Extra.ScalarOrVector.Real GHC.Word.Word64 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.ScalarOrVector.Real (LLVM.Core.Data.IntN n) instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.ScalarOrVector.Real (LLVM.Core.Data.WordN n) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Vector.Real a) => LLVM.Extra.ScalarOrVector.Real (LLVM.Core.Data.Vector n a) module LLVM.Extra.Arithmetic -- | This and the following type classes are intended for arithmetic -- operations on wrappers around LLVM types. E.g. you might define a -- fixed point fraction type by -- --
--   newtype Fixed = Fixed Int32
--   
-- -- and then use the same methods for floating point and fixed point -- arithmetic. -- -- In contrast to the arithmetic methods in the llvm wrapper, in -- our methods the types of operands and result match. Advantage: Type -- inference determines most of the types automatically. Disadvantage: -- You cannot use constant values directly, but you have to convert them -- all to Value. class (Zero a) => Additive a zero :: Additive a => a add :: Additive a => a -> a -> CodeGenFunction r a sub :: Additive a => a -> a -> CodeGenFunction r a neg :: Additive a => a -> CodeGenFunction r a one :: IntegerConstant a => a inc :: (IsArithmetic a, IsConst a, Num a) => Value a -> CodeGenFunction r (Value a) dec :: (IsArithmetic a, IsConst a, Num a) => Value a -> CodeGenFunction r (Value a) class (Additive a) => PseudoRing a mul :: PseudoRing a => a -> a -> CodeGenFunction r a square :: PseudoRing a => a -> CodeGenFunction r a type family Scalar vector class (PseudoRing (Scalar v), Additive v) => PseudoModule v scale :: PseudoModule v => Scalar v -> v -> CodeGenFunction r v class (PseudoRing a) => Field a fdiv :: Field a => a -> a -> CodeGenFunction r a class IntegerConstant a fromInteger' :: IntegerConstant a => Integer -> a class (IntegerConstant a) => RationalConstant a fromRational' :: RationalConstant a => Rational -> a -- | In Haskell terms this is a quot. idiv :: IsInteger a => Value a -> Value a -> CodeGenFunction r (Value a) irem :: IsInteger a => Value a -> Value a -> CodeGenFunction r (Value a) class (Comparison a) => FloatingComparison a fcmp :: FloatingComparison a => FPPredicate -> a -> a -> CodeGenFunction r (CmpResult a) class Comparison a cmp :: Comparison a => CmpPredicate -> a -> a -> CodeGenFunction r (CmpResult a) type family CmpResult a data CmpPredicate CmpEQ :: CmpPredicate CmpNE :: CmpPredicate CmpGT :: CmpPredicate CmpGE :: CmpPredicate CmpLT :: CmpPredicate CmpLE :: CmpPredicate class Logic a and :: Logic a => a -> a -> CodeGenFunction r a or :: Logic a => a -> a -> CodeGenFunction r a xor :: Logic a => a -> a -> CodeGenFunction r a inv :: Logic a => a -> CodeGenFunction r a class (Additive a) => Real a min :: Real a => a -> a -> CodeGenFunction r a max :: Real a => a -> a -> CodeGenFunction r a abs :: Real a => a -> CodeGenFunction r a signum :: Real a => a -> CodeGenFunction r a class (Real a) => Fraction a truncate :: Fraction a => a -> CodeGenFunction r a fraction :: Fraction a => a -> CodeGenFunction r a signedFraction :: Fraction a => a -> CodeGenFunction r a addToPhase :: Fraction a => a -> a -> CodeGenFunction r a -- | both increment and phase must be non-negative incPhase :: Fraction a => a -> a -> CodeGenFunction r a advanceArrayElementPtr :: () => Value (Ptr a) -> CodeGenFunction r (Value (Ptr a)) decreaseArrayElementPtr :: () => Value (Ptr a) -> CodeGenFunction r (Value (Ptr a)) class Field a => Algebraic a sqrt :: Algebraic a => a -> CodeGenFunction r a class Algebraic a => Transcendental a pi :: Transcendental a => CodeGenFunction r a sin :: Transcendental a => a -> CodeGenFunction r a cos :: Transcendental a => a -> CodeGenFunction r a exp :: Transcendental a => a -> CodeGenFunction r a log :: Transcendental a => a -> CodeGenFunction r a pow :: Transcendental a => a -> a -> CodeGenFunction r a exp2 :: IsFloating a => Value a -> CodeGenFunction r (Value a) log2 :: IsFloating a => Value a -> CodeGenFunction r (Value a) log10 :: IsFloating a => Value a -> CodeGenFunction r (Value a) instance (LLVM.Core.Type.IsFloating a, LLVM.Extra.ScalarOrVector.TranscendentalConstant a) => LLVM.Extra.Arithmetic.Transcendental (LLVM.Core.CodeGen.Value a) instance LLVM.Core.Type.IsFloating a => LLVM.Extra.Arithmetic.Algebraic (LLVM.Core.CodeGen.Value a) instance LLVM.Core.Type.IsInteger a => LLVM.Extra.Arithmetic.Logic (LLVM.Core.CodeGen.Value a) instance LLVM.Core.Type.IsInteger a => LLVM.Extra.Arithmetic.Logic (LLVM.Core.CodeGen.ConstValue a) instance (LLVM.Core.Type.IsFloating a, LLVM.Core.Instructions.CmpRet a) => LLVM.Extra.Arithmetic.FloatingComparison (LLVM.Core.CodeGen.Value a) instance (LLVM.Core.Type.IsFloating a, LLVM.Core.Instructions.CmpRet a) => LLVM.Extra.Arithmetic.FloatingComparison (LLVM.Core.CodeGen.ConstValue a) instance LLVM.Core.Instructions.CmpRet a => LLVM.Extra.Arithmetic.Comparison (LLVM.Core.CodeGen.Value a) instance LLVM.Core.Instructions.CmpRet a => LLVM.Extra.Arithmetic.Comparison (LLVM.Core.CodeGen.ConstValue a) instance LLVM.Extra.ScalarOrVector.Fraction a => LLVM.Extra.Arithmetic.Fraction (LLVM.Core.CodeGen.Value a) instance LLVM.Extra.ScalarOrVector.Real a => LLVM.Extra.Arithmetic.Real (LLVM.Core.CodeGen.Value a) instance LLVM.Extra.ScalarOrVector.RationalConstant a => LLVM.Extra.Arithmetic.RationalConstant (LLVM.Core.CodeGen.ConstValue a) instance LLVM.Extra.ScalarOrVector.RationalConstant a => LLVM.Extra.Arithmetic.RationalConstant (LLVM.Core.CodeGen.Value a) instance LLVM.Core.Type.IsFloating v => LLVM.Extra.Arithmetic.Field (LLVM.Core.CodeGen.Value v) instance LLVM.Core.Type.IsFloating v => LLVM.Extra.Arithmetic.Field (LLVM.Core.CodeGen.ConstValue v) instance LLVM.Extra.ScalarOrVector.IntegerConstant a => LLVM.Extra.Arithmetic.IntegerConstant (LLVM.Core.CodeGen.ConstValue a) instance LLVM.Extra.ScalarOrVector.IntegerConstant a => LLVM.Extra.Arithmetic.IntegerConstant (LLVM.Core.CodeGen.Value a) instance LLVM.Extra.ScalarOrVector.PseudoModule v => LLVM.Extra.Arithmetic.PseudoModule (LLVM.Core.CodeGen.Value v) instance LLVM.Extra.ScalarOrVector.PseudoModule v => LLVM.Extra.Arithmetic.PseudoModule (LLVM.Core.CodeGen.ConstValue v) instance LLVM.Core.Type.IsArithmetic v => LLVM.Extra.Arithmetic.PseudoRing (LLVM.Core.CodeGen.Value v) instance LLVM.Core.Type.IsArithmetic v => LLVM.Extra.Arithmetic.PseudoRing (LLVM.Core.CodeGen.ConstValue v) instance LLVM.Core.Type.IsArithmetic a => LLVM.Extra.Arithmetic.Additive (LLVM.Core.CodeGen.Value a) instance LLVM.Core.Type.IsArithmetic a => LLVM.Extra.Arithmetic.Additive (LLVM.Core.CodeGen.ConstValue a) instance (LLVM.Extra.Arithmetic.Additive a, LLVM.Extra.Arithmetic.Additive b) => LLVM.Extra.Arithmetic.Additive (a, b) instance (LLVM.Extra.Arithmetic.Additive a, LLVM.Extra.Arithmetic.Additive b, LLVM.Extra.Arithmetic.Additive c) => LLVM.Extra.Arithmetic.Additive (a, b, c) module LLVM.Extra.Scalar -- | The entire purpose of this datatype is to mark a type as scalar, -- although it might also be interpreted as vector. This way you can -- write generic operations for vectors using the PseudoModule -- class, and specialise them to scalar types with respect to the -- PseudoRing class. From another perspective you can consider the -- T type constructor a marker where the Scalar type -- function stops reducing nested vector types to scalar types. newtype T a Cons :: a -> T a [decons] :: T a -> a liftM :: Monad m => (a -> m b) -> T a -> m (T b) liftM2 :: Monad m => (a -> b -> m c) -> T a -> T b -> m (T c) unliftM :: Monad m => (T a -> m (T r)) -> a -> m r unliftM2 :: Monad m => (T a -> T b -> m (T r)) -> a -> b -> m r unliftM3 :: Monad m => (T a -> T b -> T c -> m (T r)) -> a -> b -> c -> m r unliftM4 :: Monad m => (T a -> T b -> T c -> T d -> m (T r)) -> a -> b -> c -> d -> m r unliftM5 :: Monad m => (T a -> T b -> T c -> T d -> T e -> m (T r)) -> a -> b -> c -> d -> e -> m r instance LLVM.Extra.TuplePrivate.Zero a => LLVM.Extra.TuplePrivate.Zero (LLVM.Extra.Scalar.T a) instance LLVM.Extra.TuplePrivate.Undefined a => LLVM.Extra.TuplePrivate.Undefined (LLVM.Extra.Scalar.T a) instance LLVM.Extra.TuplePrivate.Phi a => LLVM.Extra.TuplePrivate.Phi (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.IntegerConstant a => LLVM.Extra.Arithmetic.IntegerConstant (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.RationalConstant a => LLVM.Extra.Arithmetic.RationalConstant (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.Additive a => LLVM.Extra.Arithmetic.Additive (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.PseudoRing a => LLVM.Extra.Arithmetic.PseudoRing (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.Field a => LLVM.Extra.Arithmetic.Field (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.PseudoRing a => LLVM.Extra.Arithmetic.PseudoModule (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.Real a => LLVM.Extra.Arithmetic.Real (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.Fraction a => LLVM.Extra.Arithmetic.Fraction (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.Algebraic a => LLVM.Extra.Arithmetic.Algebraic (LLVM.Extra.Scalar.T a) instance LLVM.Extra.Arithmetic.Transcendental a => LLVM.Extra.Arithmetic.Transcendental (LLVM.Extra.Scalar.T a) module LLVM.Extra.Multi.Vector newtype T n a Cons :: Repr n a -> T n a consPrim :: Repr n a ~ Value n ar => Value n ar -> T n a deconsPrim :: Repr n a ~ Value n ar => T n a -> Value n ar class (C a) => C a where { type family Repr n a; } cons :: (C a, Positive n) => Vector n a -> T n a undef :: (C a, Positive n) => T n a zero :: (C a, Positive n) => T n a phi :: (C a, Positive n) => BasicBlock -> T n a -> CodeGenFunction r (T n a) addPhi :: (C a, Positive n) => BasicBlock -> T n a -> T n a -> CodeGenFunction r () shuffle :: (C a, Positive n, Positive m) => ConstValue (Vector m Word32) -> T n a -> T n a -> CodeGenFunction r (T m a) extract :: (C a, Positive n) => Value Word32 -> T n a -> CodeGenFunction r (T a) insert :: (C a, Positive n) => Value Word32 -> T a -> T n a -> CodeGenFunction r (T n a) type Value n a = Value (Vector n a) map :: (Positive n, C a, C b) => (T a -> CodeGenFunction r (T b)) -> T n a -> CodeGenFunction r (T n b) zip :: T n a -> T n b -> T n (a, b) zip3 :: T n a -> T n b -> T n c -> T n (a, b, c) unzip :: T n (a, b) -> (T n a, T n b) unzip3 :: T n (a, b, c) -> (T n a, T n b, T n c) replicate :: (Positive n, C a) => T a -> CodeGenFunction r (T n a) iterate :: (Positive n, C a) => (T a -> CodeGenFunction r (T a)) -> T a -> CodeGenFunction r (T n a) take :: (Positive n, Positive m, C a) => T n a -> CodeGenFunction r (T m a) takeRev :: (Positive n, Positive m, C a) => T n a -> CodeGenFunction r (T m a) sum :: (Positive n, Additive a) => T n a -> CodeGenFunction r (T a) dotProduct :: (Positive n, PseudoRing a) => T n a -> T n a -> CodeGenFunction r (T a) cumulate :: (Positive n, Additive a) => T a -> T n a -> CodeGenFunction r (T a, T n a) -- | Needs (log n) vector additions cumulate1 :: (Positive n, Additive a) => T n a -> CodeGenFunction r (T n a) lift1 :: (Repr n a -> Repr n b) -> T n a -> T n b modify :: (Positive n, C a) => Value Word32 -> (T a -> CodeGenFunction r (T a)) -> T n a -> CodeGenFunction r (T n a) assemble :: (Positive n, C a) => [T a] -> CodeGenFunction r (T n a) dissect :: (Positive n, C a) => T n a -> CodeGenFunction r [T a] dissectList :: (Positive n, C a) => T n a -> [CodeGenFunction r (T a)] assemble1 :: (Positive n, C a) => T [] (T a) -> CodeGenFunction r (T n a) dissect1 :: (Positive n, C a) => T n a -> CodeGenFunction r (T [] (T a)) dissectList1 :: (Positive n, C a) => T n a -> T [] (CodeGenFunction r (T a)) assembleFromVector :: (Positive n, C a) => Vector n (T a) -> CodeGenFunction r (T n a) reverse :: (Positive n, C a) => T n a -> CodeGenFunction r (T n a) -- | Rotate one element towards the higher elements. -- -- I don't want to call it rotateLeft or rotateRight, because there is no -- prefered layout for the vector elements. In Intel's instruction manual -- vector elements are indexed like the bits, that is from right to left. -- However, when working with Haskell list and enumeration syntax, the -- start index is left. rotateUp :: (Positive n, C a) => T n a -> CodeGenFunction r (T n a) rotateDown :: (Positive n, C a) => T n a -> CodeGenFunction r (T n a) shiftUp :: (Positive n, C a) => T a -> T n a -> CodeGenFunction r (T a, T n a) shiftDown :: (Positive n, C a) => T a -> T n a -> CodeGenFunction r (T a, T n a) shiftUpMultiZero :: (Positive n, C a) => Int -> T n a -> CodeGenFunction r (T n a) shiftDownMultiZero :: (Positive n, C a) => Int -> T n a -> CodeGenFunction r (T n a) shiftUpMultiUndef :: (Positive n, C a) => Int -> T n a -> CodeGenFunction r (T n a) shiftDownMultiUndef :: (Positive n, C a) => Int -> T n a -> CodeGenFunction r (T n a) undefPrimitive :: (Positive n, IsPrimitive al, Repr n a ~ Value n al) => T n a shufflePrimitive :: (Positive n, Positive m, IsPrimitive al, Repr a ~ Value al, Repr n a ~ Value n al, Repr m a ~ Value m al) => ConstValue (Vector m Word32) -> T n a -> T n a -> CodeGenFunction r (T m a) extractPrimitive :: (Positive n, IsPrimitive al, Repr a ~ Value al, Repr n a ~ Value n al) => Value Word32 -> T n a -> CodeGenFunction r (T a) insertPrimitive :: (Positive n, IsPrimitive al, Repr a ~ Value al, Repr n a ~ Value n al) => Value Word32 -> T a -> T n a -> CodeGenFunction r (T n a) shuffleMatchTraversable :: (Positive n, C a, Traversable f) => ConstValue (Vector n Word32) -> f (T n a) -> CodeGenFunction r (f (T n a)) insertTraversable :: (Positive n, C a, Traversable f, Applicative f) => Value Word32 -> f (T a) -> f (T n a) -> CodeGenFunction r (f (T n a)) extractTraversable :: (Positive n, C a, Traversable f) => Value Word32 -> f (T n a) -> CodeGenFunction r (f (T a)) class (IntegerConstant a, C a) => IntegerConstant a fromInteger' :: (IntegerConstant a, Positive n) => Integer -> T n a class (RationalConstant a, IntegerConstant a) => RationalConstant a fromRational' :: (RationalConstant a, Positive n) => Rational -> T n a class (Additive a, C a) => Additive a add :: (Additive a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) sub :: (Additive a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) neg :: (Additive a, Positive n) => T n a -> CodeGenFunction r (T n a) class (PseudoRing a, Additive a) => PseudoRing a mul :: (PseudoRing a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) class (Field a, PseudoRing a) => Field a fdiv :: (Field a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) scale :: (Positive n, PseudoRing a) => T a -> T n a -> CodeGenFunction r (T n a) class (PseudoModule v, PseudoRing (Scalar v), Additive v) => PseudoModule v scaleMulti :: (PseudoModule v, Positive n) => T n (Scalar v) -> T n v -> CodeGenFunction r (T n v) class (Real a, Additive a) => Real a min :: (Real a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) max :: (Real a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) abs :: (Real a, Positive n) => T n a -> CodeGenFunction r (T n a) signum :: (Real a, Positive n) => T n a -> CodeGenFunction r (T n a) class (Fraction a, Real a) => Fraction a truncate :: (Fraction a, Positive n) => T n a -> CodeGenFunction r (T n a) fraction :: (Fraction a, Positive n) => T n a -> CodeGenFunction r (T n a) class (Positive n, Repr n i ~ Value n ir, NativeInteger i ir, IsPrimitive ir, IsInteger ir) => NativeInteger n i ir class (Positive n, Repr n a ~ Value n ar, NativeFloating a ar, IsPrimitive ar, IsFloating ar) => NativeFloating n a ar fromIntegral :: (NativeInteger n i ir, NativeFloating n a ar) => T n i -> CodeGenFunction r (T n a) class (Algebraic a, Field a) => Algebraic a sqrt :: (Algebraic a, Positive n) => T n a -> CodeGenFunction r (T n a) class (Transcendental a, Algebraic a) => Transcendental a pi :: (Transcendental a, Positive n) => CodeGenFunction r (T n a) sin :: (Transcendental a, Positive n) => T n a -> CodeGenFunction r (T n a) cos :: (Transcendental a, Positive n) => T n a -> CodeGenFunction r (T n a) exp :: (Transcendental a, Positive n) => T n a -> CodeGenFunction r (T n a) log :: (Transcendental a, Positive n) => T n a -> CodeGenFunction r (T n a) pow :: (Transcendental a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) class (FloatingComparison a, Comparison a) => FloatingComparison a fcmp :: (FloatingComparison a, Positive n) => FPPredicate -> T n a -> T n a -> CodeGenFunction r (T n Bool) class (Select a, C a) => Select a select :: (Select a, Positive n) => T n Bool -> T n a -> T n a -> CodeGenFunction r (T n a) class (Comparison a, Real a) => Comparison a cmp :: (Comparison a, Positive n) => CmpPredicate -> T n a -> T n a -> CodeGenFunction r (T n Bool) class (Logic a, C a) => Logic a and :: (Logic a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) or :: (Logic a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) xor :: (Logic a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) inv :: (Logic a, Positive n) => T n a -> CodeGenFunction r (T n a) class (BitShift a, C a) => BitShift a shl :: (BitShift a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) shr :: (BitShift a, Positive n) => T n a -> T n a -> CodeGenFunction r (T n a) instance LLVM.Extra.Multi.Vector.BitShift GHC.Types.Word instance LLVM.Extra.Multi.Vector.BitShift GHC.Word.Word8 instance LLVM.Extra.Multi.Vector.BitShift GHC.Word.Word16 instance LLVM.Extra.Multi.Vector.BitShift GHC.Word.Word32 instance LLVM.Extra.Multi.Vector.BitShift GHC.Word.Word64 instance LLVM.Extra.Multi.Vector.BitShift GHC.Types.Int instance LLVM.Extra.Multi.Vector.BitShift GHC.Int.Int8 instance LLVM.Extra.Multi.Vector.BitShift GHC.Int.Int16 instance LLVM.Extra.Multi.Vector.BitShift GHC.Int.Int32 instance LLVM.Extra.Multi.Vector.BitShift GHC.Int.Int64 instance LLVM.Extra.Multi.Vector.Logic GHC.Types.Bool instance LLVM.Extra.Multi.Vector.Logic GHC.Word.Word8 instance LLVM.Extra.Multi.Vector.Logic GHC.Word.Word16 instance LLVM.Extra.Multi.Vector.Logic GHC.Word.Word32 instance LLVM.Extra.Multi.Vector.Logic GHC.Word.Word64 instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Logic a) => LLVM.Extra.Arithmetic.Logic (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.FloatingComparison GHC.Types.Float instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.FloatingComparison a) => LLVM.Extra.Arithmetic.FloatingComparison (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.Comparison GHC.Types.Float instance LLVM.Extra.Multi.Vector.Comparison GHC.Types.Double instance LLVM.Extra.Multi.Vector.Comparison GHC.Types.Word instance LLVM.Extra.Multi.Vector.Comparison GHC.Word.Word8 instance LLVM.Extra.Multi.Vector.Comparison GHC.Word.Word16 instance LLVM.Extra.Multi.Vector.Comparison GHC.Word.Word32 instance LLVM.Extra.Multi.Vector.Comparison GHC.Word.Word64 instance LLVM.Extra.Multi.Vector.Comparison GHC.Types.Int instance LLVM.Extra.Multi.Vector.Comparison GHC.Int.Int8 instance LLVM.Extra.Multi.Vector.Comparison GHC.Int.Int16 instance LLVM.Extra.Multi.Vector.Comparison GHC.Int.Int32 instance LLVM.Extra.Multi.Vector.Comparison GHC.Int.Int64 instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Comparison a) => LLVM.Extra.Arithmetic.Comparison (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.Select GHC.Types.Float instance LLVM.Extra.Multi.Vector.Select GHC.Types.Double instance LLVM.Extra.Multi.Vector.Select GHC.Types.Bool instance LLVM.Extra.Multi.Vector.Select GHC.Types.Word instance LLVM.Extra.Multi.Vector.Select GHC.Word.Word8 instance LLVM.Extra.Multi.Vector.Select GHC.Word.Word16 instance LLVM.Extra.Multi.Vector.Select GHC.Word.Word32 instance LLVM.Extra.Multi.Vector.Select GHC.Word.Word64 instance LLVM.Extra.Multi.Vector.Select GHC.Types.Int instance LLVM.Extra.Multi.Vector.Select GHC.Int.Int8 instance LLVM.Extra.Multi.Vector.Select GHC.Int.Int16 instance LLVM.Extra.Multi.Vector.Select GHC.Int.Int32 instance LLVM.Extra.Multi.Vector.Select GHC.Int.Int64 instance (LLVM.Extra.Multi.Vector.Select a, LLVM.Extra.Multi.Vector.Select b) => LLVM.Extra.Multi.Vector.Select (a, b) instance (LLVM.Extra.Multi.Vector.Select a, LLVM.Extra.Multi.Vector.Select b, LLVM.Extra.Multi.Vector.Select c) => LLVM.Extra.Multi.Vector.Select (a, b, c) instance LLVM.Extra.Multi.Vector.Transcendental GHC.Types.Float instance LLVM.Extra.Multi.Vector.Transcendental GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Transcendental a) => LLVM.Extra.Arithmetic.Transcendental (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.Algebraic GHC.Types.Float instance LLVM.Extra.Multi.Vector.Algebraic GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Algebraic a) => LLVM.Extra.Arithmetic.Algebraic (LLVM.Extra.Multi.Vector.T n a) instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeFloating n GHC.Types.Float GHC.Types.Float instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeFloating n GHC.Types.Double GHC.Types.Double instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Types.Word GHC.Types.Word instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Word.Word8 GHC.Word.Word8 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Word.Word16 GHC.Word.Word16 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Word.Word32 GHC.Word.Word32 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Word.Word64 GHC.Word.Word64 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Types.Int GHC.Types.Int instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Int.Int8 GHC.Int.Int8 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Int.Int16 GHC.Int.Int16 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Int.Int32 GHC.Int.Int32 instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Vector.NativeInteger n GHC.Int.Int64 GHC.Int.Int64 instance LLVM.Extra.Multi.Vector.Fraction GHC.Types.Float instance LLVM.Extra.Multi.Vector.Fraction GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Fraction a) => LLVM.Extra.Arithmetic.Fraction (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.Real GHC.Types.Float instance LLVM.Extra.Multi.Vector.Real GHC.Types.Double instance LLVM.Extra.Multi.Vector.Real GHC.Types.Word instance LLVM.Extra.Multi.Vector.Real GHC.Word.Word8 instance LLVM.Extra.Multi.Vector.Real GHC.Word.Word16 instance LLVM.Extra.Multi.Vector.Real GHC.Word.Word32 instance LLVM.Extra.Multi.Vector.Real GHC.Word.Word64 instance LLVM.Extra.Multi.Vector.Real GHC.Types.Int instance LLVM.Extra.Multi.Vector.Real GHC.Int.Int8 instance LLVM.Extra.Multi.Vector.Real GHC.Int.Int16 instance LLVM.Extra.Multi.Vector.Real GHC.Int.Int32 instance LLVM.Extra.Multi.Vector.Real GHC.Int.Int64 instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Real a) => LLVM.Extra.Arithmetic.Real (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.PseudoModule GHC.Types.Float instance LLVM.Extra.Multi.Vector.PseudoModule GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.PseudoModule a) => LLVM.Extra.Arithmetic.PseudoModule (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.Field GHC.Types.Float instance LLVM.Extra.Multi.Vector.Field GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Field a) => LLVM.Extra.Arithmetic.Field (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.PseudoRing GHC.Types.Float instance LLVM.Extra.Multi.Vector.PseudoRing GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.PseudoRing a) => LLVM.Extra.Arithmetic.PseudoRing (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.Additive GHC.Types.Float instance LLVM.Extra.Multi.Vector.Additive GHC.Types.Double instance LLVM.Extra.Multi.Vector.Additive GHC.Types.Int instance LLVM.Extra.Multi.Vector.Additive GHC.Int.Int8 instance LLVM.Extra.Multi.Vector.Additive GHC.Int.Int16 instance LLVM.Extra.Multi.Vector.Additive GHC.Int.Int32 instance LLVM.Extra.Multi.Vector.Additive GHC.Int.Int64 instance LLVM.Extra.Multi.Vector.Additive GHC.Types.Word instance LLVM.Extra.Multi.Vector.Additive GHC.Word.Word8 instance LLVM.Extra.Multi.Vector.Additive GHC.Word.Word16 instance LLVM.Extra.Multi.Vector.Additive GHC.Word.Word32 instance LLVM.Extra.Multi.Vector.Additive GHC.Word.Word64 instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Additive a) => LLVM.Extra.Arithmetic.Additive (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.RationalConstant GHC.Types.Float instance LLVM.Extra.Multi.Vector.RationalConstant GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.RationalConstant a) => LLVM.Extra.Arithmetic.RationalConstant (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Types.Float instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Types.Double instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Types.Word instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Word.Word8 instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Word.Word16 instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Word.Word32 instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Word.Word64 instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Types.Int instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Int.Int8 instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Int.Int16 instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Int.Int32 instance LLVM.Extra.Multi.Vector.IntegerConstant GHC.Int.Int64 instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.IntegerConstant a) => LLVM.Extra.Arithmetic.IntegerConstant (LLVM.Extra.Multi.Vector.T n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.C a) => LLVM.Extra.TuplePrivate.Undefined (LLVM.Extra.Multi.Vector.T n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.C a) => LLVM.Extra.TuplePrivate.Zero (LLVM.Extra.Multi.Vector.T n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.C a) => LLVM.Extra.TuplePrivate.Phi (LLVM.Extra.Multi.Vector.T n a) instance LLVM.Extra.Multi.Vector.C GHC.Types.Bool instance LLVM.Extra.Multi.Vector.C Data.Bool8.Bool8 instance LLVM.Extra.Multi.Vector.C GHC.Types.Float instance LLVM.Extra.Multi.Vector.C GHC.Types.Double instance LLVM.Extra.Multi.Vector.C GHC.Types.Int instance LLVM.Extra.Multi.Vector.C GHC.Int.Int8 instance LLVM.Extra.Multi.Vector.C GHC.Int.Int16 instance LLVM.Extra.Multi.Vector.C GHC.Int.Int32 instance LLVM.Extra.Multi.Vector.C GHC.Int.Int64 instance LLVM.Extra.Multi.Vector.C GHC.Types.Word instance LLVM.Extra.Multi.Vector.C GHC.Word.Word8 instance LLVM.Extra.Multi.Vector.C GHC.Word.Word16 instance LLVM.Extra.Multi.Vector.C GHC.Word.Word32 instance LLVM.Extra.Multi.Vector.C GHC.Word.Word64 instance (LLVM.Extra.Multi.Vector.C a, LLVM.Extra.Multi.Vector.C b) => LLVM.Extra.Multi.Vector.C (a, b) instance (LLVM.Extra.Multi.Vector.C a, LLVM.Extra.Multi.Vector.C b, LLVM.Extra.Multi.Vector.C c) => LLVM.Extra.Multi.Vector.C (a, b, c) instance LLVM.Extra.Multi.Vector.C tuple => LLVM.Extra.Multi.Vector.C (Foreign.Storable.Record.Tuple.Tuple tuple) module LLVM.Extra.Multi.Vector.Instance type MVVector n a = T (Vector n a) toMultiValue :: T n a -> MVVector n a fromMultiValue :: MVVector n a -> T n a liftMultiValueM :: Functor f => (T n a -> f (T m b)) -> MVVector n a -> f (MVVector m b) liftMultiValueM2 :: Functor f => (T n a -> T m b -> f (T k c)) -> MVVector n a -> MVVector m b -> f (MVVector k c) liftMultiValueM3 :: Functor f => (T n a -> T m b -> T m c -> f (T k d)) -> MVVector n a -> MVVector m b -> MVVector m c -> f (MVVector k d) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.C a) => LLVM.Extra.Multi.Value.Private.C (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.IntegerConstant a) => LLVM.Extra.Multi.Value.Private.IntegerConstant (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.RationalConstant a) => LLVM.Extra.Multi.Value.Private.RationalConstant (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Additive a) => LLVM.Extra.Multi.Value.Private.Additive (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.PseudoRing a) => LLVM.Extra.Multi.Value.Private.PseudoRing (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Real a) => LLVM.Extra.Multi.Value.Private.Real (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Fraction a) => LLVM.Extra.Multi.Value.Private.Fraction (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.Logic a) => LLVM.Extra.Multi.Value.Private.Logic (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.BitShift a) => LLVM.Extra.Multi.Value.Private.BitShift (LLVM.Core.Data.Vector n a) module LLVM.Extra.Multi.Value.Vector cons :: (Positive n, C a) => Vector n a -> MVVector n a fst :: MVVector n (a, b) -> MVVector n a snd :: MVVector n (a, b) -> MVVector n b fst3 :: MVVector n (a, b, c) -> MVVector n a snd3 :: MVVector n (a, b, c) -> MVVector n b thd3 :: MVVector n (a, b, c) -> MVVector n c zip :: MVVector n a -> MVVector n b -> MVVector n (a, b) zip3 :: MVVector n a -> MVVector n b -> MVVector n c -> MVVector n (a, b, c) unzip :: MVVector n (a, b) -> (MVVector n a, MVVector n b) unzip3 :: MVVector n (a, b, c) -> (MVVector n a, MVVector n b, MVVector n c) swap :: MVVector n (a, b) -> MVVector n (b, a) mapFst :: (MVVector n a0 -> MVVector n a1) -> MVVector n (a0, b) -> MVVector n (a1, b) mapSnd :: (MVVector n b0 -> MVVector n b1) -> MVVector n (a, b0) -> MVVector n (a, b1) mapFst3 :: (MVVector n a0 -> MVVector n a1) -> MVVector n (a0, b, c) -> MVVector n (a1, b, c) mapSnd3 :: (MVVector n b0 -> MVVector n b1) -> MVVector n (a, b0, c) -> MVVector n (a, b1, c) mapThd3 :: (MVVector n c0 -> MVVector n c1) -> MVVector n (a, b, c0) -> MVVector n (a, b, c1) extract :: (Positive n, C a) => Value Word32 -> MVVector n a -> CodeGenFunction r (T a) insert :: (Positive n, C a) => Value Word32 -> T a -> MVVector n a -> CodeGenFunction r (MVVector n a) replicate :: (Positive n, C a) => T a -> CodeGenFunction r (MVVector n a) iterate :: (Positive n, C a) => (T a -> CodeGenFunction r (T a)) -> T a -> CodeGenFunction r (MVVector n a) dissect :: (Positive n, C a) => MVVector n a -> CodeGenFunction r [T a] dissect1 :: (Positive n, C a) => MVVector n a -> CodeGenFunction r (T [] (T a)) select :: (Positive n, Select a) => MVVector n Bool -> MVVector n a -> MVVector n a -> CodeGenFunction r (MVVector n a) cmp :: (Positive n, Comparison a) => CmpPredicate -> MVVector n a -> MVVector n a -> CodeGenFunction r (MVVector n Bool) take :: (Positive n, Positive m, C a) => MVVector n a -> CodeGenFunction r (MVVector m a) takeRev :: (Positive n, Positive m, C a) => MVVector n a -> CodeGenFunction r (MVVector m a) class (Repr i ~ Value ir, CmpRet ir, IsInteger ir, IntegerConstant ir) => NativeInteger i ir class (Repr a ~ Value ar, CmpRet ar, RationalConstant ar, IsFloating ar) => NativeFloating a ar fromIntegral :: (NativeInteger i ir, NativeFloating a ar, ShapeOf ir ~ ShapeOf ar) => T i -> CodeGenFunction r (T a) truncateToInt :: (NativeInteger i ir, NativeFloating a ar, ShapeOf ir ~ ShapeOf ar) => T a -> CodeGenFunction r (T i) splitFractionToInt :: (NativeInteger i ir, NativeFloating a ar, ShapeOf ir ~ ShapeOf ar) => T a -> CodeGenFunction r (T (i, a)) instance LLVM.Extra.Multi.Value.Vector.NativeFloating GHC.Types.Float GHC.Types.Float instance LLVM.Extra.Multi.Value.Vector.NativeFloating GHC.Types.Double GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, n Data.Type.Equality.~ m, LLVM.Extra.Multi.Vector.NativeFloating n a ar, LLVM.Extra.Multi.Value.Private.NativeFloating a ar) => LLVM.Extra.Multi.Value.Vector.NativeFloating (LLVM.Core.Data.Vector n a) (LLVM.Core.Data.Vector m ar) instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Types.Word GHC.Types.Word instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Word.Word8 GHC.Word.Word8 instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Word.Word16 GHC.Word.Word16 instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Word.Word32 GHC.Word.Word32 instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Word.Word64 GHC.Word.Word64 instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Types.Int GHC.Types.Int instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Int.Int8 GHC.Int.Int8 instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Int.Int16 GHC.Int.Int16 instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Int.Int32 GHC.Int.Int32 instance LLVM.Extra.Multi.Value.Vector.NativeInteger GHC.Int.Int64 GHC.Int.Int64 instance (Type.Data.Num.Decimal.Number.Positive n, n Data.Type.Equality.~ m, LLVM.Extra.Multi.Vector.NativeInteger n i ir, LLVM.Extra.Multi.Value.Private.NativeInteger i ir) => LLVM.Extra.Multi.Value.Vector.NativeInteger (LLVM.Core.Data.Vector n i) (LLVM.Core.Data.Vector m ir) module LLVM.Extra.Memory -- | 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. class (Phi llvmValue, Undefined llvmValue, IsType (Struct llvmValue), IsSized (Struct llvmValue)) => C llvmValue load :: C llvmValue => Value (Ptr (Struct llvmValue)) -> CodeGenFunction r llvmValue store :: C llvmValue => llvmValue -> Value (Ptr (Struct llvmValue)) -> CodeGenFunction r () -- | 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. decompose :: C llvmValue => Value (Struct llvmValue) -> CodeGenFunction r llvmValue -- | 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. compose :: C llvmValue => llvmValue -> CodeGenFunction r (Value (Struct llvmValue)) 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)) instance (LLVM.Extra.Struct.Phi s, LLVM.Extra.Struct.Undefined s, LLVM.Core.Type.StructFields (LLVM.Extra.Memory.StructStruct s), LLVM.Extra.Memory.ConvertStruct (LLVM.Extra.Memory.StructStruct s) Type.Data.Num.Decimal.Literal.D0 s) => LLVM.Extra.Memory.C (LLVM.Extra.Struct.T s) instance (Type.Data.Num.Decimal.Number.Natural i, LLVM.Core.Instructions.Private.GetField s i, LLVM.Core.Instructions.Private.FieldType s i Data.Type.Equality.~ LLVM.Extra.Memory.Struct a, LLVM.Extra.Memory.C a, LLVM.Extra.Memory.ConvertStruct s (Type.Data.Num.Decimal.Number.Succ i) rem) => LLVM.Extra.Memory.ConvertStruct s i (a, rem) instance LLVM.Core.Type.StructFields s => LLVM.Extra.Memory.ConvertStruct s i () instance GHC.Base.Functor (LLVM.Extra.Memory.Element r o v) instance GHC.Base.Applicative (LLVM.Extra.Memory.Element r o v) instance LLVM.Extra.Memory.C () instance (LLVM.Extra.Memory.C a, LLVM.Extra.Memory.C b) => LLVM.Extra.Memory.C (a, b) instance (LLVM.Extra.Memory.C a, LLVM.Extra.Memory.C b, LLVM.Extra.Memory.C c) => LLVM.Extra.Memory.C (a, b, c) instance (LLVM.Extra.Memory.C a, LLVM.Extra.Memory.C b, LLVM.Extra.Memory.C c, LLVM.Extra.Memory.C d) => LLVM.Extra.Memory.C (a, b, c, d) instance LLVM.Extra.Memory.C a => LLVM.Extra.Memory.C (Data.Complex.Complex a) instance (Type.Data.Num.Unary.Natural n, LLVM.Extra.Memory.C a, Type.Data.Num.Decimal.Number.Natural (Type.Data.Num.Decimal.Number.FromUnary n), Type.Data.Num.Decimal.Number.Natural (Type.Data.Num.Decimal.Number.FromUnary n Type.Data.Num.Decimal.Number.:*: LLVM.Core.Type.SizeOf (LLVM.Extra.Memory.Struct a)), LLVM.Core.Type.IsFirstClass (LLVM.Extra.Memory.Struct a)) => LLVM.Extra.Memory.C (Data.FixedLength.T n a) instance LLVM.Extra.Memory.C a => LLVM.Extra.Memory.C (LLVM.Extra.MaybePrivate.T a) instance (LLVM.Extra.Memory.C a, LLVM.Extra.Memory.C b) => LLVM.Extra.Memory.C (LLVM.Extra.EitherPrivate.T a b) instance LLVM.Extra.Memory.C a => LLVM.Extra.Memory.C (LLVM.Extra.Scalar.T a) instance LLVM.Core.Type.IsSized a => LLVM.Extra.Memory.C (LLVM.Core.CodeGen.Value a) instance (LLVM.Core.Type.IsType (LLVM.Extra.Memory.Struct (LLVM.Extra.Multi.Value.Private.Repr a)), LLVM.Core.Type.IsSized (LLVM.Extra.Memory.Struct (LLVM.Extra.Multi.Value.Private.Repr a)), LLVM.Extra.Multi.Value.Private.C a, LLVM.Extra.Memory.C (LLVM.Extra.Multi.Value.Private.Repr a)) => LLVM.Extra.Memory.C (LLVM.Extra.Multi.Value.Private.T a) instance (LLVM.Core.Type.IsType (LLVM.Extra.Memory.Struct (LLVM.Extra.Multi.Vector.Repr n a)), LLVM.Core.Type.IsSized (LLVM.Extra.Memory.Struct (LLVM.Extra.Multi.Vector.Repr n a)), Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Vector.C a, LLVM.Extra.Memory.C (LLVM.Extra.Multi.Vector.Repr n a)) => LLVM.Extra.Memory.C (LLVM.Extra.Multi.Vector.T n a) -- | 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. module LLVM.Extra.Multi.Value.Marshal class (C a, C (Repr a), Marshal (Struct a), IsConst (Struct a)) => C a pack :: C a => a -> Struct a unpack :: C a => Struct a -> a type Struct a = Struct (Repr a) peek :: (C a, Struct a ~ struct, Marshal struct) => Ptr struct -> IO a poke :: (C a, Struct a ~ struct, Marshal struct) => Ptr struct -> a -> IO () type VectorStruct n a = Struct (Repr n a) class (Positive n, C a, C a, C (Repr n a), Marshal (VectorStruct n a), IsConst (VectorStruct n a)) => Vector n a packVector :: Vector n a => Vector n a -> VectorStruct n a unpackVector :: Vector n a => VectorStruct n a -> Vector n a with :: C a => a -> (Ptr (Struct a) -> IO b) -> IO b alloca :: IsType a => (Ptr a -> IO b) -> IO b instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Value.Marshal.Vector n a) => LLVM.Extra.Multi.Value.Marshal.C (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D1)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Types.Bool instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D32)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Types.Float instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D64)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: LLVM.Core.Type.IntSize)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Types.Word instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D8)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Word.Word8 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D16)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Word.Word16 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D32)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Word.Word32 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D64)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Word.Word64 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: LLVM.Core.Type.IntSize)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Types.Int instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D8)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Int.Int8 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D16)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Int.Int16 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D32)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Int.Int32 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D64)) => LLVM.Extra.Multi.Value.Marshal.Vector n GHC.Int.Int64 instance (LLVM.Extra.Multi.Value.Marshal.Vector n a, LLVM.Extra.Multi.Value.Marshal.Vector n b) => LLVM.Extra.Multi.Value.Marshal.Vector n (a, b) instance (LLVM.Extra.Multi.Value.Marshal.Vector n a, LLVM.Extra.Multi.Value.Marshal.Vector n b, LLVM.Extra.Multi.Value.Marshal.Vector n c) => LLVM.Extra.Multi.Value.Marshal.Vector n (a, b, c) instance LLVM.Extra.Multi.Value.Marshal.C GHC.Types.Bool instance LLVM.Extra.Multi.Value.Marshal.C GHC.Types.Float instance LLVM.Extra.Multi.Value.Marshal.C GHC.Types.Double instance LLVM.Extra.Multi.Value.Marshal.C GHC.Types.Word instance LLVM.Extra.Multi.Value.Marshal.C GHC.Word.Word8 instance LLVM.Extra.Multi.Value.Marshal.C GHC.Word.Word16 instance LLVM.Extra.Multi.Value.Marshal.C GHC.Word.Word32 instance LLVM.Extra.Multi.Value.Marshal.C GHC.Word.Word64 instance LLVM.Extra.Multi.Value.Marshal.C GHC.Types.Int instance LLVM.Extra.Multi.Value.Marshal.C GHC.Int.Int8 instance LLVM.Extra.Multi.Value.Marshal.C GHC.Int.Int16 instance LLVM.Extra.Multi.Value.Marshal.C GHC.Int.Int32 instance LLVM.Extra.Multi.Value.Marshal.C GHC.Int.Int64 instance Foreign.Storable.Storable a => LLVM.Extra.Multi.Value.Marshal.C (GHC.Ptr.Ptr a) instance LLVM.Core.Type.IsType a => LLVM.Extra.Multi.Value.Marshal.C (LLVM.Core.Data.Ptr a) instance LLVM.Core.Type.IsFunction a => LLVM.Extra.Multi.Value.Marshal.C (GHC.Ptr.FunPtr a) instance LLVM.Extra.Multi.Value.Marshal.C (GHC.Stable.StablePtr a) instance LLVM.Extra.Multi.Value.Marshal.C () instance (LLVM.Extra.Multi.Value.Marshal.C a, LLVM.Extra.Multi.Value.Marshal.C b) => LLVM.Extra.Multi.Value.Marshal.C (a, b) instance (LLVM.Extra.Multi.Value.Marshal.C a, LLVM.Extra.Multi.Value.Marshal.C b, LLVM.Extra.Multi.Value.Marshal.C c) => LLVM.Extra.Multi.Value.Marshal.C (a, b, c) instance (LLVM.Extra.Multi.Value.Marshal.C a, LLVM.Extra.Multi.Value.Marshal.C b, LLVM.Extra.Multi.Value.Marshal.C c, LLVM.Extra.Multi.Value.Marshal.C d) => LLVM.Extra.Multi.Value.Marshal.C (a, b, c, d) instance LLVM.Extra.Multi.Value.Marshal.C a => LLVM.Extra.Multi.Value.Marshal.C (Data.Complex.Complex a) module LLVM.Extra.Multi.Value newtype T a Cons :: Repr a -> T a class C a where { type family Repr a; } cons :: C a => a -> T a undef :: C a => T a zero :: C a => T a phi :: C a => BasicBlock -> T a -> CodeGenFunction r (T a) addPhi :: C a => BasicBlock -> T a -> T a -> CodeGenFunction r () cast :: Repr a ~ Repr b => T a -> T b consPrimitive :: (IsConst al, Value al ~ Repr a) => al -> T a undefPrimitive :: (IsType al, Value al ~ Repr a) => T a zeroPrimitive :: (IsType al, Value al ~ Repr a) => T a phiPrimitive :: (IsFirstClass al, Value al ~ Repr a) => BasicBlock -> T a -> CodeGenFunction r (T a) addPhiPrimitive :: (IsFirstClass al, Value al ~ Repr a) => BasicBlock -> T a -> T a -> CodeGenFunction r () consTuple :: (Value a, Repr a ~ ValueOf a) => a -> T a undefTuple :: (Repr a ~ al, Undefined al) => T a zeroTuple :: (Repr a ~ al, Zero al) => T a phiTuple :: (Repr a ~ al, Phi al) => BasicBlock -> T a -> CodeGenFunction r (T a) addPhiTuple :: (Repr a ~ al, Phi al) => BasicBlock -> T a -> T a -> CodeGenFunction r () consUnit :: Repr a ~ () => a -> T a undefUnit :: Repr a ~ () => T a zeroUnit :: Repr a ~ () => T a phiUnit :: Repr a ~ () => BasicBlock -> T a -> CodeGenFunction r (T a) addPhiUnit :: Repr a ~ () => BasicBlock -> T a -> T a -> CodeGenFunction r () boolPFrom8 :: T Bool8 -> T Bool bool8FromP :: T Bool -> T Bool8 intFromBool8 :: NativeInteger i ir => T Bool8 -> CodeGenFunction r (T i) floatFromBool8 :: NativeFloating a ar => T Bool8 -> CodeGenFunction r (T a) toEnum :: Repr w ~ Value w => T w -> T (T w e) fromEnum :: Repr w ~ Value w => T (T w e) -> T w succ :: (IsArithmetic w, IntegerConstant w) => T (T w e) -> CodeGenFunction r (T (T w e)) pred :: (IsArithmetic w, IntegerConstant w) => T (T w e) -> CodeGenFunction r (T (T w e)) cmpEnum :: (CmpRet w, IsPrimitive w) => CmpPredicate -> T (T w a) -> T (T w a) -> CodeGenFunction r (T Bool) class (C a) => Bounded a minBound :: Bounded a => T a maxBound :: Bounded a => T a splitMaybe :: T (Maybe a) -> (T Bool, T a) toMaybe :: T Bool -> T a -> T (Maybe a) nothing :: C a => T (Maybe a) just :: T a -> T (Maybe a) fst :: T (a, b) -> T a snd :: T (a, b) -> T b curry :: (T (a, b) -> c) -> T a -> T b -> c uncurry :: (T a -> T b -> c) -> T (a, b) -> c mapFst :: (T a0 -> T a1) -> T (a0, b) -> T (a1, b) mapSnd :: (T b0 -> T b1) -> T (a, b0) -> T (a, b1) mapFstF :: Functor f => (T a0 -> f (T a1)) -> T (a0, b) -> f (T (a1, b)) mapSndF :: Functor f => (T b0 -> f (T b1)) -> T (a, b0) -> f (T (a, b1)) swap :: T (a, b) -> T (b, a) fst3 :: T (a, b, c) -> T a snd3 :: T (a, b, c) -> T b thd3 :: T (a, b, c) -> T c curry3 :: (T (a, b, c) -> d) -> T a -> T b -> T c -> d uncurry3 :: (T a -> T b -> T c -> d) -> T (a, b, c) -> d mapFst3 :: (T a0 -> T a1) -> T (a0, b, c) -> T (a1, b, c) mapSnd3 :: (T b0 -> T b1) -> T (a, b0, c) -> T (a, b1, c) mapThd3 :: (T c0 -> T c1) -> T (a, b, c0) -> T (a, b, c1) mapFst3F :: Functor f => (T a0 -> f (T a1)) -> T (a0, b, c) -> f (T (a1, b, c)) mapSnd3F :: Functor f => (T b0 -> f (T b1)) -> T (a, b0, c) -> f (T (a, b1, c)) mapThd3F :: Functor f => (T c0 -> f (T c1)) -> T (a, b, c0) -> f (T (a, b, c1)) zip :: T a -> T b -> T (a, b) zip3 :: T a -> T b -> T c -> T (a, b, c) zip4 :: T a -> T b -> T c -> T d -> T (a, b, c, d) unzip :: T (a, b) -> (T a, T b) unzip3 :: T (a, b, c) -> (T a, T b, T c) unzip4 :: T (a, b, c, d) -> (T a, T b, T c, T d) tuple :: T tuple -> T (Tuple tuple) untuple :: T (Tuple tuple) -> T tuple class Struct struct consStruct :: (Struct struct, T struct ~ a) => a -> T a undefStruct :: (Struct struct, T struct ~ a) => T a zeroStruct :: (Struct struct, T struct ~ a) => T a phiStruct :: (Struct struct, T struct ~ a) => BasicBlock -> T a -> CodeGenFunction r (T a) addPhiStruct :: (Struct struct, T struct ~ a) => BasicBlock -> T a -> T a -> CodeGenFunction r () structCons :: T a -> T (T as) -> T (T (a, as)) structUncons :: T (T (a, as)) -> (T a, T (T as)) tag :: T a -> T (Tagged tag a) untag :: T (Tagged tag a) -> T a liftTaggedM :: Monad m => (T a -> m (T b)) -> T (Tagged tag a) -> m (T (Tagged tag b)) liftTaggedM2 :: Monad m => (T a -> T b -> m (T c)) -> T (Tagged tag a) -> T (Tagged tag b) -> m (T (Tagged tag c)) consComplex :: T a -> T a -> T (Complex a) deconsComplex :: T (Complex a) -> (T a, T a) class Compose multituple where { type family Composed multituple; } -- | A nested zip. compose :: Compose multituple => multituple -> T (Composed multituple) class (Composed (Decomposed T pattern) ~ PatternTuple pattern) => Decompose pattern -- | A nested unzip. Since it is not obvious how deep to decompose -- nested tuples, you must provide a pattern of the decomposed tuple. -- E.g. -- --
--   f :: MultiValue ((a,b),(c,d)) ->
--        ((MultiValue a, MultiValue b), MultiValue (c,d))
--   f = decompose ((atom,atom),atom)
--   
decompose :: Decompose pattern => pattern -> T (PatternTuple pattern) -> Decomposed T pattern type family Decomposed (f :: * -> *) pattern type family PatternTuple pattern -- | A combination of compose and decompose that let you -- operate on tuple multivalues as Haskell tuples. modify :: (Compose a, Decompose pattern) => pattern -> (Decomposed T pattern -> a) -> T (PatternTuple pattern) -> T (Composed a) modify2 :: (Compose a, Decompose patternA, Decompose patternB) => patternA -> patternB -> (Decomposed T patternA -> Decomposed T patternB -> a) -> T (PatternTuple patternA) -> T (PatternTuple patternB) -> T (Composed a) modifyF :: (Compose a, Decompose pattern, Functor f) => pattern -> (Decomposed T pattern -> f a) -> T (PatternTuple pattern) -> f (T (Composed a)) modifyF2 :: (Compose a, Decompose patternA, Decompose patternB, Functor f) => patternA -> patternB -> (Decomposed T patternA -> Decomposed T patternB -> f a) -> T (PatternTuple patternA) -> T (PatternTuple patternB) -> f (T (Composed a)) data Atom a Atom :: Atom a atom :: Atom a realPart :: T (Complex a) -> T a imagPart :: T (Complex a) -> T a lift1 :: (Repr a -> Repr b) -> T a -> T b liftM0 :: Monad m => m (Repr a) -> m (T a) liftM :: Monad m => (Repr a -> m (Repr b)) -> T a -> m (T b) liftM2 :: Monad m => (Repr a -> Repr b -> m (Repr c)) -> T a -> T b -> m (T c) liftM3 :: Monad m => (Repr a -> Repr b -> Repr c -> m (Repr d)) -> T a -> T b -> T c -> m (T d) class (C a) => IntegerConstant a fromInteger' :: IntegerConstant a => Integer -> T a class (IntegerConstant a) => RationalConstant a fromRational' :: RationalConstant a => Rational -> T a class (C a) => Additive a add :: Additive a => T a -> T a -> CodeGenFunction r (T a) sub :: Additive a => T a -> T a -> CodeGenFunction r (T a) neg :: Additive a => T a -> CodeGenFunction r (T a) inc :: (Additive i, IntegerConstant i) => T i -> CodeGenFunction r (T i) dec :: (Additive i, IntegerConstant i) => T i -> CodeGenFunction r (T i) class (Additive a) => PseudoRing a mul :: PseudoRing a => T a -> T a -> CodeGenFunction r (T a) class (PseudoRing a) => Field a fdiv :: Field a => T a -> T a -> CodeGenFunction r (T a) type family Scalar vector class (PseudoRing (Scalar v), Additive v) => PseudoModule v scale :: PseudoModule v => T (Scalar v) -> T v -> CodeGenFunction r (T v) class (Additive a) => Real a min :: Real a => T a -> T a -> CodeGenFunction r (T a) max :: Real a => T a -> T a -> CodeGenFunction r (T a) abs :: Real a => T a -> CodeGenFunction r (T a) signum :: Real a => T a -> CodeGenFunction r (T a) class (Real a) => Fraction a truncate :: Fraction a => T a -> CodeGenFunction r (T a) fraction :: Fraction a => T a -> CodeGenFunction r (T a) class (Repr i ~ Value ir, IsInteger ir, IntegerConstant ir, CmpRet ir, IsPrimitive ir) => NativeInteger i ir class (Repr a ~ Value ar, IsFloating ar, RationalConstant ar, CmpRet ar, IsPrimitive ar) => NativeFloating a ar truncateToInt :: (NativeInteger i ir, NativeFloating a ar) => T a -> CodeGenFunction r (T i) floorToInt :: (NativeInteger i ir, NativeFloating a ar) => T a -> CodeGenFunction r (T i) ceilingToInt :: (NativeInteger i ir, NativeFloating a ar) => T a -> CodeGenFunction r (T i) roundToIntFast :: (NativeInteger i ir, NativeFloating a ar) => T a -> CodeGenFunction r (T i) splitFractionToInt :: (NativeInteger i ir, NativeFloating a ar) => T a -> CodeGenFunction r (T (i, a)) class Field a => Algebraic a sqrt :: Algebraic a => T a -> CodeGenFunction r (T a) class Algebraic a => Transcendental a pi :: Transcendental a => CodeGenFunction r (T a) sin :: Transcendental a => T a -> CodeGenFunction r (T a) cos :: Transcendental a => T a -> CodeGenFunction r (T a) exp :: Transcendental a => T a -> CodeGenFunction r (T a) log :: Transcendental a => T a -> CodeGenFunction r (T a) pow :: Transcendental a => T a -> T a -> CodeGenFunction r (T a) class (C a) => Select a select :: Select a => T Bool -> T a -> T a -> CodeGenFunction r (T a) class (Real a) => Comparison a -- | It must hold -- --
--   max x y  ==  do gt <- cmp CmpGT x y; select gt x y
--   
cmp :: Comparison a => CmpPredicate -> T a -> T a -> CodeGenFunction r (T Bool) class (Comparison a) => FloatingComparison a fcmp :: FloatingComparison a => FPPredicate -> T a -> T a -> CodeGenFunction r (T Bool) class (C a) => Logic a and :: Logic a => T a -> T a -> CodeGenFunction r (T a) or :: Logic a => T a -> T a -> CodeGenFunction r (T a) xor :: Logic a => T a -> T a -> CodeGenFunction r (T a) inv :: Logic a => T a -> CodeGenFunction r (T a) class BitShift a shl :: BitShift a => T a -> T a -> CodeGenFunction r (T a) shr :: BitShift a => T a -> T a -> CodeGenFunction r (T a) class (PseudoRing a) => Integral a idiv :: Integral a => T a -> T a -> CodeGenFunction r (T a) irem :: Integral a => T a -> T a -> CodeGenFunction r (T a) fromIntegral :: (NativeInteger i ir, NativeFloating a ar) => T i -> CodeGenFunction r (T a) newtype Array n a Array :: [a] -> Array n a withArraySize :: (Proxy n -> gen (Array n a)) -> gen (Array n a) extractArrayValue :: (Natural n, ArrayIndex n i, C a) => i -> T (Array n a) -> CodeGenFunction r (T a) insertArrayValue :: (Natural n, ArrayIndex n i, C a) => i -> T a -> T (Array n a) -> CodeGenFunction r (T (Array n a)) -- | 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. module LLVM.Extra.Marshal class (Value a, C (ValueOf a), Marshal (Struct a), IsSized (Struct a)) => C a pack :: C a => a -> Struct a unpack :: C a => Struct a -> a type Struct a = Struct (ValueOf a) peek :: (C a, Struct a ~ struct, Marshal struct) => Ptr struct -> IO a poke :: (C a, Struct a ~ struct, Marshal struct) => Ptr struct -> a -> IO () type VectorStruct n a = Struct (VectorValueOf n a) class (Positive n, VectorValue n a, C (VectorValueOf n a), Marshal (VectorStruct n a), IsSized (VectorStruct n a)) => Vector n a packVector :: Vector n a => Vector n a -> VectorStruct n a unpackVector :: Vector n a => VectorStruct n a -> Vector n a with :: C a => a -> (Ptr (Struct a) -> IO b) -> IO b alloca :: IsType a => (Ptr a -> IO b) -> IO b instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: LLVM.Core.Type.SizeOf a), LLVM.Extra.Marshal.Vector n a) => LLVM.Extra.Marshal.C (LLVM.Core.Data.Vector n a) instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D1)) => LLVM.Extra.Marshal.Vector n GHC.Types.Bool instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D32)) => LLVM.Extra.Marshal.Vector n GHC.Types.Float instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D64)) => LLVM.Extra.Marshal.Vector n GHC.Types.Double instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: LLVM.Core.Type.IntSize)) => LLVM.Extra.Marshal.Vector n GHC.Types.Word instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D8)) => LLVM.Extra.Marshal.Vector n GHC.Word.Word8 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D16)) => LLVM.Extra.Marshal.Vector n GHC.Word.Word16 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D32)) => LLVM.Extra.Marshal.Vector n GHC.Word.Word32 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D64)) => LLVM.Extra.Marshal.Vector n GHC.Word.Word64 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: LLVM.Core.Type.IntSize)) => LLVM.Extra.Marshal.Vector n GHC.Types.Int instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D8)) => LLVM.Extra.Marshal.Vector n GHC.Int.Int8 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D16)) => LLVM.Extra.Marshal.Vector n GHC.Int.Int16 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D32)) => LLVM.Extra.Marshal.Vector n GHC.Int.Int32 instance (Type.Data.Num.Decimal.Number.Positive n, Type.Data.Num.Decimal.Number.Natural (n Type.Data.Num.Decimal.Number.:*: Type.Data.Num.Decimal.Literal.D64)) => LLVM.Extra.Marshal.Vector n GHC.Int.Int64 instance (LLVM.Extra.Marshal.Vector n a, LLVM.Extra.Marshal.Vector n b) => LLVM.Extra.Marshal.Vector n (a, b) instance (LLVM.Extra.Marshal.Vector n a, LLVM.Extra.Marshal.Vector n b, LLVM.Extra.Marshal.Vector n c) => LLVM.Extra.Marshal.Vector n (a, b, c) instance LLVM.Extra.Marshal.C GHC.Types.Bool instance LLVM.Extra.Marshal.C GHC.Types.Float instance LLVM.Extra.Marshal.C GHC.Types.Double instance LLVM.Extra.Marshal.C GHC.Types.Word instance LLVM.Extra.Marshal.C GHC.Word.Word8 instance LLVM.Extra.Marshal.C GHC.Word.Word16 instance LLVM.Extra.Marshal.C GHC.Word.Word32 instance LLVM.Extra.Marshal.C GHC.Word.Word64 instance LLVM.Extra.Marshal.C GHC.Types.Int instance LLVM.Extra.Marshal.C GHC.Int.Int8 instance LLVM.Extra.Marshal.C GHC.Int.Int16 instance LLVM.Extra.Marshal.C GHC.Int.Int32 instance LLVM.Extra.Marshal.C GHC.Int.Int64 instance Foreign.Storable.Storable a => LLVM.Extra.Marshal.C (GHC.Ptr.Ptr a) instance LLVM.Core.Type.IsType a => LLVM.Extra.Marshal.C (LLVM.Core.Data.Ptr a) instance LLVM.Core.Type.IsFunction a => LLVM.Extra.Marshal.C (GHC.Ptr.FunPtr a) instance LLVM.Extra.Marshal.C (GHC.Stable.StablePtr a) instance LLVM.Extra.Marshal.C () instance (LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct a), LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct b), LLVM.Extra.Marshal.C a, LLVM.Extra.Marshal.C b) => LLVM.Extra.Marshal.C (a, b) instance (LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct a), LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct b), LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct c), LLVM.Extra.Marshal.C a, LLVM.Extra.Marshal.C b, LLVM.Extra.Marshal.C c) => LLVM.Extra.Marshal.C (a, b, c) instance (LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct a), LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct b), LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct c), LLVM.Core.Type.IsSized (LLVM.Extra.Marshal.Struct d), LLVM.Extra.Marshal.C a, LLVM.Extra.Marshal.C b, LLVM.Extra.Marshal.C c, LLVM.Extra.Marshal.C d) => LLVM.Extra.Marshal.C (a, b, c, d) module LLVM.Extra.Multi.Class class C value where { type family Size value; } switch :: C value => f T -> f (T (Size value)) -> f value newtype Const a value Const :: value a -> Const a value [getConst] :: Const a value -> value a undef :: (C value, Size value ~ n, Positive n, C a) => value a zero :: (C value, Size value ~ n, Positive n, C a) => value a newtype Op0 r a value Op0 :: CodeGenFunction r (value a) -> Op0 r a value [runOp0] :: Op0 r a value -> CodeGenFunction r (value a) newtype Op1 r a b value Op1 :: (value a -> CodeGenFunction r (value b)) -> Op1 r a b value [runOp1] :: Op1 r a b value -> value a -> CodeGenFunction r (value b) newtype Op2 r a b c value Op2 :: (value a -> value b -> CodeGenFunction r (value c)) -> Op2 r a b c value [runOp2] :: Op2 r a b c value -> value a -> value b -> CodeGenFunction r (value c) add :: (Positive n, Additive a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) sub :: (Positive n, Additive a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) neg :: (Positive n, Additive a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) mul :: (Positive n, PseudoRing a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) fdiv :: (Positive n, Field a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) scale :: (Positive n, PseudoModule v, n ~ Size value, C value) => value (Scalar v) -> value v -> CodeGenFunction r (value v) min :: (Positive n, Real a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) max :: (Positive n, Real a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) abs :: (Positive n, Real a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) signum :: (Positive n, Real a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) truncate :: (Positive n, Fraction a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) fraction :: (Positive n, Fraction a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) sqrt :: (Positive n, Algebraic a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) pi :: (Positive n, Transcendental a, n ~ Size value, C value) => CodeGenFunction r (value a) sin :: (Positive n, Transcendental a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) cos :: (Positive n, Transcendental a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) exp :: (Positive n, Transcendental a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) log :: (Positive n, Transcendental a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) pow :: (Positive n, Transcendental a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) cmp :: (Positive n, Comparison a, n ~ Size value, C value) => CmpPredicate -> value a -> value a -> CodeGenFunction r (value Bool) fcmp :: (Positive n, FloatingComparison a, n ~ Size value, C value) => FPPredicate -> value a -> value a -> CodeGenFunction r (value Bool) and :: (Positive n, Logic a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) or :: (Positive n, Logic a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) xor :: (Positive n, Logic a, n ~ Size value, C value) => value a -> value a -> CodeGenFunction r (value a) inv :: (Positive n, Logic a, n ~ Size value, C value) => value a -> CodeGenFunction r (value a) instance LLVM.Extra.Multi.Class.C LLVM.Extra.Multi.Value.Private.T instance Type.Data.Num.Decimal.Number.Positive n => LLVM.Extra.Multi.Class.C (LLVM.Extra.Multi.Vector.T n) -- | Maybe transformer datatype implemented in continuation passing style. module LLVM.Extra.MaybeContinuation -- | Isomorphic to ReaderT (CodeGenFunction r z) (ContT z -- (CodeGenFunction r)) a, where the reader provides the block for -- Nothing and the continuation part manages the Just. newtype T r z a Cons :: (CodeGenFunction r z -> (a -> CodeGenFunction r z) -> CodeGenFunction r z) -> T r z a [resolve] :: T r z a -> CodeGenFunction r z -> (a -> CodeGenFunction r z) -> CodeGenFunction r z map :: (a -> CodeGenFunction r b) -> T r z a -> T r z b -- | counterpart to Data.Maybe.HT.toMaybe withBool :: Phi z => Value Bool -> CodeGenFunction r a -> T r z a fromBool :: Phi z => CodeGenFunction r (Value Bool, a) -> T r z a toBool :: Undefined a => T r (Value Bool, a) a -> CodeGenFunction r (Value Bool, a) fromPlainMaybe :: Phi z => T a -> T r z a fromMaybe :: Phi z => CodeGenFunction r (T a) -> T r z a toMaybe :: Undefined a => T r (T a) a -> CodeGenFunction r (T a) isJust :: T r (Value Bool) a -> CodeGenFunction r (Value Bool) lift :: CodeGenFunction r a -> T r z a guard :: Phi z => Value Bool -> T r z () just :: a -> T r z a nothing :: T r z a bind :: T r z a -> (a -> T r z b) -> T r z b -- | Run an exception handler if the Maybe-action fails. The exception is -- propagated. That is, the handler is intended for a cleanup procedure. onFail :: CodeGenFunction r () -> T r z a -> T r z a -- | Run the first action and if that fails run the second action. If both -- actions fail, then the composed action fails, too. alternative :: (Phi z, Undefined a) => T r (T a) a -> T r (T a) a -> T r z a fixedLengthLoop :: (Phi s, Undefined s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> s -> (s -> T r (T s) s) -> CodeGenFunction r (Value i, T s) -- | If the returned position is smaller than the array size, then returned -- final state is nothing. arrayLoop :: (Phi s, Undefined s, IsType a, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr a) -> s -> (Value (Ptr a) -> s -> T r (T (Value (Ptr a), s)) s) -> CodeGenFunction r (Value i, T s) arrayLoop2 :: (Phi s, Undefined s, IsType a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> T r (T (Value (Ptr a), (Value (Ptr b), s))) s) -> CodeGenFunction r (Value i, T s) instance GHC.Base.Functor (LLVM.Extra.MaybeContinuation.T r z) instance GHC.Base.Applicative (LLVM.Extra.MaybeContinuation.T r z) instance GHC.Base.Monad (LLVM.Extra.MaybeContinuation.T r z) instance Control.Monad.IO.Class.MonadIO (LLVM.Extra.MaybeContinuation.T r z) -- | Transfer values between Haskell and JIT generated code in a -- Haskell-compatible format as dictated by the Storable class. -- E.g. instance Bool may use more than a byte (e.g. Word32). For -- tuples, you may use the Tuple wrapper from the -- storable-record package. The Storable instance for -- Vectors is compatible with arrays, i.e. indices always count -- upwards irrespective of machine endianess and tuple elements are -- interleaved. module LLVM.Extra.Storable class (Storable a, Value a, Phi (ValueOf a), Undefined (ValueOf a)) => C a load :: C a => Value (Ptr a) -> CodeGenFunction r (ValueOf a) store :: C a => ValueOf a -> Value (Ptr a) -> CodeGenFunction r () storeNext :: (C a, ValueOf a ~ al, Value (Ptr a) ~ ptr) => al -> ptr -> CodeGenFunction r ptr modify :: (C a, ValueOf a ~ al) => (al -> CodeGenFunction r al) -> Value (Ptr a) -> CodeGenFunction r () class (Storable tuple, Value tuple, Phi (ValueOf tuple), Undefined (ValueOf tuple)) => Tuple tuple loadTuple :: Tuple tuple => Value (Ptr (Tuple tuple)) -> CodeGenFunction r (ValueOf tuple) storeTuple :: Tuple tuple => ValueOf tuple -> Value (Ptr (Tuple tuple)) -> CodeGenFunction r () class (C a) => Vector a assembleVector :: (Vector a, Positive n) => Proxy a -> Vector n (ValueOf a) -> CodeGenFunction r (VectorValueOf n a) disassembleVector :: (Vector a, Positive n) => Proxy a -> VectorValueOf n a -> CodeGenFunction r (Vector n (ValueOf a)) class TupleVector a deinterleave :: (TupleVector a, Positive n) => Proxy a -> Vector n (ValueOf a) -> CodeGenFunction r (VectorValueOf n a) interleave :: (TupleVector a, Positive n) => Proxy a -> VectorValueOf n a -> CodeGenFunction r (Vector n (ValueOf a)) loadNewtype :: (C a, ValueOf a ~ al) => (a -> wrapped) -> (al -> wrappedl) -> Value (Ptr wrapped) -> CodeGenFunction r wrappedl storeNewtype :: (C a, ValueOf a ~ al) => (a -> wrapped) -> (wrappedl -> al) -> wrappedl -> Value (Ptr wrapped) -> CodeGenFunction r () loadTraversable :: (Repeat f, Traversable f, C a, ValueOf a ~ al) => Value (Ptr (f a)) -> CodeGenFunction r (f al) loadApplicative :: (Applicative f, Traversable f, C a, ValueOf a ~ al) => Value (Ptr (f a)) -> CodeGenFunction r (f al) storeFoldable :: (Foldable f, C a, ValueOf a ~ al) => f al -> Value (Ptr (f a)) -> CodeGenFunction r () advancePtr :: (Storable a, Value (Ptr a) ~ ptr) => Value Int -> ptr -> CodeGenFunction r ptr incrementPtr :: (Storable a, Value (Ptr a) ~ ptr) => ptr -> CodeGenFunction r ptr decrementPtr :: (Storable a, Value (Ptr a) ~ ptr) => ptr -> CodeGenFunction r ptr arrayLoop :: (Phi s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i, Storable a, Value (Ptr a) ~ ptrA) => Value i -> ptrA -> s -> (ptrA -> s -> CodeGenFunction r s) -> CodeGenFunction r s arrayLoop2 :: (Phi s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i, Storable a, Value (Ptr a) ~ ptrA, Storable b, Value (Ptr b) ~ ptrB) => Value i -> ptrA -> ptrB -> s -> (ptrA -> ptrB -> s -> CodeGenFunction r s) -> CodeGenFunction r s arrayLoopMaybeCont :: (Phi s, Undefined s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i, Storable a, Value (Ptr a) ~ ptrA, T (ptrA, s) ~ z) => Value i -> ptrA -> s -> (ptrA -> s -> T r z s) -> CodeGenFunction r (Value i, T s) arrayLoopMaybeCont2 :: (Phi s, Undefined s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i, Storable a, Value (Ptr a) ~ ptrA, Storable b, Value (Ptr b) ~ ptrB, T (ptrA, (ptrB, s)) ~ z) => Value i -> ptrA -> ptrB -> s -> (ptrA -> ptrB -> s -> T r z s) -> CodeGenFunction r (Value i, T s) module LLVM.Extra.Multi.Value.Storable class (Storable a, C a) => C a load :: C a => Value (Ptr a) -> CodeGenFunction r (T a) store :: C a => T a -> Value (Ptr a) -> CodeGenFunction r () storeNext :: (C a, Value (Ptr a) ~ ptr) => T a -> ptr -> CodeGenFunction r ptr modify :: (C a, T a ~ al) => (al -> CodeGenFunction r al) -> Value (Ptr a) -> CodeGenFunction r () class (Storable tuple, C tuple) => Tuple tuple loadTuple :: Tuple tuple => Value (Ptr (Tuple tuple)) -> CodeGenFunction r (T tuple) storeTuple :: Tuple tuple => T tuple -> Value (Ptr (Tuple tuple)) -> CodeGenFunction r () class (C a, C a) => Vector a assembleVector :: (Vector a, Positive n) => Proxy a -> Vector n (Repr a) -> CodeGenFunction r (Repr n a) disassembleVector :: (Vector a, Positive n) => Proxy a -> Repr n a -> CodeGenFunction r (Vector n (Repr a)) class (C a) => TupleVector a deinterleave :: (TupleVector a, Positive n) => Proxy a -> Vector n (Repr a) -> CodeGenFunction r (Repr n a) interleave :: (TupleVector a, Positive n) => Proxy a -> Repr n a -> CodeGenFunction r (Vector n (Repr a)) loadTraversable :: (Repeat f, Traversable f, C a, Repr fa ~ f (Repr a)) => Value (Ptr (f a)) -> CodeGenFunction r (T fa) loadApplicative :: (Applicative f, Traversable f, C a, Repr fa ~ f (Repr a)) => Value (Ptr (f a)) -> CodeGenFunction r (T fa) storeFoldable :: (Foldable f, C a, Repr fa ~ f (Repr a)) => T fa -> Value (Ptr (f a)) -> CodeGenFunction r () advancePtr :: (Storable a, Value (Ptr a) ~ ptr) => Value Int -> ptr -> CodeGenFunction r ptr incrementPtr :: (Storable a, Value (Ptr a) ~ ptr) => ptr -> CodeGenFunction r ptr decrementPtr :: (Storable a, Value (Ptr a) ~ ptr) => ptr -> CodeGenFunction r ptr arrayLoop :: (Phi s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i, Storable a, Value (Ptr a) ~ ptrA) => Value i -> ptrA -> s -> (ptrA -> s -> CodeGenFunction r s) -> CodeGenFunction r s arrayLoop2 :: (Phi s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i, Storable a, Value (Ptr a) ~ ptrA, Storable b, Value (Ptr b) ~ ptrB) => Value i -> ptrA -> ptrB -> s -> (ptrA -> ptrB -> s -> CodeGenFunction r s) -> CodeGenFunction r s arrayLoopMaybeCont :: (Phi s, Undefined s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i, Storable a, Value (Ptr a) ~ ptrA, T (ptrA, s) ~ z) => Value i -> ptrA -> s -> (ptrA -> s -> T r z s) -> CodeGenFunction r (Value i, T s) arrayLoopMaybeCont2 :: (Phi s, Undefined s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i, Storable a, Value (Ptr a) ~ ptrA, Storable b, Value (Ptr b) ~ ptrB, T (ptrA, (ptrB, s)) ~ z) => Value i -> ptrA -> ptrB -> s -> (ptrA -> ptrB -> s -> T r z s) -> CodeGenFunction r (Value i, T s) instance (LLVM.Extra.Multi.Value.Storable.Tuple tuple, LLVM.Extra.Multi.Value.Storable.TupleVector tuple) => LLVM.Extra.Multi.Value.Storable.Vector (Foreign.Storable.Record.Tuple.Tuple tuple) instance (LLVM.Extra.Multi.Value.Storable.Vector a, LLVM.Extra.Multi.Value.Storable.Vector b) => LLVM.Extra.Multi.Value.Storable.TupleVector (a, b) instance (LLVM.Extra.Multi.Value.Storable.Vector a, LLVM.Extra.Multi.Value.Storable.Vector b, LLVM.Extra.Multi.Value.Storable.Vector c) => LLVM.Extra.Multi.Value.Storable.TupleVector (a, b, c) instance (Type.Data.Num.Decimal.Number.Positive n, LLVM.Extra.Multi.Value.Storable.Vector a) => LLVM.Extra.Multi.Value.Storable.C (LLVM.Core.Data.Vector n a) instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Types.Float instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Types.Double instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Types.Word instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Word.Word8 instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Word.Word16 instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Word.Word32 instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Word.Word64 instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Types.Int instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Int.Int8 instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Int.Int16 instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Int.Int32 instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Int.Int64 instance LLVM.Extra.Multi.Value.Storable.Vector GHC.Types.Bool instance LLVM.Extra.Multi.Value.Storable.Vector Data.Bool8.Bool8 instance LLVM.Extra.Multi.Value.Storable.Tuple tuple => LLVM.Extra.Multi.Value.Storable.C (Foreign.Storable.Record.Tuple.Tuple tuple) instance (LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Storable.C b) => LLVM.Extra.Multi.Value.Storable.Tuple (a, b) instance (LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Storable.C b, LLVM.Extra.Multi.Value.Storable.C c) => LLVM.Extra.Multi.Value.Storable.Tuple (a, b, c) instance (LLVM.ExecutionEngine.Marshal.Marshal a, LLVM.Core.CodeGen.IsConst a, LLVM.Core.Type.IsFirstClass a) => LLVM.Extra.Multi.Value.Storable.C (LLVM.ExecutionEngine.Marshal.Stored a) instance LLVM.Extra.Multi.Value.Storable.C GHC.Types.Float instance LLVM.Extra.Multi.Value.Storable.C GHC.Types.Double instance LLVM.Extra.Multi.Value.Storable.C GHC.Types.Word instance LLVM.Extra.Multi.Value.Storable.C GHC.Word.Word8 instance LLVM.Extra.Multi.Value.Storable.C GHC.Word.Word16 instance LLVM.Extra.Multi.Value.Storable.C GHC.Word.Word32 instance LLVM.Extra.Multi.Value.Storable.C GHC.Word.Word64 instance LLVM.Extra.Multi.Value.Storable.C GHC.Types.Int instance LLVM.Extra.Multi.Value.Storable.C GHC.Int.Int8 instance LLVM.Extra.Multi.Value.Storable.C GHC.Int.Int16 instance LLVM.Extra.Multi.Value.Storable.C GHC.Int.Int32 instance LLVM.Extra.Multi.Value.Storable.C GHC.Int.Int64 instance LLVM.Extra.Multi.Value.Storable.C GHC.Types.Bool instance LLVM.Extra.Multi.Value.Storable.C Data.Bool8.Bool8 instance LLVM.Extra.Multi.Value.Storable.C a => LLVM.Extra.Multi.Value.Storable.C (Data.Complex.Complex a) instance LLVM.Extra.Multi.Value.Storable.C () module LLVM.Extra.Iterator -- | Simulates a non-strict list. data T r a mapM_ :: (a -> CodeGenFunction r ()) -> T r a -> CodeGenFunction r () mapState_ :: Phi t => (a -> t -> CodeGenFunction r t) -> T r a -> t -> CodeGenFunction r t mapStateM_ :: Phi t => (a -> StateT t (CodeGenFunction r) ()) -> T r a -> StateT t (CodeGenFunction r) () mapWhileState_ :: Phi t => (a -> t -> CodeGenFunction r (Value Bool, t)) -> T r a -> t -> CodeGenFunction r t empty :: T r a singleton :: a -> T r a cons :: (Phi a, Undefined a) => a -> T r a -> T r a -- | Attention: This always performs one function call more than necessary. -- I.e. if f reads from or writes to memory make sure that -- accessing one more pointer is legal. iterate :: (Phi a, Undefined a) => (a -> CodeGenFunction r a) -> a -> T r a countDown :: (Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> T r (Value i) arrayPtrs :: IsType a => Value (Ptr a) -> T r (Value (Ptr a)) storableArrayPtrs :: C a => Value (Ptr a) -> T r (Value (Ptr a)) mapM :: (a -> CodeGenFunction r b) -> T r a -> T r b mapMaybe :: (Phi b, Undefined b) => (a -> CodeGenFunction r (T b)) -> T r a -> T r b catMaybes :: (Phi a, Undefined a) => T r (T a) -> T r a takeWhileJust :: T r (T a) -> T r a takeWhile :: (a -> CodeGenFunction r (Value Bool)) -> T r a -> T r a cartesian :: (Phi a, Phi b, Undefined a, Undefined b) => T r a -> T r b -> T r (a, b) take :: (Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> T r a -> T r a fixedLengthLoop :: (Phi s, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> s -> (s -> CodeGenFunction r s) -> CodeGenFunction r s arrayLoop :: (Phi a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr b) -> a -> (Value (Ptr b) -> a -> CodeGenFunction r a) -> CodeGenFunction r a arrayLoopWithExit :: (Phi s, IsType a, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr a) -> s -> (Value (Ptr a) -> s -> CodeGenFunction r (Value Bool, s)) -> CodeGenFunction r (Value i, s) arrayLoop2 :: (Phi s, IsType a, IsType b, Num i, IsConst i, IsInteger i, CmpRet i, IsPrimitive i) => Value i -> Value (Ptr a) -> Value (Ptr b) -> s -> (Value (Ptr a) -> Value (Ptr b) -> s -> CodeGenFunction r s) -> CodeGenFunction r s instance GHC.Base.Functor (LLVM.Extra.Iterator.T r) instance GHC.Base.Applicative (LLVM.Extra.Iterator.T r) module LLVM.Extra.Multi.Iterator takeWhile :: (a -> CodeGenFunction r (T Bool)) -> T r a -> T r a countDown :: (Additive i, Comparison i, IntegerConstant i) => T i -> T r (T i) take :: (Additive i, Comparison i, IntegerConstant i) => T i -> T r a -> T r a class (C a) => Enum a succ :: Enum a => T a -> CodeGenFunction r (T a) pred :: Enum a => T a -> CodeGenFunction r (T a) enumFrom :: Enum a => T a -> T r (T a) enumFromTo :: Enum a => T a -> T a -> T r (T a) instance (LLVM.Core.Type.IsInteger w, LLVM.Extra.ScalarOrVector.IntegerConstant w, GHC.Num.Num w, LLVM.Core.Instructions.CmpRet w, LLVM.Core.Type.IsPrimitive w, GHC.Enum.Enum e) => LLVM.Extra.Multi.Iterator.Enum (Data.Enum.Storable.T w e) module LLVM.Extra.FastMath data NoNaNs NoNaNs :: NoNaNs data NoInfs NoInfs :: NoInfs data NoSignedZeros NoSignedZeros :: NoSignedZeros data AllowReciprocal AllowReciprocal :: AllowReciprocal data Fast Fast :: Fast class Flags flags setFlags :: (Flags flags, IsFloating a) => Proxy flags -> Bool -> Value a -> CodeGenFunction r () newtype Number flags a Number :: a -> Number flags a [deconsNumber] :: Number flags a -> a getNumber :: flags -> Number flags a -> a mvNumber :: T a -> T (Number flags a) mvDenumber :: T (Number flags a) -> T a class C a => MultiValue a setMultiValueFlags :: (MultiValue a, Flags flags) => Proxy flags -> Bool -> T (Number flags a) -> CodeGenFunction r () attachMultiValueFlags :: (Flags flags, MultiValue a) => Id (CodeGenFunction r (T (Number flags a))) liftNumberM :: (m ~ CodeGenFunction r, Flags flags, MultiValue b) => (T a -> m (T b)) -> T (Number flags a) -> m (T (Number flags b)) liftNumberM2 :: (m ~ CodeGenFunction r, Flags flags, MultiValue c) => (T a -> T b -> m (T c)) -> T (Number flags a) -> T (Number flags b) -> m (T (Number flags c)) mvecNumber :: T n a -> T n (Number flags a) mvecDenumber :: T n (Number flags a) -> T n a class (MultiValue a, C a) => MultiVector a setMultiVectorFlags :: (MultiVector a, Flags flags, Positive n) => Proxy flags -> Bool -> T n (Number flags a) -> CodeGenFunction r () attachMultiVectorFlags :: (Positive n, Flags flags, MultiVector a) => Id (CodeGenFunction r (T n (Number flags a))) liftMultiVectorM :: (m ~ CodeGenFunction r, Positive n, Flags flags, MultiVector b) => (T n a -> m (T n b)) -> T n (Number flags a) -> m (T n (Number flags b)) liftMultiVectorM2 :: (m ~ CodeGenFunction r, Positive n, Flags flags, MultiVector c) => (T n a -> T n b -> m (T n c)) -> T n (Number flags a) -> T n (Number flags b) -> m (T n (Number flags c)) class Tuple a setTupleFlags :: (Tuple a, Flags flags) => Proxy flags -> Bool -> a -> CodeGenFunction r () newtype Context flags a Context :: a -> Context flags a attachTupleFlags :: (Flags flags, Tuple a) => Id (CodeGenFunction r (Context flags a)) liftContext :: (Flags flags, Tuple b) => (a -> CodeGenFunction r b) -> Context flags a -> CodeGenFunction r (Context flags b) liftContext2 :: (Flags flags, Tuple c) => (a -> b -> CodeGenFunction r c) -> Context flags a -> Context flags b -> CodeGenFunction r (Context flags c) instance Foreign.Storable.Storable a => Foreign.Storable.Storable (LLVM.Extra.FastMath.Number flags a) instance GHC.Float.Floating a => GHC.Float.Floating (LLVM.Extra.FastMath.Number flags a) instance GHC.Real.Fractional a => GHC.Real.Fractional (LLVM.Extra.FastMath.Number flags a) instance GHC.Num.Num a => GHC.Num.Num (LLVM.Extra.FastMath.Number flags a) instance GHC.Show.Show a => GHC.Show.Show (LLVM.Extra.FastMath.Number flags a) instance GHC.Classes.Ord a => GHC.Classes.Ord (LLVM.Extra.FastMath.Number flags a) instance GHC.Classes.Eq a => GHC.Classes.Eq (LLVM.Extra.FastMath.Number flags a) instance GHC.Classes.Eq LLVM.Extra.FastMath.Fast instance GHC.Show.Show LLVM.Extra.FastMath.Fast instance GHC.Classes.Eq LLVM.Extra.FastMath.AllowReciprocal instance GHC.Show.Show LLVM.Extra.FastMath.AllowReciprocal instance GHC.Classes.Eq LLVM.Extra.FastMath.NoSignedZeros instance GHC.Show.Show LLVM.Extra.FastMath.NoSignedZeros instance GHC.Classes.Eq LLVM.Extra.FastMath.NoInfs instance GHC.Show.Show LLVM.Extra.FastMath.NoInfs instance GHC.Classes.Eq LLVM.Extra.FastMath.NoNaNs instance GHC.Show.Show LLVM.Extra.FastMath.NoNaNs instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.TuplePrivate.Zero a, LLVM.Extra.FastMath.Tuple a) => LLVM.Extra.TuplePrivate.Zero (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.Additive a) => LLVM.Extra.Arithmetic.Additive (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.Arithmetic.PseudoRing a, LLVM.Extra.FastMath.Tuple a) => LLVM.Extra.Arithmetic.PseudoRing (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.Arithmetic.PseudoModule v, LLVM.Extra.FastMath.Tuple v, LLVM.Extra.Arithmetic.Scalar v Data.Type.Equality.~ a, LLVM.Extra.FastMath.Tuple a) => LLVM.Extra.Arithmetic.PseudoModule (LLVM.Extra.FastMath.Context flags v) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.IntegerConstant a) => LLVM.Extra.Arithmetic.IntegerConstant (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple v, LLVM.Extra.Arithmetic.Field v) => LLVM.Extra.Arithmetic.Field (LLVM.Extra.FastMath.Context flags v) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.RationalConstant a) => LLVM.Extra.Arithmetic.RationalConstant (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.Real a) => LLVM.Extra.Arithmetic.Real (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.Fraction a) => LLVM.Extra.Arithmetic.Fraction (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.Comparison a) => LLVM.Extra.Arithmetic.Comparison (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.FloatingComparison a) => LLVM.Extra.Arithmetic.FloatingComparison (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.Algebraic a) => LLVM.Extra.Arithmetic.Algebraic (LLVM.Extra.FastMath.Context flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.Tuple a, LLVM.Extra.Arithmetic.Transcendental a) => LLVM.Extra.Arithmetic.Transcendental (LLVM.Extra.FastMath.Context flags a) instance LLVM.Core.Type.IsFloating a => LLVM.Extra.FastMath.Tuple (LLVM.Core.CodeGen.Value a) instance LLVM.Extra.FastMath.MultiVector GHC.Types.Float instance LLVM.Extra.FastMath.MultiVector GHC.Types.Double instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a) => LLVM.Extra.Multi.Vector.C (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.IntegerConstant a) => LLVM.Extra.Multi.Vector.IntegerConstant (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.RationalConstant a) => LLVM.Extra.Multi.Vector.RationalConstant (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.Additive a) => LLVM.Extra.Multi.Vector.Additive (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.PseudoRing a) => LLVM.Extra.Multi.Vector.PseudoRing (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.Field a) => LLVM.Extra.Multi.Vector.Field (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.Real a) => LLVM.Extra.Multi.Vector.Real (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.Fraction a) => LLVM.Extra.Multi.Vector.Fraction (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.Algebraic a) => LLVM.Extra.Multi.Vector.Algebraic (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.Transcendental a) => LLVM.Extra.Multi.Vector.Transcendental (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.Select a) => LLVM.Extra.Multi.Vector.Select (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.Comparison a) => LLVM.Extra.Multi.Vector.Comparison (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiVector a, LLVM.Extra.Multi.Vector.FloatingComparison a) => LLVM.Extra.Multi.Vector.FloatingComparison (LLVM.Extra.FastMath.Number flags a) instance LLVM.Extra.FastMath.MultiValue a => LLVM.Extra.Multi.Value.Private.C (LLVM.Extra.FastMath.Number flags a) instance LLVM.Extra.FastMath.MultiValue GHC.Types.Float instance LLVM.Extra.FastMath.MultiValue GHC.Types.Double instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.IntegerConstant a) => LLVM.Extra.Multi.Value.Private.IntegerConstant (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.RationalConstant a) => LLVM.Extra.Multi.Value.Private.RationalConstant (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.Additive a) => LLVM.Extra.Multi.Value.Private.Additive (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.PseudoRing a) => LLVM.Extra.Multi.Value.Private.PseudoRing (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.Field a) => LLVM.Extra.Multi.Value.Private.Field (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, a Data.Type.Equality.~ LLVM.Extra.Multi.Value.Private.Scalar v, LLVM.Extra.FastMath.MultiValue v, LLVM.Extra.Multi.Value.Private.PseudoModule v) => LLVM.Extra.Multi.Value.Private.PseudoModule (LLVM.Extra.FastMath.Number flags v) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.Real a) => LLVM.Extra.Multi.Value.Private.Real (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.Fraction a) => LLVM.Extra.Multi.Value.Private.Fraction (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.Algebraic a) => LLVM.Extra.Multi.Value.Private.Algebraic (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.Transcendental a) => LLVM.Extra.Multi.Value.Private.Transcendental (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.Select a) => LLVM.Extra.Multi.Value.Private.Select (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.Comparison a) => LLVM.Extra.Multi.Value.Private.Comparison (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.FastMath.MultiValue a, LLVM.Extra.Multi.Value.Private.FloatingComparison a) => LLVM.Extra.Multi.Value.Private.FloatingComparison (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.Multi.Value.Private.Compose a) => LLVM.Extra.Multi.Value.Private.Compose (LLVM.Extra.FastMath.Number flags a) instance (LLVM.Extra.FastMath.Flags flags, LLVM.Extra.Multi.Value.Private.Decompose pa) => LLVM.Extra.Multi.Value.Private.Decompose (LLVM.Extra.FastMath.Number flags pa) instance LLVM.Extra.FastMath.Flags LLVM.Extra.FastMath.NoNaNs instance LLVM.Extra.FastMath.Flags LLVM.Extra.FastMath.NoInfs instance LLVM.Extra.FastMath.Flags LLVM.Extra.FastMath.NoSignedZeros instance LLVM.Extra.FastMath.Flags LLVM.Extra.FastMath.AllowReciprocal instance LLVM.Extra.FastMath.Flags LLVM.Extra.FastMath.Fast instance (LLVM.Extra.FastMath.Flags f0, LLVM.Extra.FastMath.Flags f1) => LLVM.Extra.FastMath.Flags (f0, f1) instance (LLVM.Extra.FastMath.Flags f0, LLVM.Extra.FastMath.Flags f1, LLVM.Extra.FastMath.Flags f2) => LLVM.Extra.FastMath.Flags (f0, f1, f2) instance (LLVM.Extra.FastMath.Flags f0, LLVM.Extra.FastMath.Flags f1, LLVM.Extra.FastMath.Flags f2, LLVM.Extra.FastMath.Flags f3) => LLVM.Extra.FastMath.Flags (f0, f1, f2, f3) instance (LLVM.Extra.FastMath.Flags f0, LLVM.Extra.FastMath.Flags f1, LLVM.Extra.FastMath.Flags f2, LLVM.Extra.FastMath.Flags f3, LLVM.Extra.FastMath.Flags f4) => LLVM.Extra.FastMath.Flags (f0, f1, f2, f3, f4)