[commit: ghc] master: Expand the commentary in Note [syntax of cmm files] (56084d7)

git at git.haskell.org git
Tue Oct 1 10:10:20 UTC 2013


Repository : ssh://git at git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/56084d76eb1b57ad96a9e1c55f3d3e2d134f98d5/ghc

>---------------------------------------------------------------

commit 56084d76eb1b57ad96a9e1c55f3d3e2d134f98d5
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Tue Sep 17 21:42:54 2013 +0100

    Expand the commentary in Note [syntax of cmm files]


>---------------------------------------------------------------

56084d76eb1b57ad96a9e1c55f3d3e2d134f98d5
 compiler/cmm/CmmParse.y |   33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index 8367f7a..dee5c7d 100644
--- a/compiler/cmm/CmmParse.y
+++ b/compiler/cmm/CmmParse.y
@@ -104,15 +104,40 @@ Both high-level and low-level code can use a raw tail-call:
 
     jump stg_fun [R1,R2]
 
-This always transfers control to a low-level Cmm function, but the
-call can be made from high-level code.  Arguments must be passed
-explicitly in R/F/D/L registers.
-
 NB. you *must* specify the list of GlobalRegs that are passed via a
 jump, otherwise the register allocator will assume that all the
 GlobalRegs are dead at the jump.
 
 
+Calling Conventions
+-------------------
+
+High-level procedures use the NativeNode calling convention, or the
+NativeReturn convention if the 'return' keyword is used (see Stack
+Frames below).
+
+Low-level procedures implement their own calling convention, so it can
+be anything at all.
+
+If a low-level procedure implements the NativeNode calling convention,
+then it can be called by high-level code using an ordinary function
+call.  In general this is hard to arrange because the calling
+convention depends on the number of physical register available for
+parameter passing, but there are two cases where the calling
+convention is platform-independnt:
+
+ - Zero arguments.
+
+ - One argument of pointer or non-pointer word type; this is always
+   passed in R1 according to the NativeNode convention.
+
+ - Returning a single value; these conventions are fixed and platform
+   independent.
+
+
+Stack Frames
+------------
+
 A stack frame is written like this:
 
 INFO_TABLE_RET ( label, FRAME_TYPE, info_ptr, field1, ..., fieldN )




More information about the ghc-commits mailing list