summaryrefslogtreecommitdiff
path: root/compiler/cmm
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-09-17 21:42:54 +0100
committerSimon Marlow <marlowsd@gmail.com>2013-10-01 11:10:07 +0100
commit56084d76eb1b57ad96a9e1c55f3d3e2d134f98d5 (patch)
treed991a6281b5a4fbfce5822a7b58f2b6bae3a547c /compiler/cmm
parent4b8a928d7a49add8062dd43c5fb66721a6e6346d (diff)
downloadhaskell-56084d76eb1b57ad96a9e1c55f3d3e2d134f98d5.tar.gz
Expand the commentary in Note [syntax of cmm files]
Diffstat (limited to 'compiler/cmm')
-rw-r--r--compiler/cmm/CmmParse.y33
1 files changed, 29 insertions, 4 deletions
diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index 8367f7abd4..dee5c7d861 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 )