[Haskell-cafe] ghci & ghc -> JS (Emscripten)
stegeman at gmail.com
Tue Jul 2 17:25:04 CEST 2013
On Tue, Jul 2, 2013 at 4:38 PM, B B <blackbox.dev.ml at gmail.com> wrote:
> Thank you for all the replies.
> Luite Stegeman - I was thinking that the LLVM IR code is optimized already
> or you can run LLVM IR optimization passes to get rid of such things. I
> think compiling with ghc -fllvm generates LLVM bitcode and then you can
Most of the optimizations that GHC does are on Core, so you also get those
if you use Core or STG as the source. You do miss out on the later
optimization passes (GHC optimizes Cmm with Hoopl, and LLVM optimizes
again). We implement this in GHCJS ourselves, optimizing the generated
Since GHC itself is written in Haskell, it would be a good goal to compile
simple Haskell programs first and make sure that the RTS is working (you'll
need to compile the Cmm and C RTS files to LLVM). You can try to get the
GHC Testsuite  running. The GHCJS testsuite  might also be useful, it
contains much of the GHC Testsuite and a runner program that checks the
Like i said in the previous post, the generated code is a bit weird: stacks
are allocated dynamically, functions never return, there are only tail
calls. Emscripten might have a hard time with this.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe