{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
module Futhark.Representation.SOACS
(
SOACS
, Body
, Stm
, Pattern
, Exp
, Lambda
, FParam
, LParam
, RetType
, PatElem
, module Futhark.Representation.AST.Attributes
, module Futhark.Representation.AST.Traversals
, module Futhark.Representation.AST.Pretty
, module Futhark.Representation.AST.Syntax
, module Futhark.Representation.SOACS.SOAC
, AST.LambdaT(Lambda)
, AST.BodyT(Body)
, AST.PatternT(Pattern)
, AST.PatElemT(PatElem)
)
where
import qualified Futhark.Representation.AST.Syntax as AST
import Futhark.Representation.AST.Syntax
hiding (Exp, Body, Stm,
Pattern, Lambda, FParam, LParam, RetType, PatElem)
import Futhark.Representation.SOACS.SOAC
import Futhark.Representation.AST.Attributes
import Futhark.Representation.AST.Traversals
import Futhark.Representation.AST.Pretty
import Futhark.Binder
import Futhark.Construct
import qualified Futhark.TypeCheck as TypeCheck
data SOACS
instance Annotations SOACS where
type Op SOACS = SOAC SOACS
instance Attributes SOACS where
expTypesFromPattern :: Pattern SOACS -> m [BranchType SOACS]
expTypesFromPattern = [ExtType] -> m [ExtType]
forall (m :: * -> *) a. Monad m => a -> m a
return ([ExtType] -> m [ExtType])
-> (PatternT Type -> [ExtType]) -> PatternT Type -> m [ExtType]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PatternT Type -> [ExtType]
forall attr. Typed attr => PatternT attr -> [ExtType]
expExtTypesFromPattern
type Exp = AST.Exp SOACS
type Body = AST.Body SOACS
type Stm = AST.Stm SOACS
type Pattern = AST.Pattern SOACS
type Lambda = AST.Lambda SOACS
type FParam = AST.FParam SOACS
type LParam = AST.LParam SOACS
type RetType = AST.RetType SOACS
type PatElem = AST.PatElem SOACS
instance TypeCheck.CheckableOp SOACS where
checkOp :: OpWithAliases (Op SOACS) -> TypeM SOACS ()
checkOp = OpWithAliases (Op SOACS) -> TypeM SOACS ()
forall lore. Checkable lore => SOAC (Aliases lore) -> TypeM lore ()
typeCheckSOAC
instance TypeCheck.Checkable SOACS where
instance Bindable SOACS where
mkBody :: Stms SOACS -> Result -> Body SOACS
mkBody = BodyAttr SOACS -> Stms SOACS -> Result -> Body SOACS
forall lore. BodyAttr lore -> Stms lore -> Result -> BodyT lore
AST.Body ()
mkExpPat :: [Ident] -> [Ident] -> Exp SOACS -> Pattern SOACS
mkExpPat [Ident]
ctx [Ident]
val Exp SOACS
_ = [Ident] -> [Ident] -> PatternT Type
basicPattern [Ident]
ctx [Ident]
val
mkExpAttr :: Pattern SOACS -> Exp SOACS -> ExpAttr SOACS
mkExpAttr Pattern SOACS
_ Exp SOACS
_ = ()
mkLetNames :: [VName] -> Exp SOACS -> m (Stm SOACS)
mkLetNames = [VName] -> Exp SOACS -> m (Stm SOACS)
forall lore (m :: * -> *).
(ExpAttr lore ~ (), LetAttr lore ~ Type, MonadFreshNames m,
TypedOp (Op lore), HasScope lore m) =>
[VName] -> Exp lore -> m (Stm lore)
simpleMkLetNames
instance BinderOps SOACS where
mkExpAttrB :: Pattern SOACS -> Exp SOACS -> m (ExpAttr SOACS)
mkExpAttrB = Pattern SOACS -> Exp SOACS -> m (ExpAttr SOACS)
forall (m :: * -> *).
(MonadBinder m, Bindable (Lore m)) =>
Pattern (Lore m) -> Exp (Lore m) -> m (ExpAttr (Lore m))
bindableMkExpAttrB
mkBodyB :: Stms SOACS -> Result -> m (Body SOACS)
mkBodyB = Stms SOACS -> Result -> m (Body SOACS)
forall (m :: * -> *).
(MonadBinder m, Bindable (Lore m)) =>
Stms (Lore m) -> Result -> m (Body (Lore m))
bindableMkBodyB
mkLetNamesB :: [VName] -> Exp SOACS -> m (Stm SOACS)
mkLetNamesB = [VName] -> Exp SOACS -> m (Stm SOACS)
forall (m :: * -> *).
(MonadBinder m, Bindable (Lore m)) =>
[VName] -> Exp (Lore m) -> m (Stm (Lore m))
bindableMkLetNamesB
instance PrettyLore SOACS where