futhark-0.25.32: An optimising compiler for a functional, array-oriented language.

Safe Haskell | None
Language | GHC2021

Futhark.CodeGen.Backends.GenericC.Code

Contents

- Orphan instances

Description

Translation of ImpCode Exp and Code to C.

Synopsis

- compilePrimExp :: Monad m => (v -> m Exp) -> PrimExp v -> m Exp
- compileExp :: Exp -> CompilerM op s Exp
- compileCode :: Code op -> CompilerM op s ()
- compileDest :: VName -> CompilerM op s (VName, [Stm])
- compileArg :: Arg -> CompilerM op s Exp
- 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 ()
- 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 ()
- errorMsgString :: ErrorMsg Exp -> CompilerM op s (String, [Exp])
- linearCode :: Code op -> [Code op]

# 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.

errorMsgString :: ErrorMsg Exp -> CompilerM op s (String, [Exp]) Source #

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

# Orphan instances

ToExp (TExp t) Source # |
Instance details Methods toExp :: TExp t -> SrcLoc -> Exp Source #