Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- letSubExp :: MonadBinder m => String -> Exp (Lore m) -> m SubExp
- letSubExps :: MonadBinder m => String -> [Exp (Lore m)] -> m [SubExp]
- letExp :: MonadBinder m => String -> Exp (Lore m) -> m VName
- letExps :: MonadBinder m => String -> [Exp (Lore m)] -> m [VName]
- letTupExp :: MonadBinder m => String -> Exp (Lore m) -> m [VName]
- letTupExp' :: MonadBinder m => String -> Exp (Lore m) -> m [SubExp]
- letInPlace :: MonadBinder m => String -> VName -> Slice SubExp -> Exp (Lore m) -> m VName
- eSubExp :: MonadBinder m => SubExp -> m (Exp (Lore m))
- eIf :: (MonadBinder m, BranchType (Lore m) ~ ExtType) => m (Exp (Lore m)) -> m (Body (Lore m)) -> m (Body (Lore m)) -> m (Exp (Lore m))
- eIf' :: (MonadBinder m, BranchType (Lore m) ~ ExtType) => m (Exp (Lore m)) -> m (Body (Lore m)) -> m (Body (Lore m)) -> IfSort -> m (Exp (Lore m))
- eBinOp :: MonadBinder m => BinOp -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m))
- eCmpOp :: MonadBinder m => CmpOp -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m))
- eConvOp :: MonadBinder m => ConvOp -> m (Exp (Lore m)) -> m (Exp (Lore m))
- eNegate :: MonadBinder m => m (Exp (Lore m)) -> m (Exp (Lore m))
- eNot :: MonadBinder m => m (Exp (Lore m)) -> m (Exp (Lore m))
- eAbs :: MonadBinder m => m (Exp (Lore m)) -> m (Exp (Lore m))
- eSignum :: MonadBinder m => m (Exp (Lore m)) -> m (Exp (Lore m))
- eCopy :: MonadBinder m => m (Exp (Lore m)) -> m (Exp (Lore m))
- eAssert :: MonadBinder m => m (Exp (Lore m)) -> ErrorMsg SubExp -> SrcLoc -> m (Exp (Lore m))
- eBody :: MonadBinder m => [m (Exp (Lore m))] -> m (Body (Lore m))
- eLambda :: MonadBinder m => Lambda (Lore m) -> [m (Exp (Lore m))] -> m [SubExp]
- eDivRoundingUp :: MonadBinder m => IntType -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m))
- eRoundToMultipleOf :: MonadBinder m => IntType -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m))
- eSliceArray :: MonadBinder m => Int -> VName -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m))
- eSplitArray :: MonadBinder m => VName -> [m (Exp (Lore m))] -> m [Exp (Lore m)]
- eWriteArray :: (MonadBinder m, BranchType (Lore m) ~ ExtType) => VName -> [m (Exp (Lore m))] -> m (Exp (Lore m)) -> m (Exp (Lore m))
- asIntZ :: MonadBinder m => IntType -> SubExp -> m SubExp
- asIntS :: MonadBinder m => IntType -> SubExp -> m SubExp
- resultBody :: Bindable lore => [SubExp] -> Body lore
- resultBodyM :: MonadBinder m => [SubExp] -> m (Body (Lore m))
- insertStmsM :: MonadBinder m => m (Body (Lore m)) -> m (Body (Lore m))
- mapResult :: Bindable lore => (Result -> Body lore) -> Body lore -> Body lore
- foldBinOp :: MonadBinder m => BinOp -> SubExp -> [SubExp] -> m (Exp (Lore m))
- binOpLambda :: (MonadBinder m, Bindable (Lore m)) => BinOp -> PrimType -> m (Lambda (Lore m))
- cmpOpLambda :: (MonadBinder m, Bindable (Lore m)) => CmpOp -> PrimType -> m (Lambda (Lore m))
- fullSlice :: Type -> [DimIndex SubExp] -> Slice SubExp
- fullSliceNum :: Num d => [d] -> [DimIndex d] -> Slice d
- isFullSlice :: Shape -> Slice SubExp -> Bool
- ifCommon :: [Type] -> IfAttr ExtType
- module Futhark.Binder
- instantiateShapes :: Monad m => (Int -> m SubExp) -> [TypeBase ExtShape u] -> m [TypeBase Shape u]
- instantiateShapes' :: MonadFreshNames m => [TypeBase ExtShape u] -> m ([TypeBase Shape u], [Ident])
- instantiateShapesFromIdentList :: [Ident] -> [ExtType] -> [Type]
- instantiateExtTypes :: [VName] -> [ExtType] -> [Ident]
- instantiateIdents :: [VName] -> [ExtType] -> Maybe ([Ident], [Ident])
- removeExistentials :: ExtType -> Type -> Type
- simpleMkLetNames :: (ExpAttr lore ~ (), LetAttr lore ~ Type, MonadFreshNames m, TypedOp (Op lore), HasScope lore m) => [VName] -> Exp lore -> m (Stm lore)
- class ToExp a where
- toExp :: MonadBinder m => a -> m (Exp (Lore m))
Documentation
letSubExps :: MonadBinder m => String -> [Exp (Lore m)] -> m [SubExp] Source #
letTupExp' :: MonadBinder m => String -> Exp (Lore m) -> m [SubExp] Source #
eIf :: (MonadBinder m, BranchType (Lore m) ~ ExtType) => m (Exp (Lore m)) -> m (Body (Lore m)) -> m (Body (Lore m)) -> m (Exp (Lore m)) Source #
eIf' :: (MonadBinder m, BranchType (Lore m) ~ ExtType) => m (Exp (Lore m)) -> m (Body (Lore m)) -> m (Body (Lore m)) -> IfSort -> m (Exp (Lore m)) Source #
eBinOp :: MonadBinder m => BinOp -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m)) Source #
eCmpOp :: MonadBinder m => CmpOp -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m)) Source #
eAssert :: MonadBinder m => m (Exp (Lore m)) -> ErrorMsg SubExp -> SrcLoc -> m (Exp (Lore m)) Source #
eDivRoundingUp :: MonadBinder m => IntType -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m)) Source #
Note: unsigned division.
eRoundToMultipleOf :: MonadBinder m => IntType -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m)) Source #
eSliceArray :: MonadBinder m => Int -> VName -> m (Exp (Lore m)) -> m (Exp (Lore m)) -> m (Exp (Lore m)) Source #
Construct an Index
expressions that slices an array with unit stride.
eSplitArray :: MonadBinder m => VName -> [m (Exp (Lore m))] -> m [Exp (Lore m)] Source #
Construct an Index
expressions that splits an array in different parts along the outer dimension.
eWriteArray :: (MonadBinder m, BranchType (Lore m) ~ ExtType) => VName -> [m (Exp (Lore m))] -> m (Exp (Lore m)) -> m (Exp (Lore m)) Source #
Write to an index of the array, if within bounds. Otherwise, nothing. Produces the updated array.
asIntZ :: MonadBinder m => IntType -> SubExp -> m SubExp Source #
Zero-extend to the given integer type.
asIntS :: MonadBinder m => IntType -> SubExp -> m SubExp Source #
Sign-extend to the given integer type.
resultBody :: Bindable lore => [SubExp] -> Body lore Source #
Conveniently construct a body that contains no bindings.
resultBodyM :: MonadBinder m => [SubExp] -> m (Body (Lore m)) Source #
Conveniently construct a body that contains no bindings - but this time, monadically!
insertStmsM :: MonadBinder m => m (Body (Lore m)) -> m (Body (Lore m)) Source #
Evaluate the action, producing a body, then wrap it in all the
bindings it created using addStm
.
mapResult :: Bindable lore => (Result -> Body lore) -> Body lore -> Body lore Source #
Change that result where evaluation of the body would stop. Also change type annotations at branches.
foldBinOp :: MonadBinder m => BinOp -> SubExp -> [SubExp] -> m (Exp (Lore m)) Source #
Apply a binary operator to several subexpressions. A left-fold.
binOpLambda :: (MonadBinder m, Bindable (Lore m)) => BinOp -> PrimType -> m (Lambda (Lore m)) Source #
Create a two-parameter lambda whose body applies the given binary operation to its arguments. It is assumed that both argument and result types are the same. (This assumption should be fixed at some point.)
cmpOpLambda :: (MonadBinder m, Bindable (Lore m)) => CmpOp -> PrimType -> m (Lambda (Lore m)) Source #
As binOpLambda
, but for BasicOp
s.
fullSliceNum :: Num d => [d] -> [DimIndex d] -> Slice d Source #
Like fullSlice
, but the dimensions are simply numeric.
isFullSlice :: Shape -> Slice SubExp -> Bool Source #
Does the slice describe the full size of the array? The most
obvious such slice is one that DimSlice
s the full span of every
dimension, but also one that fixes all unit dimensions.
module Futhark.Binder
Result types
instantiateShapes :: Monad m => (Int -> m SubExp) -> [TypeBase ExtShape u] -> m [TypeBase Shape u] Source #
instantiateShapes' :: MonadFreshNames m => [TypeBase ExtShape u] -> m ([TypeBase Shape u], [Ident]) Source #
Convenience
simpleMkLetNames :: (ExpAttr lore ~ (), LetAttr lore ~ Type, MonadFreshNames m, TypedOp (Op lore), HasScope lore m) => [VName] -> Exp lore -> m (Stm lore) Source #
Can be used as the definition of mkLetNames
for a Bindable
instance for simple representations.
Instances of this class can be converted to Futhark expressions
within a MonadBinder
.