{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module Data.Array.Knead.Code where import qualified Data.Array.Knead.Shape as Shape import qualified LLVM.Extra.Multi.Value.Storable as Storable import qualified LLVM.Extra.Multi.Value as MultiValue import qualified LLVM.Core as LLVM import Foreign.Ptr (Ptr) import Prelude2010 import Prelude () getElementPtr :: (Shape.C sh, Shape.Index sh ~ ix, Storable.C a) => MultiValue.T sh -> LLVM.Value (Ptr a) -> MultiValue.T ix -> LLVM.CodeGenFunction r (LLVM.Value (Ptr a)) getElementPtr :: forall sh ix a r. (C sh, Index sh ~ ix, C a) => T sh -> Value (Ptr a) -> T ix -> CodeGenFunction r (Value (Ptr a)) getElementPtr T sh sh Value (Ptr a) ptr T ix ix = (Value Int -> Value (Ptr a) -> CodeGenFunction r (Value (Ptr a))) -> Value (Ptr a) -> Value Int -> CodeGenFunction r (Value (Ptr a)) forall a b c. (a -> b -> c) -> b -> a -> c flip Value Int -> Value (Ptr a) -> CodeGenFunction r (Value (Ptr a)) forall a ptr r. (Storable a, Value (Ptr a) ~ ptr) => Value Int -> ptr -> CodeGenFunction r ptr Storable.advancePtr Value (Ptr a) ptr (Value Int -> CodeGenFunction r (Value (Ptr a))) -> CodeGenFunction r (Value Int) -> CodeGenFunction r (Value (Ptr a)) forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b =<< Value Size -> CodeGenFunction r (Value Int) forall (value :: * -> *) a b r. (ValueCons value, IsSized a, IsSized b, SizeOf a ~ SizeOf b) => value a -> CodeGenFunction r (value b) LLVM.bitcast (Value Size -> CodeGenFunction r (Value Int)) -> CodeGenFunction r (Value Size) -> CodeGenFunction r (Value Int) forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b =<< T sh -> T (Index sh) -> CodeGenFunction r (Value Size) forall sh r. C sh => T sh -> T (Index sh) -> CodeGenFunction r (Value Size) Shape.offset T sh sh T ix T (Index sh) ix