|Version 3 (modified by 10 years ago) (diff),|
GHC Commentary: What the hell is a
.cmm file is rather like C--. The syntax is almost C-- (a few constructs are missing), and it is augmented with some macros that are expanded by GHC's code generator (eg.
.cmm file is compiled by GHC itself: the syntax is parsed by compiler/cmm/CmmParse.y and compiler/cmm/CmmLex.x into the Cmm data type, where it is then passed through one of the back-ends.
We use the C preprocessor on
.cmm files, making extensive use of macros to make writing this low-level code a bit less tedious and error-prone. Most of our C-- macros are in includes/Cmm.h.
Additions over C--
.cmm syntax includes the
foreign "C" cfunctionname(R1) [R2];
I think the [R2] part is the (set of) register(s) that you need to save over the call.