Cmm learning tools

Simon Peyton Jones simonpj at microsoft.com
Tue Jul 17 19:37:01 UTC 2018


Here’s a little bit of background.


  *   C—started when Norman Ramsey and I decided to have a stab at designing a “portable assembly language”.
  *   Our primary motivation was GHC: I wanted to clearly separate the business of turning lambda calculus into an imperative language, from that of turning the imperative language into machine instructions for a particular CPU architecture.  But our intention was that many compilers, not just GHC, could generate C--.
  *   We published a series of papers describing why this goal is less easy than it looks (tail calls, garbage collection, exception handling, lightweight threading).
  *   But then along came LLVM.   It’s goal was the same (some differences in emphasis).   And LLVM “won” – it gained mindshare, a corporate sponsor, an ecosystem.   I’m quite happy about this – hundreds of person-years invested by someone else 😊.
  *   As a result C—is really a GHC-only language (though nothing stops other compilers from using it)
     *   Cmm is the GHC data type (defined in compiler/cmm) that represents C—syntax trees internally in GHC.
     *   We do parse foo.cmm for a few runtime system support files; e.g. rts/Apply.cmm
     *   But most Cmm is generated from STG by compiler/codeGen
     *   We do CPS conversion on Cmm
     *   …and then either emit LLVM, or generate assembly code directly (compiler/nativeGen)

I hope that helps a bit.

Simon

From: ghc-devs <ghc-devs-bounces at haskell.org> On Behalf Of Gabor Greif
Sent: 17 July 2018 07:17
To: Daniel Cartwright <chessai1996 at gmail.com>
Cc: ghc-devs at haskell.org
Subject: Re: Cmm learning tools

No worries! I searched for C--, which was its name back in the day. There are a bunch of other conference papers in the "GHC commentary" too.

Cheers,

     Gabor


Em ter, 17 de jul de 2018 às 08:00, Daniel Cartwright <chessai1996 at gmail.com<mailto:chessai1996 at gmail.com>> escreveu:
Thanks, I'll check it out.

P.S.: Apologies if my request seemed low-effort w.r.t. searching, I did spend a good 15 minutes doing so before asking, and was unable to find the document you just produced.

On Tue, Jul 17, 2018, 1:49 AM Gabor Greif <ggreif at gmail.com<mailto:ggreif at gmail.com>> wrote:
Hello Daniel,

a quick web search brought up this manual:

https://www.microsoft.com/en-us/research/wp-content/uploads/1998/01/pal-manual.pdf<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fresearch%2Fwp-content%2Fuploads%2F1998%2F01%2Fpal-manual.pdf&data=02%7C01%7Csimonpj%40microsoft.com%7C7bb75be5019e41da25c108d5ebace57c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636674050179363610&sdata=FsXmfxGIxygcYNE0B%2BKEtS%2FQ%2BYVTS3FXiIkmY79avys%3D&reserved=0>

Please note that Cmm is slightly different, but it should get you started.

Cheers,

     Gabor

Em ter, 17 de jul de 2018 às 05:20, Daniel Cartwright <chessai1996 at gmail.com<mailto:chessai1996 at gmail.com>> escreveu:
Hello all, I've recently become interested in learning Cmm, but cannot seem to find any concrete learning resources or extensive papers. It doesn't help that the web seems to contain a lot of useless information for a newcomer to Cmm. If anyone could provide some reading material about Cmm, I would be most grateful.
_______________________________________________
ghc-devs mailing list
ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-devs&data=02%7C01%7Csimonpj%40microsoft.com%7C7bb75be5019e41da25c108d5ebace57c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636674050179373618&sdata=qtMzW379UuYSun9DPOePyGSYMXlBA%2FGLnEzUVHcdkXs%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180717/2adcc565/attachment.html>


More information about the ghc-devs mailing list