[Haskell-cafe] Compilers written in Haskell that generate assembly

Sebastiaan Joosten sjcjoosten+haskell at gmail.com
Mon Dec 14 20:53:18 UTC 2020


Not something I've worked on (my answer to your original question is 'no I
haven't'), but GHC has a compiler from 'CMM' to various assemblies written
in Haskell
Code at:
https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/CmmToAsm/
https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/CmmToAsm/X86/CodeGen.hs

(I used to think that LLVM was the last step in GHC. I don't know when or
how I ever got that idea. Last year I learned that it only uses LLVM if you
tell it to and it bypasses it completely with the default `-fasm' option
<https://downloads.haskell.org/~ghc/8.10.2/docs/html/users_guide/codegens.html>.
In
any case, my own earlier misconception is why I felt the need to point out
what is perhaps obvious to most.)

Sebastiaan

On Mon, Dec 14, 2020 at 3:09 PM Vanessa McHale <vamchale at gmail.com> wrote:

> That I stumbled across! I like it, though I've put off learning about
> assemblers...
>
> On 12/14/20 2:05 PM, Henning Thielemann wrote:
> >
> > On Mon, 14 Dec 2020, Vanessa McHale wrote:
> >
> >> Have any of you written compilers or backends that generate assembly?
> >> Lots of projects seem to "end" at LLVM.
> >
> > I don't know of compiler backends, but I know of an x86 machine code
> > generator:
> >    https://hackage.haskell.org/package/harpy
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20201214/fe90545a/attachment.html>


More information about the Haskell-Cafe mailing list