{-# 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 lore op (m :: * -> *) r.
(Mem lore, FreeIn op, MonadFreshNames m) =>
r
-> Operations lore r op
-> Space
-> Prog lore
-> 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 lore op r.
(Mem lore, FreeIn op) =>
OpCompiler lore r op -> Operations lore r op
ImpGen.defaultOperations OpCompiler SeqMem r Sequential
forall lore r op.
(AllocOp (Op lore), ASTLore lore, OpReturns lore,
LetDec lore ~ LetDecMem, LParamInfo lore ~ LetDecMem,
RetType lore ~ RetTypeMem, FParamInfo lore ~ FParamMem,
BranchType lore ~ BranchTypeMem) =>
PatternT (LetDec lore) -> MemOp () -> ImpM lore r op ()
opCompiler
opCompiler :: PatternT (LetDec lore) -> MemOp () -> ImpM lore r op ()
opCompiler PatternT (LetDec lore)
dest (Alloc SubExp
e Space
space) =
PatternT (LetDec lore) -> SubExp -> Space -> ImpM lore r op ()
forall lore r op.
Mem lore =>
Pattern lore -> SubExp -> Space -> ImpM lore r op ()
ImpGen.compileAlloc PatternT (LetDec lore)
dest SubExp
e Space
space
opCompiler PatternT (LetDec lore)
_ (Inner ()) = () -> ImpM lore r op ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()