{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Futhark.CodeGen.ImpGen.Sequential
( compileProg,
ImpGen.Warnings,
)
where
import qualified Futhark.CodeGen.ImpCode.Sequential as Imp
import qualified Futhark.CodeGen.ImpGen as ImpGen
import Futhark.IR.SeqMem
import Futhark.MonadFreshNames
compileProg :: MonadFreshNames m => Prog SeqMem -> m (ImpGen.Warnings, Imp.Program)
compileProg :: Prog SeqMem -> m (Warnings, Program)
compileProg = ()
-> Operations SeqMem () Sequential
-> Space
-> Prog SeqMem
-> m (Warnings, Program)
forall rep inner op (m :: * -> *) r.
(Mem rep inner, FreeIn op, MonadFreshNames m) =>
r
-> Operations rep r op
-> Space
-> Prog rep
-> m (Warnings, Definitions op)
ImpGen.compileProg () Operations SeqMem () Sequential
forall r. Operations SeqMem r Sequential
ops Space
Imp.DefaultSpace
where
ops :: Operations SeqMem r Sequential
ops = OpCompiler SeqMem r Sequential -> Operations SeqMem r Sequential
forall rep inner op r.
(Mem rep inner, FreeIn op) =>
OpCompiler rep r op -> Operations rep r op
ImpGen.defaultOperations OpCompiler SeqMem r Sequential
forall rep inner r op.
(HasLetDecMem (LetDec rep), ASTRep rep, OpReturns inner,
FParamInfo rep ~ FParamMem, LParamInfo rep ~ LParamMem,
RetType rep ~ RetTypeMem, BranchType rep ~ BranchTypeMem,
Op rep ~ MemOp inner) =>
PatT (LetDec rep) -> MemOp () -> ImpM rep r op ()
opCompiler
opCompiler :: PatT (LetDec rep) -> MemOp () -> ImpM rep r op ()
opCompiler PatT (LetDec rep)
dest (Alloc SubExp
e Space
space) =
PatT (LetDec rep) -> SubExp -> Space -> ImpM rep r op ()
forall rep inner r op.
Mem rep inner =>
Pat rep -> SubExp -> Space -> ImpM rep r op ()
ImpGen.compileAlloc PatT (LetDec rep)
dest SubExp
e Space
space
opCompiler PatT (LetDec rep)
_ (Inner ()) = () -> ImpM rep r op ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()