
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.

Hello Daniel,
a quick web search brought up this manual:
https://www.microsoft.com/en-us/research/wp-content/uploads/1998/01/pal-manu...
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
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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

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
Hello Daniel,
a quick web search brought up this manual:
https://www.microsoft.com/en-us/research/wp-content/uploads/1998/01/pal-manu...
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@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

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
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
wrote: Hello Daniel,
a quick web search brought up this manual:
https://www.microsoft.com/en-us/research/wp-content/uploads/1998/01/pal-manu...
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@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

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

Thank you, that was very illuminating.
On Tue, Jul 17, 2018, 3:37 PM Simon Peyton Jones
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
*On Behalf Of *Gabor Greif *Sent:* 17 July 2018 07:17 *To:* Daniel Cartwright *Cc:* ghc-devs@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@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
wrote: Hello Daniel,
a quick web search brought up this manual:
https://www.microsoft.com/en-us/research/wp-content/uploads/1998/01/pal-manu... 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@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@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
participants (3)
-
Daniel Cartwright
-
Gabor Greif
-
Simon Peyton Jones