Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /MLRISC/trunk/staged-allocation/c-call-sig.sml
ViewVC logotype

Diff of /MLRISC/trunk/staged-allocation/c-call-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2404, Wed Apr 11 22:34:25 2007 UTC revision 2405, Thu Apr 12 22:51:44 2007 UTC
# Line 2  Line 2 
2    
3      structure T : MLTREE      structure T : MLTREE
4    
5      (* A GPR specifies either an integer or pointer; if the      datatype c_arg
6          = ARG of T.rexp
7              (* rexp specifies integer or pointer; if the
8       * corresponding parameter is a C struct, then       * corresponding parameter is a C struct, then
9       * this argument is the address of the struct.       * this argument is the address of the struct.
10       *)       *)
11      datatype c_arg = datatype T.mlrisc        | FARG of T.fexp
12              (* fexp specifies floating-point argument *)
13          | ARGS of c_arg list
14              (* list of arguments corresponding to the contents of a C struct *)
15    
16        (* An arg_location specifies the location of arguments/parameters
17         * for a C call.  Offsets are given with respect to the low end
18         * of the parameter area. *)
19        datatype arg_location =
20            C_GPR  of (T.ty * T.reg) (* integer/pointer argument in register *)
21          | C_FPR  of (T.fty * T.reg) (* floating-point argument in register *)
22          | C_STK  of (T.ty * T.I.machine_int)  (* integer/pointer argument on the call stack *)
23          | C_FSTK of (T.fty * T.I.machine_int) (* floating-point argument on the call stack *)
24    
25        val layout : CTypes.c_proto -> {
26                argLocs : arg_location list,        (* argument/parameter assignment *)
27                argMem : {szb : int, align : int},  (* memory requirements for stack-allocated *)
28                                                    (* arguments; this value can be passed to *)
29                                                    (* the paramAlloc callback. *)
30                resLoc : arg_location option,       (* result location; NONE for void functions *)
31                structRetLoc : {szb : int, align : int} option
32              }
33    
34    (* translate a C function call with the given argument list into    (* translate a C function call with the given argument list into
35     * a MLRISC statement list.  The arguments are as follows:     * a MLRISC statement list.  The arguments are as follows:
# Line 58  Line 81 
81      val genCall : {      val genCall : {
82              name  : T.rexp,              name  : T.rexp,
83              proto : CTypes.c_proto,              proto : CTypes.c_proto,
84  (*          paramAlloc : {szb : int, align : int} -> bool,              paramAlloc : {szb : int, align : int} -> bool,
85              structRet : {szb : int, align : int} -> T.rexp,              structRet : {szb : int, align : int} -> T.rexp,
86              saveRestoreDedicated :              saveRestoreDedicated :
87                T.mlrisc list -> {save: T.stm list, restore: T.stm list},                T.mlrisc list -> {save: T.stm list, restore: T.stm list},
88              callComment : string option, *)              callComment : string option,
89              args : c_arg list              args : c_arg list
90            } -> {            } -> {
91              callseq : T.stm list,              callseq : T.stm list,

Legend:
Removed from v.2404  
changed lines
  Added in v.2405

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0