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

Futhark.CodeGen.Backends.GenericC

Description

C code generation for whole programs, built on Futhark.CodeGen.Backends.GenericC.Monad. Most of this module is concerned with constructing the C API.

Synopsis

Documentation

compileProg :: MonadFreshNames m => Text -> Text -> ParamMap -> Operations op () -> CompilerM op () () -> Text -> (Space, [Space]) -> [Option] -> Definitions op -> m CParts Source #

Compile imperative program to a C program. Always uses the function named "main" as entry point, so make sure it is defined.

compileProg' :: MonadFreshNames m => Text -> Text -> ParamMap -> Operations op s -> s -> CompilerM op s () -> Text -> (Space, [Space]) -> [Option] -> Definitions op -> m (CParts, CompilerState s) Source #

defaultOperations :: Operations op s Source #

A set of operations that fail for every operation involving non-default memory spaces. Uses plain pointers and malloc for memory management.

type ParamMap = Map Name (SizeClass, Set Name) Source #

A mapping from names of tuning parameters to their class, as well as which functions make use of them (including transitively).

data CParts Source #

The result of compilation to C is multiple parts, which can be put together in various ways. The obvious way is to concatenate all of them, which yields a CLI program. Another is to compile the library part by itself, and use the header file to call into it.

Constructors

CParts 

Fields

asLibrary :: CParts -> (Text, Text, Text) Source #

Produce header, implementation, and manifest files.

asExecutable :: CParts -> Text Source #

As executable with command-line interface.

asServer :: CParts -> Text Source #

As server executable.