futhark-0.25.15: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageGHC2021

Futhark.CodeGen.Backends.GenericC.Code

Description

Translation of ImpCode Exp and Code to C.

Synopsis

Documentation

compilePrimExp :: Monad m => (v -> m Exp) -> PrimExp v -> m Exp Source #

Tell me how to compile a v, and I'll Compile any PrimExp v for you.

compileExp :: Exp -> CompilerM op s Exp Source #

Compile prim expression to C expression.

compileCode :: Code op -> CompilerM op s () Source #

compileDest :: VName -> CompilerM op s (VName, [Stm]) Source #

Prepare a destination for function application.

compileArg :: Arg -> CompilerM op s Exp Source #

Compile an argument to a function applicaiton.

compileCopy :: PrimType -> [Count Elements (TExp Int64)] -> (VName, Space) -> (Count Elements (TExp Int64), [Count Elements (TExp Int64)]) -> (VName, Space) -> (Count Elements (TExp Int64), [Count Elements (TExp Int64)]) -> CompilerM op s () Source #

Compile an Copy using sequential nested loops and Read/Write of individual scalars. This always works, but can be pretty slow if those reads and writes are costly.

compileCopyWith :: [Count Elements (TExp Int64)] -> (Exp -> Exp -> CompilerM op s ()) -> (Count Elements (TExp Int64), [Count Elements (TExp Int64)]) -> (Exp -> CompilerM op s Exp) -> (Count Elements (TExp Int64), [Count Elements (TExp Int64)]) -> CompilerM op s () Source #

Compile an Copy using sequential nested loops, but parameterised over how to do the reads and writes.

linearCode :: Code op -> [Code op] Source #

Orphan instances

ToExp (TExp t) Source # 
Instance details

Methods

toExp :: TExp t -> SrcLoc -> Exp #