1 |
signature C_CALL = sig |
(* c-calls.sig |
2 |
|
* |
3 |
structure T : MLTREE |
* COPYRIGHT (c) 2000 Bell Labs, Lucent Technologies |
4 |
|
*) |
|
(* multiple calling conventions on a single architecture *) |
|
|
(* type calling_convention *) |
|
5 |
|
|
6 |
(* prototype describing C function *) |
signature C_CALLS = |
7 |
type c_proto = |
sig |
|
{ (* conv : calling_convention, *) |
|
|
retTy : CTypes.c_type, |
|
|
paramTys : CTypes.c_type list |
|
|
} |
|
8 |
|
|
9 |
exception ArgParamMismatch |
structure T : MLTREE |
10 |
|
|
11 |
datatype c_arg |
datatype c_arg |
12 |
= ARG of T.rexp |
= ARG of T.rexp |
17 |
| FARG of T.fexp |
| FARG of T.fexp |
18 |
(* fexp specifies floating-point argument *) |
(* fexp specifies floating-point argument *) |
19 |
| ARGS of c_arg list |
| ARGS of c_arg list |
20 |
(* list of arguments corresponding to contents of a C struct *) |
(* list of arguments corresponding to the contents of a C struct *) |
21 |
|
|
22 |
(* translate a C function call with the given argument list into |
(* translate a C function call with the given argument list into |
23 |
* a MLRISC statement list. The structRet function is called |
* a MLRISC statement list. The structRet function is called |
28 |
* but some conventions may flatten larger arguments into multiple |
* but some conventions may flatten larger arguments into multiple |
29 |
* registers (e.g., a register pair for long long results). |
* registers (e.g., a register pair for long long results). |
30 |
*) |
*) |
31 |
val genCall : |
val genCall : { |
32 |
{ name : T.rexp, |
name : T.rexp, |
33 |
proto : c_proto, |
proto : CTypes.c_proto, |
34 |
structRet : {szb : int, align : int} -> T.rexp, |
structRet : {szb : int, align : int} -> T.rexp, |
35 |
args : c_arg list |
args : c_arg list |
36 |
} |
} -> { |
37 |
-> |
callseq : T.stm list, |
|
{ callseq : T.stm list, |
|
38 |
result: T.mlrisc list |
result: T.mlrisc list |
39 |
} |
} |
40 |
|
|
41 |
end |
end |