Safe Haskell | None |
---|---|
Language | Haskell2010 |
Sequential imperative code.
Synopsis
- type Program = Definitions Sequential
- type Function = Function Sequential
- data FunctionT a = Function Bool [Param] [Param] (Code a) [ExternalValue] [ExternalValue]
- type Code = Code Sequential
- data Sequential
- data Int8
- data Int16
- data Int32
- data Int64
- data Word8
- data Word16
- data Word32
- data Word64
- pretty :: Pretty a => a -> String
- data ConvOp
- data CmpOp
- data BinOp
- = Add IntType
- | FAdd FloatType
- | Sub IntType
- | FSub FloatType
- | Mul IntType
- | FMul FloatType
- | UDiv IntType
- | SDiv IntType
- | FDiv FloatType
- | FMod FloatType
- | UMod IntType
- | SMod IntType
- | SQuot IntType
- | SRem IntType
- | SMin IntType
- | UMin IntType
- | FMin FloatType
- | SMax IntType
- | UMax IntType
- | FMax FloatType
- | Shl IntType
- | LShr IntType
- | AShr IntType
- | And IntType
- | Or IntType
- | Xor IntType
- | Pow IntType
- | FPow FloatType
- | LogAnd
- | LogOr
- data UnOp
- data PrimValue
- = IntValue !IntValue
- | FloatValue !FloatValue
- | BoolValue !Bool
- | Checked
- data FloatValue
- data IntValue
- = Int8Value !Int8
- | Int16Value !Int16
- | Int32Value !Int32
- | Int64Value !Int64
- data PrimType
- data FloatType
- data IntType
- allIntTypes :: [IntType]
- allFloatTypes :: [FloatType]
- allPrimTypes :: [PrimType]
- intValue :: Integral int => IntType -> int -> IntValue
- intValueType :: IntValue -> IntType
- valueIntegral :: Integral int => IntValue -> int
- floatValue :: Real num => FloatType -> num -> FloatValue
- floatValueType :: FloatValue -> FloatType
- primValueType :: PrimValue -> PrimType
- blankPrimValue :: PrimType -> PrimValue
- allUnOps :: [UnOp]
- allBinOps :: [BinOp]
- allCmpOps :: [CmpOp]
- allConvOps :: [ConvOp]
- doUnOp :: UnOp -> PrimValue -> Maybe PrimValue
- doComplement :: IntValue -> IntValue
- doAbs :: IntValue -> IntValue
- doFAbs :: FloatValue -> FloatValue
- doSSignum :: IntValue -> IntValue
- doUSignum :: IntValue -> IntValue
- doBinOp :: BinOp -> PrimValue -> PrimValue -> Maybe PrimValue
- doAdd :: IntValue -> IntValue -> IntValue
- doMul :: IntValue -> IntValue -> IntValue
- doSDiv :: IntValue -> IntValue -> Maybe IntValue
- doSMod :: IntValue -> IntValue -> Maybe IntValue
- doPow :: IntValue -> IntValue -> Maybe IntValue
- doConvOp :: ConvOp -> PrimValue -> Maybe PrimValue
- doZExt :: IntValue -> IntType -> IntValue
- doSExt :: IntValue -> IntType -> IntValue
- doFPConv :: FloatValue -> FloatType -> FloatValue
- doFPToUI :: FloatValue -> IntType -> IntValue
- doFPToSI :: FloatValue -> IntType -> IntValue
- doUIToFP :: IntValue -> FloatType -> FloatValue
- doSIToFP :: IntValue -> FloatType -> FloatValue
- doCmpOp :: CmpOp -> PrimValue -> PrimValue -> Maybe Bool
- doCmpEq :: PrimValue -> PrimValue -> Bool
- doCmpUlt :: IntValue -> IntValue -> Bool
- doCmpUle :: IntValue -> IntValue -> Bool
- doCmpSlt :: IntValue -> IntValue -> Bool
- doCmpSle :: IntValue -> IntValue -> Bool
- doFCmpLt :: FloatValue -> FloatValue -> Bool
- doFCmpLe :: FloatValue -> FloatValue -> Bool
- intToWord64 :: IntValue -> Word64
- intToInt64 :: IntValue -> Int64
- binOpType :: BinOp -> PrimType
- cmpOpType :: CmpOp -> PrimType
- unOpType :: UnOp -> PrimType
- convOpType :: ConvOp -> (PrimType, PrimType)
- primFuns :: Map String ([PrimType], PrimType, [PrimValue] -> Maybe PrimValue)
- zeroIsh :: PrimValue -> Bool
- oneIsh :: PrimValue -> Bool
- negativeIsh :: PrimValue -> Bool
- zeroIshInt :: IntValue -> Bool
- oneIshInt :: IntValue -> Bool
- primBitSize :: PrimType -> Int
- primByteSize :: Num a => PrimType -> a
- intByteSize :: Num a => IntType -> a
- floatByteSize :: Num a => FloatType -> a
- commutativeBinOp :: BinOp -> Bool
- convOpFun :: ConvOp -> String
- prettySigned :: Bool -> PrimType -> String
- data VName = VName !Name !Int
- data Name
- data Commutativity
- data StreamOrd
- data Uniqueness
- defaultEntryPoint :: Name
- nameToString :: Name -> String
- nameFromString :: String -> Name
- nameToText :: Name -> Text
- nameFromText :: Text -> Name
- locStr :: Located a => a -> String
- locStrRel :: (Located a, Located b) => a -> b -> String
- prettyStacktrace :: Int -> [String] -> String
- baseTag :: VName -> Int
- baseName :: VName -> Name
- baseString :: VName -> String
- quote :: String -> String
- pquote :: Doc -> Doc
- data ErrorMsgPart a
- = ErrorString String
- | ErrorInt32 a
- newtype ErrorMsg a = ErrorMsg [ErrorMsgPart a]
- data SubExp
- type SpaceId = String
- data Space
- errorMsgArgTypes :: ErrorMsg a -> [PrimType]
- newtype Count u e = Count {
- unCount :: e
- data PrimExp v
- primExpSizeAtLeast :: Int -> PrimExp v -> Bool
- constFoldPrimExp :: PrimExp v -> PrimExp v
- (.&&.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.||.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.<.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.<=.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.==.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.>.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.>=.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.&.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.|.) :: PrimExp v -> PrimExp v -> PrimExp v
- (.^.) :: PrimExp v -> PrimExp v -> PrimExp v
- evalPrimExp :: (Pretty v, MonadFail m) => (v -> m PrimValue) -> PrimExp v -> m PrimValue
- primExpType :: PrimExp v -> PrimType
- coerceIntPrimExp :: IntType -> PrimExp v -> PrimExp v
- true :: PrimExp v
- false :: PrimExp v
- leafExpTypes :: Ord a => PrimExp a -> Set (a, PrimType)
- data Bytes
- data Elements
- data Arg
- type Exp = PrimExp ExpLeaf
- data ExpLeaf
- data Volatility
- pattern DebugPrint :: String -> Maybe Exp -> Code a
- pattern Call :: [VName] -> Name -> [Arg] -> Code a
- pattern SetMem :: VName -> VName -> Space -> Code a
- pattern SetScalar :: VName -> Exp -> Code a
- pattern Write :: VName -> Count Elements Exp -> PrimType -> Space -> Volatility -> Exp -> Code a
- pattern DeclareArray :: VName -> Space -> PrimType -> ArrayContents -> Code a
- pattern DeclareScalar :: VName -> Volatility -> PrimType -> Code a
- pattern DeclareMem :: VName -> Space -> Code a
- pattern (:>>:) :: Code a -> Code a -> Code a
- pattern Assert :: Exp -> ErrorMsg Exp -> (SrcLoc, [SrcLoc]) -> Code a
- pattern Free :: VName -> Space -> Code a
- pattern While :: Exp -> Code a -> Code a
- pattern For :: VName -> IntType -> Exp -> Code a -> Code a
- pattern Comment :: String -> Code a -> Code a
- pattern Copy :: VName -> Count Bytes Exp -> Space -> VName -> Count Bytes Exp -> Space -> Count Bytes Exp -> Code a
- pattern Allocate :: VName -> Count Bytes Exp -> Space -> Code a
- pattern Skip :: Code a
- pattern If :: Exp -> Code a -> Code a -> Code a
- pattern Op :: a -> Code a
- data ArrayContents
- data FunctionT a
- data ExternalValue
- data ValueDesc
- data Signedness
- data Constants a = Constants {
- constsDecl :: [Param]
- constsInit :: Code a
- newtype Functions a = Functions [(Name, Function a)]
- data Definitions a = Definitions (Constants a) (Functions a)
- data Param
- data Type
- type DimSize = SubExp
- type MemSize = SubExp
- paramName :: Param -> VName
- elements :: Exp -> Count Elements Exp
- bytes :: Exp -> Count Bytes Exp
- withElemType :: Count Elements Exp -> PrimType -> Count Bytes Exp
- var :: VName -> PrimType -> Exp
- vi32 :: VName -> Exp
- index :: VName -> Count Elements Exp -> PrimType -> Space -> Volatility -> Exp
Documentation
type Program = Definitions Sequential Source #
An imperative program.
type Function = Function Sequential Source #
An imperative function.
A imperative function, containing the body as well as its low-level inputs and outputs, as well as its high-level arguments and results. The latter are only used if the function is an entry point.
Function Bool [Param] [Param] (Code a) [ExternalValue] [ExternalValue] |
Instances
Functor FunctionT Source # | |
Foldable FunctionT Source # | |
Defined in Futhark.CodeGen.ImpCode fold :: Monoid m => FunctionT m -> m # foldMap :: Monoid m => (a -> m) -> FunctionT a -> m # foldMap' :: Monoid m => (a -> m) -> FunctionT a -> m # foldr :: (a -> b -> b) -> b -> FunctionT a -> b # foldr' :: (a -> b -> b) -> b -> FunctionT a -> b # foldl :: (b -> a -> b) -> b -> FunctionT a -> b # foldl' :: (b -> a -> b) -> b -> FunctionT a -> b # foldr1 :: (a -> a -> a) -> FunctionT a -> a # foldl1 :: (a -> a -> a) -> FunctionT a -> a # toList :: FunctionT a -> [a] # length :: FunctionT a -> Int # elem :: Eq a => a -> FunctionT a -> Bool # maximum :: Ord a => FunctionT a -> a # minimum :: Ord a => FunctionT a -> a # | |
Traversable FunctionT Source # | |
Defined in Futhark.CodeGen.ImpCode | |
Show a => Show (FunctionT a) Source # | |
Pretty op => Pretty (FunctionT op) Source # | |
type Code = Code Sequential Source #
A piece of imperative code.
data Sequential Source #
Phantom type for identifying sequential imperative code.
Instances
Pretty Sequential Source # | |
Defined in Futhark.CodeGen.ImpCode.Sequential | |
FreeIn Sequential Source # | |
Defined in Futhark.CodeGen.ImpCode.Sequential freeIn' :: Sequential -> FV Source # |
8-bit signed integer type
Instances
Bounded Int8 | Since: base-2.1 |
Enum Int8 | Since: base-2.1 |
Eq Int8 | Since: base-2.1 |
Integral Int8 | Since: base-2.1 |
Num Int8 | Since: base-2.1 |
Ord Int8 | Since: base-2.1 |
Read Int8 | Since: base-2.1 |
Real Int8 | Since: base-2.1 |
Defined in GHC.Int toRational :: Int8 -> Rational # | |
Show Int8 | Since: base-2.1 |
Ix Int8 | Since: base-2.1 |
PrintfArg Int8 | Since: base-2.1 |
Defined in Text.Printf formatArg :: Int8 -> FieldFormatter # parseFormat :: Int8 -> ModifierParser # | |
Storable Int8 | Since: base-2.1 |
Defined in Foreign.Storable | |
Bits Int8 | Since: base-2.1 |
Defined in GHC.Int (.&.) :: Int8 -> Int8 -> Int8 # (.|.) :: Int8 -> Int8 -> Int8 # complement :: Int8 -> Int8 # shift :: Int8 -> Int -> Int8 # rotate :: Int8 -> Int -> Int8 # setBit :: Int8 -> Int -> Int8 # clearBit :: Int8 -> Int -> Int8 # complementBit :: Int8 -> Int -> Int8 # testBit :: Int8 -> Int -> Bool # bitSizeMaybe :: Int8 -> Maybe Int # shiftL :: Int8 -> Int -> Int8 # unsafeShiftL :: Int8 -> Int -> Int8 # shiftR :: Int8 -> Int -> Int8 # unsafeShiftR :: Int8 -> Int -> Int8 # rotateL :: Int8 -> Int -> Int8 # | |
FiniteBits Int8 | Since: base-4.6.0.0 |
Defined in GHC.Int | |
Binary Int8 | |
NFData Int8 | |
Defined in Control.DeepSeq | |
ToConst Int8 | |
Defined in Language.C.Quote.Base | |
ToExp Int8 | |
Defined in Language.C.Quote.Base | |
Unbox Int8 | |
Defined in Data.Vector.Unboxed.Base | |
Prim Int8 | |
Defined in Data.Primitive.Types alignment# :: Int8 -> Int# indexByteArray# :: ByteArray# -> Int# -> Int8 readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int8 #) writeByteArray# :: MutableByteArray# s -> Int# -> Int8 -> State# s -> State# s setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Int8 -> State# s -> State# s indexOffAddr# :: Addr# -> Int# -> Int8 readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int8 #) writeOffAddr# :: Addr# -> Int# -> Int8 -> State# s -> State# s setOffAddr# :: Addr# -> Int# -> Int# -> Int8 -> State# s -> State# s | |
Pretty Int8 | |
Hashable Int8 | |
Defined in Data.Hashable.Class | |
IsValue Int8 Source # | |
IsPrimValue Int8 Source # | |
FromJSON Int8 | |
Defined in Data.Aeson.Types.FromJSON parseJSON :: Value -> Parser Int8 parseJSONList :: Value -> Parser [Int8] | |
FromJSONKey Int8 | |
Defined in Data.Aeson.Types.FromJSON fromJSONKey :: FromJSONKeyFunction Int8 fromJSONKeyList :: FromJSONKeyFunction [Int8] | |
ToJSON Int8 | |
Defined in Data.Aeson.Types.ToJSON | |
ToJSONKey Int8 | |
Defined in Data.Aeson.Types.ToJSON toJSONKey :: ToJSONKeyFunction Int8 toJSONKeyList :: ToJSONKeyFunction [Int8] | |
Random Int8 | |
Lift Int8 | |
IArray UArray Int8 | |
Defined in Data.Array.Base bounds :: Ix i => UArray i Int8 -> (i, i) # numElements :: Ix i => UArray i Int8 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Int8)] -> UArray i Int8 unsafeAt :: Ix i => UArray i Int8 -> Int -> Int8 unsafeReplace :: Ix i => UArray i Int8 -> [(Int, Int8)] -> UArray i Int8 unsafeAccum :: Ix i => (Int8 -> e' -> Int8) -> UArray i Int8 -> [(Int, e')] -> UArray i Int8 unsafeAccumArray :: Ix i => (Int8 -> e' -> Int8) -> Int8 -> (i, i) -> [(Int, e')] -> UArray i Int8 | |
Vector Vector Int8 | |
Defined in Data.Vector.Unboxed.Base basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) Int8 -> m (Vector Int8) basicUnsafeThaw :: PrimMonad m => Vector Int8 -> m (Mutable Vector (PrimState m) Int8) basicLength :: Vector Int8 -> Int basicUnsafeSlice :: Int -> Int -> Vector Int8 -> Vector Int8 basicUnsafeIndexM :: Monad m => Vector Int8 -> Int -> m Int8 basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Int8 -> Vector Int8 -> m () | |
MVector MVector Int8 | |
Defined in Data.Vector.Unboxed.Base basicLength :: MVector s Int8 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Int8 -> MVector s Int8 basicOverlaps :: MVector s Int8 -> MVector s Int8 -> Bool basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Int8) basicInitialize :: PrimMonad m => MVector (PrimState m) Int8 -> m () basicUnsafeReplicate :: PrimMonad m => Int -> Int8 -> m (MVector (PrimState m) Int8) basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Int8 -> Int -> m Int8 basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Int8 -> Int -> Int8 -> m () basicClear :: PrimMonad m => MVector (PrimState m) Int8 -> m () basicSet :: PrimMonad m => MVector (PrimState m) Int8 -> Int8 -> m () basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Int8 -> MVector (PrimState m) Int8 -> m () basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Int8 -> MVector (PrimState m) Int8 -> m () basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Int8 -> Int -> m (MVector (PrimState m) Int8) | |
MArray (STUArray s) Int8 (ST s) | |
Defined in Data.Array.Base getBounds :: Ix i => STUArray s i Int8 -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Int8 -> ST s Int newArray :: Ix i => (i, i) -> Int8 -> ST s (STUArray s i Int8) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int8) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int8) unsafeRead :: Ix i => STUArray s i Int8 -> Int -> ST s Int8 unsafeWrite :: Ix i => STUArray s i Int8 -> Int -> Int8 -> ST s () | |
newtype Vector Int8 | |
Defined in Data.Vector.Unboxed.Base | |
newtype MVector s Int8 | |
Defined in Data.Vector.Unboxed.Base |
16-bit signed integer type
Instances
Bounded Int16 | Since: base-2.1 |
Enum Int16 | Since: base-2.1 |
Eq Int16 | Since: base-2.1 |
Integral Int16 | Since: base-2.1 |
Num Int16 | Since: base-2.1 |
Ord Int16 | Since: base-2.1 |
Read Int16 | Since: base-2.1 |
Real Int16 | Since: base-2.1 |
Defined in GHC.Int toRational :: Int16 -> Rational # | |
Show Int16 | Since: base-2.1 |
Ix Int16 | Since: base-2.1 |
PrintfArg Int16 | Since: base-2.1 |
Defined in Text.Printf formatArg :: Int16 -> FieldFormatter # parseFormat :: Int16 -> ModifierParser # | |
Storable Int16 | Since: base-2.1 |
Bits Int16 | Since: base-2.1 |
Defined in GHC.Int (.&.) :: Int16 -> Int16 -> Int16 # (.|.) :: Int16 -> Int16 -> Int16 # xor :: Int16 -> Int16 -> Int16 # complement :: Int16 -> Int16 # shift :: Int16 -> Int -> Int16 # rotate :: Int16 -> Int -> Int16 # setBit :: Int16 -> Int -> Int16 # clearBit :: Int16 -> Int -> Int16 # complementBit :: Int16 -> Int -> Int16 # testBit :: Int16 -> Int -> Bool # bitSizeMaybe :: Int16 -> Maybe Int # shiftL :: Int16 -> Int -> Int16 # unsafeShiftL :: Int16 -> Int -> Int16 # shiftR :: Int16 -> Int -> Int16 # unsafeShiftR :: Int16 -> Int -> Int16 # rotateL :: Int16 -> Int -> Int16 # | |
FiniteBits Int16 | Since: base-4.6.0.0 |
Defined in GHC.Int finiteBitSize :: Int16 -> Int # countLeadingZeros :: Int16 -> Int # countTrailingZeros :: Int16 -> Int # | |
Binary Int16 | |
NFData Int16 | |
Defined in Control.DeepSeq | |
ToConst Int16 | |
Defined in Language.C.Quote.Base | |
ToExp Int16 | |
Defined in Language.C.Quote.Base | |
Unbox Int16 | |
Defined in Data.Vector.Unboxed.Base | |
Prim Int16 | |
Defined in Data.Primitive.Types alignment# :: Int16 -> Int# indexByteArray# :: ByteArray# -> Int# -> Int16 readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int16 #) writeByteArray# :: MutableByteArray# s -> Int# -> Int16 -> State# s -> State# s setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Int16 -> State# s -> State# s indexOffAddr# :: Addr# -> Int# -> Int16 readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int16 #) writeOffAddr# :: Addr# -> Int# -> Int16 -> State# s -> State# s setOffAddr# :: Addr# -> Int# -> Int# -> Int16 -> State# s -> State# s | |
Pretty Int16 | |
Hashable Int16 | |
Defined in Data.Hashable.Class | |
IsValue Int16 Source # | |
IsPrimValue Int16 Source # | |
FromJSON Int16 | |
Defined in Data.Aeson.Types.FromJSON parseJSON :: Value -> Parser Int16 parseJSONList :: Value -> Parser [Int16] | |
FromJSONKey Int16 | |
Defined in Data.Aeson.Types.FromJSON fromJSONKey :: FromJSONKeyFunction Int16 fromJSONKeyList :: FromJSONKeyFunction [Int16] | |
ToJSON Int16 | |
Defined in Data.Aeson.Types.ToJSON | |
ToJSONKey Int16 | |
Defined in Data.Aeson.Types.ToJSON toJSONKey :: ToJSONKeyFunction Int16 toJSONKeyList :: ToJSONKeyFunction [Int16] | |
Random Int16 | |
Lift Int16 | |
IArray UArray Int16 | |
Defined in Data.Array.Base bounds :: Ix i => UArray i Int16 -> (i, i) # numElements :: Ix i => UArray i Int16 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Int16)] -> UArray i Int16 unsafeAt :: Ix i => UArray i Int16 -> Int -> Int16 unsafeReplace :: Ix i => UArray i Int16 -> [(Int, Int16)] -> UArray i Int16 unsafeAccum :: Ix i => (Int16 -> e' -> Int16) -> UArray i Int16 -> [(Int, e')] -> UArray i Int16 unsafeAccumArray :: Ix i => (Int16 -> e' -> Int16) -> Int16 -> (i, i) -> [(Int, e')] -> UArray i Int16 | |
Vector Vector Int16 | |
Defined in Data.Vector.Unboxed.Base basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) Int16 -> m (Vector Int16) basicUnsafeThaw :: PrimMonad m => Vector Int16 -> m (Mutable Vector (PrimState m) Int16) basicLength :: Vector Int16 -> Int basicUnsafeSlice :: Int -> Int -> Vector Int16 -> Vector Int16 basicUnsafeIndexM :: Monad m => Vector Int16 -> Int -> m Int16 basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Int16 -> Vector Int16 -> m () | |
MVector MVector Int16 | |
Defined in Data.Vector.Unboxed.Base basicLength :: MVector s Int16 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Int16 -> MVector s Int16 basicOverlaps :: MVector s Int16 -> MVector s Int16 -> Bool basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Int16) basicInitialize :: PrimMonad m => MVector (PrimState m) Int16 -> m () basicUnsafeReplicate :: PrimMonad m => Int -> Int16 -> m (MVector (PrimState m) Int16) basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Int16 -> Int -> m Int16 basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Int16 -> Int -> Int16 -> m () basicClear :: PrimMonad m => MVector (PrimState m) Int16 -> m () basicSet :: PrimMonad m => MVector (PrimState m) Int16 -> Int16 -> m () basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Int16 -> MVector (PrimState m) Int16 -> m () basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Int16 -> MVector (PrimState m) Int16 -> m () basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Int16 -> Int -> m (MVector (PrimState m) Int16) | |
MArray (STUArray s) Int16 (ST s) | |
Defined in Data.Array.Base getBounds :: Ix i => STUArray s i Int16 -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Int16 -> ST s Int newArray :: Ix i => (i, i) -> Int16 -> ST s (STUArray s i Int16) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int16) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int16) unsafeRead :: Ix i => STUArray s i Int16 -> Int -> ST s Int16 unsafeWrite :: Ix i => STUArray s i Int16 -> Int -> Int16 -> ST s () | |
newtype Vector Int16 | |
Defined in Data.Vector.Unboxed.Base | |
newtype MVector s Int16 | |
Defined in Data.Vector.Unboxed.Base |
32-bit signed integer type
Instances
Bounded Int32 | Since: base-2.1 |
Enum Int32 | Since: base-2.1 |
Eq Int32 | Since: base-2.1 |
Integral Int32 | Since: base-2.1 |
Num Int32 | Since: base-2.1 |
Ord Int32 | Since: base-2.1 |
Read Int32 | Since: base-2.1 |
Real Int32 | Since: base-2.1 |
Defined in GHC.Int toRational :: Int32 -> Rational # | |
Show Int32 | Since: base-2.1 |
Ix Int32 | Since: base-2.1 |
PrintfArg Int32 | Since: base-2.1 |
Defined in Text.Printf formatArg :: Int32 -> FieldFormatter # parseFormat :: Int32 -> ModifierParser # | |
Storable Int32 | Since: base-2.1 |
Bits Int32 | Since: base-2.1 |
Defined in GHC.Int (.&.) :: Int32 -> Int32 -> Int32 # (.|.) :: Int32 -> Int32 -> Int32 # xor :: Int32 -> Int32 -> Int32 # complement :: Int32 -> Int32 # shift :: Int32 -> Int -> Int32 # rotate :: Int32 -> Int -> Int32 # setBit :: Int32 -> Int -> Int32 # clearBit :: Int32 -> Int -> Int32 # complementBit :: Int32 -> Int -> Int32 # testBit :: Int32 -> Int -> Bool # bitSizeMaybe :: Int32 -> Maybe Int # shiftL :: Int32 -> Int -> Int32 # unsafeShiftL :: Int32 -> Int -> Int32 # shiftR :: Int32 -> Int -> Int32 # unsafeShiftR :: Int32 -> Int -> Int32 # rotateL :: Int32 -> Int -> Int32 # | |
FiniteBits Int32 | Since: base-4.6.0.0 |
Defined in GHC.Int finiteBitSize :: Int32 -> Int # countLeadingZeros :: Int32 -> Int # countTrailingZeros :: Int32 -> Int # | |
Binary Int32 | |
NFData Int32 | |
Defined in Control.DeepSeq | |
ToConst Int32 | |
Defined in Language.C.Quote.Base | |
ToExp Int32 | |
Defined in Language.C.Quote.Base | |
Unbox Int32 | |
Defined in Data.Vector.Unboxed.Base | |
Prim Int32 | |
Defined in Data.Primitive.Types alignment# :: Int32 -> Int# indexByteArray# :: ByteArray# -> Int# -> Int32 readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Int32 #) writeByteArray# :: MutableByteArray# s -> Int# -> Int32 -> State# s -> State# s setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Int32 -> State# s -> State# s indexOffAddr# :: Addr# -> Int# -> Int32 readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Int32 #) writeOffAddr# :: Addr# -> Int# -> Int32 -> State# s -> State# s setOffAddr# :: Addr# -> Int# -> Int# -> Int32 -> State# s -> State# s | |
Pretty Int32 | |
Hashable Int32 | |
Defined in Data.Hashable.Class | |
IsValue Int32 Source # | |
IsPrimValue Int32 Source # | |
ToMarkup Int32 | |
Defined in Text.Blaze preEscapedToMarkup :: Int32 -> Markup | |
ToValue Int32 | |
Defined in Text.Blaze toValue :: Int32 -> AttributeValue preEscapedToValue :: Int32 -> AttributeValue | |
FromJSON Int32 | |
Defined in Data.Aeson.Types.FromJSON parseJSON :: Value -> Parser Int32 parseJSONList :: Value -> Parser [Int32] | |
FromJSONKey Int32 | |
Defined in Data.Aeson.Types.FromJSON fromJSONKey :: FromJSONKeyFunction Int32 fromJSONKeyList :: FromJSONKeyFunction [Int32] | |
ToJSON Int32 | |
Defined in Data.Aeson.Types.ToJSON | |
ToJSONKey Int32 | |
Defined in Data.Aeson.Types.ToJSON toJSONKey :: ToJSONKeyFunction Int32 toJSONKeyList :: ToJSONKeyFunction [Int32] | |
Random Int32 | |
Lift Int32 | |
IArray UArray Int32 | |
Defined in Data.Array.Base bounds :: Ix i => UArray i Int32 -> (i, i) # numElements :: Ix i => UArray i Int32 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Int32)] -> UArray i Int32 unsafeAt :: Ix i => UArray i Int32 -> Int -> Int32 unsafeReplace :: Ix i => UArray i Int32 -> [(Int, Int32)] -> UArray i Int32 unsafeAccum :: Ix i => (Int32 -> e' -> Int32) -> UArray i Int32 -> [(Int, e')] -> UArray i Int32 unsafeAccumArray :: Ix i => (Int32 -> e' -> Int32) -> Int32 -> (i, i) -> [(Int, e')] -> UArray i Int32 | |
Vector Vector Int32 | |
Defined in Data.Vector.Unboxed.Base basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) Int32 -> m (Vector Int32) basicUnsafeThaw :: PrimMonad m => Vector Int32 -> m (Mutable Vector (PrimState m) Int32) basicLength :: Vector Int32 -> Int basicUnsafeSlice :: Int -> Int -> Vector Int32 -> Vector Int32 basicUnsafeIndexM :: Monad m => Vector Int32 -> Int -> m Int32 basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Int32 -> Vector Int32 -> m () | |
MVector MVector Int32 | |
Defined in Data.Vector.Unboxed.Base basicLength :: MVector s Int32 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Int32 -> MVector s Int32 basicOverlaps :: MVector s Int32 -> MVector s Int32 -> Bool basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Int32) basicInitialize :: PrimMonad m => MVector (PrimState m) Int32 -> m () basicUnsafeReplicate :: PrimMonad m => Int -> Int32 -> m (MVector (PrimState m) Int32) basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Int32 -> Int -> m Int32 basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Int32 -> Int -> Int32 -> m () basicClear :: PrimMonad m => MVector (PrimState m) Int32 -> m () basicSet :: PrimMonad m => MVector (PrimState m) Int32 -> Int32 -> m () basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Int32 -> MVector (PrimState m) Int32 -> m () basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Int32 -> MVector (PrimState m) Int32 -> m () basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Int32 -> Int -> m (MVector (PrimState m) Int32) | |
Pretty (ShapeDecl Int32) | |
MArray (STUArray s) Int32 (ST s) | |
Defined in Data.Array.Base getBounds :: Ix i => STUArray s i Int32 -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Int32 -> ST s Int newArray :: Ix i => (i, i) -> Int32 -> ST s (STUArray s i Int32) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int32) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int32) unsafeRead :: Ix i => STUArray s i Int32 -> Int -> ST s Int32 unsafeWrite :: Ix i => STUArray s i Int32 -> Int -> Int32 -> ST s () | |
newtype Vector Int32 | |
Defined in Data.Vector.Unboxed.Base | |
newtype MVector s Int32 | |
Defined in Data.Vector.Unboxed.Base |
64-bit signed integer type
Instances
8-bit unsigned integer type
Instances
Bounded Word8 | Since: base-2.1 |
Enum Word8 | Since: base-2.1 |
Eq Word8 | Since: base-2.1 |
Integral Word8 | Since: base-2.1 |
Num Word8 | Since: base-2.1 |
Ord Word8 | Since: base-2.1 |
Read Word8 | Since: base-2.1 |
Real Word8 | Since: base-2.1 |
Defined in GHC.Word toRational :: Word8 -> Rational # | |
Show Word8 | Since: base-2.1 |
Ix Word8 | Since: base-2.1 |
PrintfArg Word8 | Since: base-2.1 |
Defined in Text.Printf formatArg :: Word8 -> FieldFormatter # parseFormat :: Word8 -> ModifierParser # | |
Storable Word8 | Since: base-2.1 |
Bits Word8 | Since: base-2.1 |
Defined in GHC.Word (.&.) :: Word8 -> Word8 -> Word8 # (.|.) :: Word8 -> Word8 -> Word8 # xor :: Word8 -> Word8 -> Word8 # complement :: Word8 -> Word8 # shift :: Word8 -> Int -> Word8 # rotate :: Word8 -> Int -> Word8 # setBit :: Word8 -> Int -> Word8 # clearBit :: Word8 -> Int -> Word8 # complementBit :: Word8 -> Int -> Word8 # testBit :: Word8 -> Int -> Bool # bitSizeMaybe :: Word8 -> Maybe Int # shiftL :: Word8 -> Int -> Word8 # unsafeShiftL :: Word8 -> Int -> Word8 # shiftR :: Word8 -> Int -> Word8 # unsafeShiftR :: Word8 -> Int -> Word8 # rotateL :: Word8 -> Int -> Word8 # | |
FiniteBits Word8 | Since: base-4.6.0.0 |
Defined in GHC.Word finiteBitSize :: Word8 -> Int # countLeadingZeros :: Word8 -> Int # countTrailingZeros :: Word8 -> Int # | |
Binary Word8 | |
NFData Word8 | |
Defined in Control.DeepSeq | |
ToConst Word8 | |
Defined in Language.C.Quote.Base | |
ToExp Word8 | |
Defined in Language.C.Quote.Base | |
Unbox Word8 | |
Defined in Data.Vector.Unboxed.Base | |
Prim Word8 | |
Defined in Data.Primitive.Types alignment# :: Word8 -> Int# indexByteArray# :: ByteArray# -> Int# -> Word8 readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Word8 #) writeByteArray# :: MutableByteArray# s -> Int# -> Word8 -> State# s -> State# s setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Word8 -> State# s -> State# s indexOffAddr# :: Addr# -> Int# -> Word8 readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Word8 #) writeOffAddr# :: Addr# -> Int# -> Word8 -> State# s -> State# s setOffAddr# :: Addr# -> Int# -> Int# -> Word8 -> State# s -> State# s | |
Pretty Word8 | |
Hashable Word8 | |
Defined in Data.Hashable.Class | |
IsValue Word8 Source # | |
IsPrimValue Word8 Source # | |
FromJSON Word8 | |
Defined in Data.Aeson.Types.FromJSON parseJSON :: Value -> Parser Word8 parseJSONList :: Value -> Parser [Word8] | |
FromJSONKey Word8 | |
Defined in Data.Aeson.Types.FromJSON fromJSONKey :: FromJSONKeyFunction Word8 fromJSONKeyList :: FromJSONKeyFunction [Word8] | |
ToJSON Word8 | |
Defined in Data.Aeson.Types.ToJSON | |
ToJSONKey Word8 | |
Defined in Data.Aeson.Types.ToJSON toJSONKey :: ToJSONKeyFunction Word8 toJSONKeyList :: ToJSONKeyFunction [Word8] | |
ByteSource Word8 | |
Defined in Data.UUID.Types.Internal.Builder | |
Random Word8 | |
Lift Word8 | |
IArray UArray Word8 | |
Defined in Data.Array.Base bounds :: Ix i => UArray i Word8 -> (i, i) # numElements :: Ix i => UArray i Word8 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Word8)] -> UArray i Word8 unsafeAt :: Ix i => UArray i Word8 -> Int -> Word8 unsafeReplace :: Ix i => UArray i Word8 -> [(Int, Word8)] -> UArray i Word8 unsafeAccum :: Ix i => (Word8 -> e' -> Word8) -> UArray i Word8 -> [(Int, e')] -> UArray i Word8 unsafeAccumArray :: Ix i => (Word8 -> e' -> Word8) -> Word8 -> (i, i) -> [(Int, e')] -> UArray i Word8 | |
Vector Vector Word8 | |
Defined in Data.Vector.Unboxed.Base basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) Word8 -> m (Vector Word8) basicUnsafeThaw :: PrimMonad m => Vector Word8 -> m (Mutable Vector (PrimState m) Word8) basicLength :: Vector Word8 -> Int basicUnsafeSlice :: Int -> Int -> Vector Word8 -> Vector Word8 basicUnsafeIndexM :: Monad m => Vector Word8 -> Int -> m Word8 basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Word8 -> Vector Word8 -> m () | |
MVector MVector Word8 | |
Defined in Data.Vector.Unboxed.Base basicLength :: MVector s Word8 -> Int basicUnsafeSlice :: Int -> Int -> MVector s Word8 -> MVector s Word8 basicOverlaps :: MVector s Word8 -> MVector s Word8 -> Bool basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Word8) basicInitialize :: PrimMonad m => MVector (PrimState m) Word8 -> m () basicUnsafeReplicate :: PrimMonad m => Int -> Word8 -> m (MVector (PrimState m) Word8) basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Word8 -> Int -> m Word8 basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Word8 -> Int -> Word8 -> m () basicClear :: PrimMonad m => MVector (PrimState m) Word8 -> m () basicSet :: PrimMonad m => MVector (PrimState m) Word8 -> Word8 -> m () basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Word8 -> MVector (PrimState m) Word8 -> m () basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Word8 -> MVector (PrimState m) Word8 -> m () basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Word8 -> Int -> m (MVector (PrimState m) Word8) | |
UTF8Bytes [Word8] Int | |
MArray (STUArray s) Word8 (ST s) | |
Defined in Data.Array.Base getBounds :: Ix i => STUArray s i Word8 -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Word8 -> ST s Int newArray :: Ix i => (i, i) -> Word8 -> ST s (STUArray s i Word8) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word8) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word8) unsafeRead :: Ix i => STUArray s i Word8 -> Int -> ST s Word8 unsafeWrite :: Ix i => STUArray s i Word8 -> Int -> Word8 -> ST s () | |
newtype Vector Word8 | |
Defined in Data.Vector.Unboxed.Base | |
newtype MVector s Word8 | |
Defined in Data.Vector.Unboxed.Base | |
type ByteSink Word8 g | |
Defined in Data.UUID.Types.Internal.Builder type ByteSink Word8 g = Takes1Byte g |
16-bit unsigned integer type
Instances
32-bit unsigned integer type
Instances
64-bit unsigned integer type
Instances
Conversion operators try to generalise the from t0 x to t1
instructions from LLVM.
ZExt IntType IntType | Zero-extend the former integer type to the latter. If the new type is smaller, the result is a truncation. |
SExt IntType IntType | Sign-extend the former integer type to the latter. If the new type is smaller, the result is a truncation. |
FPConv FloatType FloatType | Convert value of the former floating-point type to the latter. If the new type is smaller, the result is a truncation. |
FPToUI FloatType IntType | Convert a floating-point value to the nearest unsigned integer (rounding towards zero). |
FPToSI FloatType IntType | Convert a floating-point value to the nearest signed integer (rounding towards zero). |
UIToFP IntType FloatType | Convert an unsigned integer to a floating-point value. |
SIToFP IntType FloatType | Convert a signed integer to a floating-point value. |
IToB IntType | Convert an integer to a boolean value. Zero becomes false; anything else is true. |
BToI IntType | Convert a boolean to an integer. True is converted to 1 and False to 0. |
Comparison operators are like BinOp
s, but they return Bool
s.
The somewhat ugly constructor names are straight out of LLVM.
CmpEq PrimType | All types equality. |
CmpUlt IntType | Unsigned less than. |
CmpUle IntType | Unsigned less than or equal. |
CmpSlt IntType | Signed less than. |
CmpSle IntType | Signed less than or equal. |
FCmpLt FloatType | Floating-point less than. |
FCmpLe FloatType | Floating-point less than or equal. |
CmpLlt | Boolean less than. |
CmpLle | Boolean less than or equal. |
Binary operators. These correspond closely to the binary operators in LLVM. Most are parametrised by their expected input and output types.
Add IntType | Integer addition. |
FAdd FloatType | Floating-point addition. |
Sub IntType | Integer subtraction. |
FSub FloatType | Floating-point subtraction. |
Mul IntType | Integer multiplication. |
FMul FloatType | Floating-point multiplication. |
UDiv IntType | Unsigned integer division. Rounds towards negativity infinity. Note: this is different from LLVM. |
SDiv IntType | Signed integer division. Rounds towards negativity infinity. Note: this is different from LLVM. |
FDiv FloatType | Floating-point division. |
FMod FloatType | Floating-point modulus. |
UMod IntType | Unsigned integer modulus; the countepart to |
SMod IntType | Signed integer modulus; the countepart to |
SQuot IntType | Signed integer division. Rounds towards zero.
This corresponds to the |
SRem IntType | Signed integer division. Rounds towards zero.
This corresponds to the |
SMin IntType | Returns the smallest of two signed integers. |
UMin IntType | Returns the smallest of two unsigned integers. |
FMin FloatType | Returns the smallest of two floating-point numbers. |
SMax IntType | Returns the greatest of two signed integers. |
UMax IntType | Returns the greatest of two unsigned integers. |
FMax FloatType | Returns the greatest of two floating-point numbers. |
Shl IntType | Left-shift. |
LShr IntType | Logical right-shift, zero-extended. |
AShr IntType | Arithmetic right-shift, sign-extended. |
And IntType | Bitwise and. |
Or IntType | Bitwise or. |
Xor IntType | Bitwise exclusive-or. |
Pow IntType | Integer exponentiation. |
FPow FloatType | Floating-point exponentiation. |
LogAnd | Boolean and - not short-circuiting. |
LogOr | Boolean or - not short-circuiting. |
Various unary operators. It is a bit ad-hoc what is a unary operator and what is a built-in function. Perhaps these should all go away eventually.
Not | E.g., |
Complement IntType | E.g., |
Abs IntType |
|
FAbs FloatType |
|
SSignum IntType | Signed sign function: |
USignum IntType | Unsigned sign function: |
Non-array values.
IntValue !IntValue | |
FloatValue !FloatValue | |
BoolValue !Bool | |
Checked | The only value of type |
data FloatValue Source #
A floating-point value.
Instances
An integer value.
Low-level primitive types.
Instances
Bounded PrimType Source # | |
Enum PrimType Source # | |
Defined in Futhark.Representation.Primitive | |
Eq PrimType Source # | |
Ord PrimType Source # | |
Defined in Futhark.Representation.Primitive | |
Show PrimType Source # | |
Pretty PrimType Source # | |
A floating point type.
Instances
Bounded FloatType Source # | |
Enum FloatType Source # | |
Defined in Futhark.Representation.Primitive succ :: FloatType -> FloatType # pred :: FloatType -> FloatType # fromEnum :: FloatType -> Int # enumFrom :: FloatType -> [FloatType] # enumFromThen :: FloatType -> FloatType -> [FloatType] # enumFromTo :: FloatType -> FloatType -> [FloatType] # enumFromThenTo :: FloatType -> FloatType -> FloatType -> [FloatType] # | |
Eq FloatType Source # | |
Ord FloatType Source # | |
Defined in Futhark.Representation.Primitive | |
Show FloatType Source # | |
Pretty FloatType Source # | |
An integer type, ordered by size. Note that signedness is not a property of the type, but a property of the operations performed on values of these types.
Instances
Bounded IntType Source # | |
Enum IntType Source # | |
Eq IntType Source # | |
Ord IntType Source # | |
Defined in Futhark.Representation.Primitive | |
Show IntType Source # | |
Pretty IntType Source # | |
allIntTypes :: [IntType] Source #
A list of all integer types.
allFloatTypes :: [FloatType] Source #
A list of all floating-point types.
allPrimTypes :: [PrimType] Source #
A list of all primitive types.
intValueType :: IntValue -> IntType Source #
floatValue :: Real num => FloatType -> num -> FloatValue Source #
Create a FloatValue
from a type and a Rational
.
floatValueType :: FloatValue -> FloatType Source #
primValueType :: PrimValue -> PrimType Source #
The type of a basic value.
blankPrimValue :: PrimType -> PrimValue Source #
A "blank" value of the given primitive type - this is zero, or whatever is close to it. Don't depend on this value, but use it for e.g. creating arrays to be populated by do-loops.
allConvOps :: [ConvOp] Source #
A list of all conversion operators for all types.
doComplement :: IntValue -> IntValue Source #
E.g., ~(~1) = 1
.
doFAbs :: FloatValue -> FloatValue Source #
abs(-2.0) = 2.0
.
doSDiv :: IntValue -> IntValue -> Maybe IntValue Source #
Signed integer division. Rounds towards negativity infinity. Note: this is different from LLVM.
doSMod :: IntValue -> IntValue -> Maybe IntValue Source #
Signed integer modulus; the countepart to SDiv
.
doZExt :: IntValue -> IntType -> IntValue Source #
Zero-extend the given integer value to the size of the given type. If the type is smaller than the given value, the result is a truncation.
doSExt :: IntValue -> IntType -> IntValue Source #
Sign-extend the given integer value to the size of the given type. If the type is smaller than the given value, the result is a truncation.
doFPConv :: FloatValue -> FloatType -> FloatValue Source #
Convert the former floating-point type to the latter.
doFPToUI :: FloatValue -> IntType -> IntValue Source #
Convert a floating-point value to the nearest unsigned integer (rounding towards zero).
doFPToSI :: FloatValue -> IntType -> IntValue Source #
Convert a floating-point value to the nearest signed integer (rounding towards zero).
doUIToFP :: IntValue -> FloatType -> FloatValue Source #
Convert an unsigned integer to a floating-point value.
doSIToFP :: IntValue -> FloatType -> FloatValue Source #
Convert a signed integer to a floating-point value.
doCmpEq :: PrimValue -> PrimValue -> Bool Source #
Compare any two primtive values for exact equality.
doFCmpLt :: FloatValue -> FloatValue -> Bool Source #
Floating-point less than.
doFCmpLe :: FloatValue -> FloatValue -> Bool Source #
Floating-point less than or equal.
intToWord64 :: IntValue -> Word64 Source #
convOpType :: ConvOp -> (PrimType, PrimType) Source #
The input and output types of a conversion operator.
primFuns :: Map String ([PrimType], PrimType, [PrimValue] -> Maybe PrimValue) Source #
A mapping from names of primitive functions to their parameter types, their result type, and a function for evaluating them.
negativeIsh :: PrimValue -> Bool Source #
Is the given value kind of negative?
zeroIshInt :: IntValue -> Bool Source #
Is the given integer value kind of zero?
primBitSize :: PrimType -> Int Source #
The size of a value of a given primitive type in bites.
primByteSize :: Num a => PrimType -> a Source #
The size of a value of a given primitive type in eight-bit bytes.
intByteSize :: Num a => IntType -> a Source #
The size of a value of a given integer type in eight-bit bytes.
floatByteSize :: Num a => FloatType -> a Source #
The size of a value of a given floating-point type in eight-bit bytes.
commutativeBinOp :: BinOp -> Bool Source #
True if the given binary operator is commutative.
prettySigned :: Bool -> PrimType -> String Source #
True if signed. Only makes a difference for integer types.
A name tagged with some integer. Only the integer is used in
comparisons, no matter the type of vn
.
Instances
The abstract (not really) type representing names in the Futhark
compiler. String
s, being lists of characters, are very slow,
while Text
s are based on byte-arrays.
Instances
data Commutativity Source #
Whether some operator is commutative or not. The Monoid
instance returns the least commutative of its arguments.
Instances
data Uniqueness Source #
The uniqueness attribute of a type. This essentially indicates
whether or not in-place modifications are acceptable. With respect
to ordering, Unique
is greater than Nonunique
.
Instances
defaultEntryPoint :: Name Source #
The name of the default program entry point (main).
nameToString :: Name -> String Source #
Convert a name to the corresponding list of characters.
nameFromString :: String -> Name Source #
Convert a list of characters to the corresponding name.
locStr :: Located a => a -> String Source #
A human-readable location string, of the form
filename:lineno:columnno
. This follows the GNU coding standards
for error messages:
https://www.gnu.org/prep/standards/html_node/Errors.html
This function assumes that both start and end position is in the same file (it is not clear what the alternative would even mean).
locStrRel :: (Located a, Located b) => a -> b -> String Source #
Like locStr
, but locStrRel prev now
prints the location now
with the file name left out if the same as prev
. This is useful
when printing messages that are all in the context of some
initially printed location (e.g. the first mention contains the
file name; the rest just line and column name).
prettyStacktrace :: Int -> [String] -> String Source #
Given a list of strings representing entries in the stack trace and the index of the frame to highlight, produce a final newline-terminated string for showing to the user. This string should also be preceded by a newline. The most recent stack frame must come first in the list.
quote :: String -> String Source #
Enclose a string in the prefered quotes used in error messages. These are picked to not collide with characters permitted in identifiers.
data ErrorMsgPart a Source #
A part of an error message.
ErrorString String | A literal string. |
ErrorInt32 a | A run-time integer value. |
Instances
An error message is a list of error parts, which are concatenated to form the final message.
ErrorMsg [ErrorMsgPart a] |
Instances
A subexpression is either a scalar constant or a variable. One important property is that evaluation of a subexpression is guaranteed to complete in constant time.
Instances
The memory space of a block. If DefaultSpace
, this is the "default"
space, whatever that is. The exact meaning of the SpaceID
depends on the backend used. In GPU kernels, for example, this is
used to distinguish between constant, global and shared memory
spaces. In GPU-enabled host code, it is used to distinguish
between host memory (DefaultSpace
) and GPU space.
DefaultSpace | |
Space SpaceId | |
ScalarSpace [SubExp] PrimType | A special kind of memory that is a statically sized array of some primitive type. Used for private memory on GPUs. |
errorMsgArgTypes :: ErrorMsg a -> [PrimType] Source #
How many non-constant parts does the error message have, and what is their type?
A wrapper supporting a phantom type for indicating what we are counting.
Instances
Functor (Count u) Source # | |
Foldable (Count u) Source # | |
Defined in Futhark.Representation.Kernels.Sizes fold :: Monoid m => Count u m -> m # foldMap :: Monoid m => (a -> m) -> Count u a -> m # foldMap' :: Monoid m => (a -> m) -> Count u a -> m # foldr :: (a -> b -> b) -> b -> Count u a -> b # foldr' :: (a -> b -> b) -> b -> Count u a -> b # foldl :: (b -> a -> b) -> b -> Count u a -> b # foldl' :: (b -> a -> b) -> b -> Count u a -> b # foldr1 :: (a -> a -> a) -> Count u a -> a # foldl1 :: (a -> a -> a) -> Count u a -> a # elem :: Eq a => a -> Count u a -> Bool # maximum :: Ord a => Count u a -> a # minimum :: Ord a => Count u a -> a # | |
Traversable (Count u) Source # | |
Eq e => Eq (Count u e) Source # | |
Num e => Num (Count u e) Source # | |
Defined in Futhark.Representation.Kernels.Sizes | |
Ord e => Ord (Count u e) Source # | |
Defined in Futhark.Representation.Kernels.Sizes | |
Show e => Show (Count u e) Source # | |
Pretty e => Pretty (Count u e) Source # | |
IntegralExp e => IntegralExp (Count u e) Source # | |
Defined in Futhark.Representation.Kernels.Sizes quot :: Count u e -> Count u e -> Count u e Source # rem :: Count u e -> Count u e -> Count u e Source # div :: Count u e -> Count u e -> Count u e Source # mod :: Count u e -> Count u e -> Count u e Source # sgn :: Count u e -> Maybe Int Source # fromInt8 :: Int8 -> Count u e Source # fromInt16 :: Int16 -> Count u e Source # | |
FreeIn e => FreeIn (Count u e) Source # | |
A primitive expression parametrised over the representation of
free variables. Note that the Functor
, Traversable
, and Num
instances perform automatic (but simple) constant folding.
LeafExp v PrimType | |
ValueExp PrimValue | |
BinOpExp BinOp (PrimExp v) (PrimExp v) | |
CmpOpExp CmpOp (PrimExp v) (PrimExp v) | |
UnOpExp UnOp (PrimExp v) | |
ConvOpExp ConvOp (PrimExp v) | |
FunExp String [PrimExp v] PrimType |
Instances
constFoldPrimExp :: PrimExp v -> PrimExp v Source #
Perform quick and dirty constant folding on the top level of a PrimExp. This is necessary because we want to consider e.g. equality modulo constant folding.
(.<.) :: PrimExp v -> PrimExp v -> PrimExp v infix 4 Source #
Lifted relational operators; assuming signed numbers in case of integers.
(.<=.) :: PrimExp v -> PrimExp v -> PrimExp v infix 4 Source #
Lifted relational operators; assuming signed numbers in case of integers.
(.==.) :: PrimExp v -> PrimExp v -> PrimExp v infix 4 Source #
Lifted relational operators; assuming signed numbers in case of integers.
(.>.) :: PrimExp v -> PrimExp v -> PrimExp v infix 4 Source #
Lifted relational operators; assuming signed numbers in case of integers.
(.>=.) :: PrimExp v -> PrimExp v -> PrimExp v infix 4 Source #
Lifted relational operators; assuming signed numbers in case of integers.
primExpType :: PrimExp v -> PrimType Source #
data Volatility Source #
The volatility of a memory access or variable. Feel free to ignore this for backends where it makes no sense (anything but C and similar low-level things)
Instances
Eq Volatility Source # | |
Defined in Futhark.CodeGen.ImpCode (==) :: Volatility -> Volatility -> Bool # (/=) :: Volatility -> Volatility -> Bool # | |
Ord Volatility Source # | |
Defined in Futhark.CodeGen.ImpCode compare :: Volatility -> Volatility -> Ordering # (<) :: Volatility -> Volatility -> Bool # (<=) :: Volatility -> Volatility -> Bool # (>) :: Volatility -> Volatility -> Bool # (>=) :: Volatility -> Volatility -> Bool # max :: Volatility -> Volatility -> Volatility # min :: Volatility -> Volatility -> Volatility # | |
Show Volatility Source # | |
Defined in Futhark.CodeGen.ImpCode showsPrec :: Int -> Volatility -> ShowS # show :: Volatility -> String # showList :: [Volatility] -> ShowS # |
pattern DebugPrint :: String -> Maybe Exp -> Code a Source #
Print the given value to the screen, somehow annotated with the given string as a description. If no type/value pair, just print the string. This has no semantic meaning, but is used entirely for debugging. Code generators are free to ignore this statement.
pattern Write :: VName -> Count Elements Exp -> PrimType -> Space -> Volatility -> Exp -> Code a Source #
pattern DeclareArray :: VName -> Space -> PrimType -> ArrayContents -> Code a Source #
Create an array containing the given values. The lifetime of the array will be the entire application. This is mostly used for constant arrays, but also for some bookkeeping data, like the synchronisation counts used to implement reduction.
pattern DeclareScalar :: VName -> Volatility -> PrimType -> Code a Source #
pattern Free :: VName -> Space -> Code a Source #
Indicate that some memory block will never again be referenced via the indicated variable. However, it may still be accessed through aliases. It is only safe to actually deallocate the memory block if this is the last reference. There is no guarantee that all memory blocks will be freed with this statement. Backends are free to ignore it entirely.
pattern Comment :: String -> Code a -> Code a Source #
Has the same semantics as the contained code, but the comment should show up in generated code for ease of inspection.
pattern Copy :: VName -> Count Bytes Exp -> Space -> VName -> Count Bytes Exp -> Space -> Count Bytes Exp -> Code a Source #
Destination, offset in destination, destination space, source, offset in source, offset space, number of bytes.
pattern Allocate :: VName -> Count Bytes Exp -> Space -> Code a Source #
Memory space must match the corresponding
DeclareMem
.
data ArrayContents Source #
The contents of a statically declared constant array. Such arrays are always unidimensional, and reshaped if necessary in the code that uses them.
ArrayValues [PrimValue] | Precisely these values. |
ArrayZeros Int | This many zeroes. |
Instances
Show ArrayContents Source # | |
Defined in Futhark.CodeGen.ImpCode showsPrec :: Int -> ArrayContents -> ShowS # show :: ArrayContents -> String # showList :: [ArrayContents] -> ShowS # | |
Pretty ArrayContents Source # | |
Defined in Futhark.CodeGen.ImpCode |
A imperative function, containing the body as well as its low-level inputs and outputs, as well as its high-level arguments and results. The latter are only used if the function is an entry point.
Instances
Functor FunctionT Source # | |
Foldable FunctionT Source # | |
Defined in Futhark.CodeGen.ImpCode fold :: Monoid m => FunctionT m -> m # foldMap :: Monoid m => (a -> m) -> FunctionT a -> m # foldMap' :: Monoid m => (a -> m) -> FunctionT a -> m # foldr :: (a -> b -> b) -> b -> FunctionT a -> b # foldr' :: (a -> b -> b) -> b -> FunctionT a -> b # foldl :: (b -> a -> b) -> b -> FunctionT a -> b # foldl' :: (b -> a -> b) -> b -> FunctionT a -> b # foldr1 :: (a -> a -> a) -> FunctionT a -> a # foldl1 :: (a -> a -> a) -> FunctionT a -> a # toList :: FunctionT a -> [a] # length :: FunctionT a -> Int # elem :: Eq a => a -> FunctionT a -> Bool # maximum :: Ord a => FunctionT a -> a # minimum :: Ord a => FunctionT a -> a # | |
Traversable FunctionT Source # | |
Defined in Futhark.CodeGen.ImpCode | |
Show a => Show (FunctionT a) Source # | |
Pretty op => Pretty (FunctionT op) Source # | |
data ExternalValue Source #
^ An externally visible value. This can be an opaque value (covering several physical internal values), or a single value that can be used externally.
OpaqueValue String [ValueDesc] | The string is a human-readable description with no other semantics. |
TransparentValue ValueDesc |
Instances
Show ExternalValue Source # | |
Defined in Futhark.CodeGen.ImpCode showsPrec :: Int -> ExternalValue -> ShowS # show :: ExternalValue -> String # showList :: [ExternalValue] -> ShowS # | |
Pretty ExternalValue Source # | |
Defined in Futhark.CodeGen.ImpCode |
A description of an externally meaningful value.
ArrayValue VName Space PrimType Signedness [DimSize] | An array with memory block, memory block size, memory space, element type, signedness of element type (if applicable), and shape. |
ScalarValue PrimType Signedness VName | A scalar value with signedness if applicable. |
data Signedness Source #
Instances
Eq Signedness Source # | |
Defined in Futhark.CodeGen.ImpCode (==) :: Signedness -> Signedness -> Bool # (/=) :: Signedness -> Signedness -> Bool # | |
Show Signedness Source # | |
Defined in Futhark.CodeGen.ImpCode showsPrec :: Int -> Signedness -> ShowS # show :: Signedness -> String # showList :: [Signedness] -> ShowS # |
A collection of imperative constants.
Constants | |
|
A collection of imperative functions.
Instances
Functor Functions Source # | |
Foldable Functions Source # | |
Defined in Futhark.CodeGen.ImpCode fold :: Monoid m => Functions m -> m # foldMap :: Monoid m => (a -> m) -> Functions a -> m # foldMap' :: Monoid m => (a -> m) -> Functions a -> m # foldr :: (a -> b -> b) -> b -> Functions a -> b # foldr' :: (a -> b -> b) -> b -> Functions a -> b # foldl :: (b -> a -> b) -> b -> Functions a -> b # foldl' :: (b -> a -> b) -> b -> Functions a -> b # foldr1 :: (a -> a -> a) -> Functions a -> a # foldl1 :: (a -> a -> a) -> Functions a -> a # toList :: Functions a -> [a] # length :: Functions a -> Int # elem :: Eq a => a -> Functions a -> Bool # maximum :: Ord a => Functions a -> a # minimum :: Ord a => Functions a -> a # | |
Traversable Functions Source # | |
Defined in Futhark.CodeGen.ImpCode | |
Semigroup (Functions a) Source # | |
Monoid (Functions a) Source # | |
Pretty op => Pretty (Functions op) Source # | |
FreeIn a => FreeIn (Functions a) Source # | |
data Definitions a Source #
A collection of imperative functions and constants.
Definitions (Constants a) (Functions a) |
Instances
Pretty op => Pretty (Definitions op) Source # | |
Defined in Futhark.CodeGen.ImpCode ppr :: Definitions op -> Doc pprPrec :: Int -> Definitions op -> Doc pprList :: [Definitions op] -> Doc |