{-# LANGUAGE TypeFamilies #-}
module Futhark.IR.Seq
( Seq,
simplifyProg,
module Futhark.IR.Prop,
module Futhark.IR.Traversals,
module Futhark.IR.Pretty,
module Futhark.IR.Syntax,
)
where
import Futhark.Builder
import Futhark.Construct
import Futhark.IR.Pretty
import Futhark.IR.Prop
import Futhark.IR.Syntax
import Futhark.IR.Traversals
import Futhark.IR.TypeCheck qualified as TC
import Futhark.Optimise.Simplify qualified as Simplify
import Futhark.Optimise.Simplify.Engine qualified as Engine
import Futhark.Optimise.Simplify.Rules
import Futhark.Pass
data Seq
instance RepTypes Seq
instance ASTRep Seq where
expTypesFromPat :: forall (m :: * -> *).
(HasScope Seq m, Monad m) =>
Pat (LetDec Seq) -> m [BranchType Seq]
expTypesFromPat = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall dec. Typed dec => Pat dec -> [ExtType]
expExtTypesFromPat
instance TC.Checkable Seq where
checkOp :: Op (Aliases Seq) -> TypeM Seq ()
checkOp Op (Aliases Seq)
NoOp (Aliases Seq)
NoOp = forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
instance Buildable Seq where
mkBody :: Stms Seq -> Result -> Body Seq
mkBody = forall rep. BodyDec rep -> Stms rep -> Result -> Body rep
Body ()
mkExpPat :: [Ident] -> Exp Seq -> Pat (LetDec Seq)
mkExpPat [Ident]
idents Exp Seq
_ = [Ident] -> Pat Type
basicPat [Ident]
idents
mkExpDec :: Pat (LetDec Seq) -> Exp Seq -> ExpDec Seq
mkExpDec Pat (LetDec Seq)
_ Exp Seq
_ = ()
mkLetNames :: forall (m :: * -> *).
(MonadFreshNames m, HasScope Seq m) =>
[VName] -> Exp Seq -> m (Stm Seq)
mkLetNames = forall rep (m :: * -> *).
(ExpDec rep ~ (), LetDec rep ~ Type, MonadFreshNames m,
TypedOp (Op rep), HasScope rep m) =>
[VName] -> Exp rep -> m (Stm rep)
simpleMkLetNames
instance BuilderOps Seq
instance TraverseOpStms Seq where
traverseOpStms :: forall (m :: * -> *). Monad m => OpStmsTraverser m (Op Seq) Seq
traverseOpStms Scope Seq -> Stms Seq -> m (Stms Seq)
_ = forall (f :: * -> *) a. Applicative f => a -> f a
pure
instance PrettyRep Seq
instance BuilderOps (Engine.Wise Seq)
instance TraverseOpStms (Engine.Wise Seq) where
traverseOpStms :: forall (m :: * -> *).
Monad m =>
OpStmsTraverser m (Op (Wise Seq)) (Wise Seq)
traverseOpStms Scope (Wise Seq) -> Stms (Wise Seq) -> m (Stms (Wise Seq))
_ = forall (f :: * -> *) a. Applicative f => a -> f a
pure
simpleSeq :: Simplify.SimpleOps Seq
simpleSeq :: SimpleOps Seq
simpleSeq = forall rep.
(SimplifiableRep rep, Buildable rep) =>
SimplifyOp rep (Op (Wise rep)) -> SimpleOps rep
Simplify.bindableSimpleOps (forall a b. a -> b -> a
const forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall {k} (rep :: k). NoOp rep
NoOp, forall a. Monoid a => a
mempty))
simplifyProg :: Prog Seq -> PassM (Prog Seq)
simplifyProg :: Prog Seq -> PassM (Prog Seq)
simplifyProg = forall rep.
SimplifiableRep rep =>
SimpleOps rep
-> RuleBook (Wise rep)
-> HoistBlockers rep
-> Prog rep
-> PassM (Prog rep)
Simplify.simplifyProg SimpleOps Seq
simpleSeq forall rep.
(BuilderOps rep, TraverseOpStms rep, Aliased rep) =>
RuleBook rep
standardRules forall {k} {rep :: k}. HoistBlockers rep
blockers
where
blockers :: HoistBlockers rep
blockers = forall {k} {rep :: k}. HoistBlockers rep
Engine.noExtraHoistBlockers