futhark
Safe HaskellNone
LanguageGHC2021

Futhark.CodeGen.Backends.SequentialWASM

Description

C code generator. This module can convert a correct ImpCode program to an equivalent C program. This C program is expected to be converted to WebAssembly, so we also produce the intended JavaScript wrapper.

Synopsis

Documentation

compileProg :: MonadFreshNames m => Text -> Prog SeqMem -> m (Warnings, (CParts, Text, [String])) Source #

Compile Futhark program to wasm program (some assembly required).

The triple that is returned consists of

  • Generated C code (to be passed to Emscripten).
  • JavaScript wrapper code that presents a nicer interface to the Emscripten-produced code (passed to emcc with --extern-post-js).
  • The names of the C functions that must be exported from the WebAssembly module.