Commit d1d60a15 authored by simonpj's avatar simonpj
Browse files

[project @ 2001-06-26 11:07:42 by simonpj]

Add comments
parent 39c84a7d
...@@ -2441,9 +2441,12 @@ genCCall fn cconv kind args ...@@ -2441,9 +2441,12 @@ genCCall fn cconv kind args
call = toOL ( call = toOL (
[CALL (fn__2 tot_arg_size)] [CALL (fn__2 tot_arg_size)]
++ ++
-- Deallocate parameters after call for ccall;
-- but not for stdcall (callee does it)
(if cconv == StdCallConv then [] else (if cconv == StdCallConv then [] else
[ADD L (OpImm (ImmInt tot_arg_size)) (OpReg esp)]) [ADD L (OpImm (ImmInt tot_arg_size)) (OpReg esp)])
++ ++
[DELTA (delta + tot_arg_size)] [DELTA (delta + tot_arg_size)]
) )
in in
...@@ -2459,7 +2462,7 @@ genCCall fn cconv kind args ...@@ -2459,7 +2462,7 @@ genCCall fn cconv kind args
fn__2 tot_arg_size fn__2 tot_arg_size
| head fn_u == '.' | head fn_u == '.'
= ImmLit (text (fn_u ++ stdcallsize tot_arg_size)) = ImmLit (text (fn_u ++ stdcallsize tot_arg_size))
| otherwise | otherwise -- General case
= ImmLab False (text (fn_u ++ stdcallsize tot_arg_size)) = ImmLab False (text (fn_u ++ stdcallsize tot_arg_size))
stdcallsize tot_arg_size stdcallsize tot_arg_size
......
...@@ -104,7 +104,17 @@ isCasmTarget other = False ...@@ -104,7 +104,17 @@ isCasmTarget other = False
\end{code} \end{code}
Stuff to do with calling convention Stuff to do with calling convention:
ccall: Caller allocates parameters, *and* deallocates them.
stdcall: Caller allocates parameters, callee deallocates.
Function name has @N after it, where N is number of arg bytes
e.g. _Foo@8
ToDo: The stdcall calling convention is x86 (win32) specific,
so perhaps we should emit a warning if it's being used on other
platforms.
\begin{code} \begin{code}
data CCallConv = CCallConv | StdCallConv data CCallConv = CCallConv | StdCallConv
...@@ -125,10 +135,6 @@ ccallConvToInt CCallConv = 1 ...@@ -125,10 +135,6 @@ ccallConvToInt CCallConv = 1
Generate the gcc attribute corresponding to the given Generate the gcc attribute corresponding to the given
calling convention (used by PprAbsC): calling convention (used by PprAbsC):
ToDo: The stdcall calling convention is x86 (win32) specific,
so perhaps we should emit a warning if it's being used on other
platforms.
\begin{code} \begin{code}
ccallConvAttribute :: CCallConv -> String ccallConvAttribute :: CCallConv -> String
ccallConvAttribute StdCallConv = "__stdcall" ccallConvAttribute StdCallConv = "__stdcall"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment