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 /sml/trunk/src/MLRISC/c-calls/c-calls.sig
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/c-calls/c-calls.sig

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

revision 1042, Mon Jan 28 17:26:42 2002 UTC revision 1043, Mon Jan 28 21:26:03 2002 UTC
# Line 1  Line 1 
1  (* c-calls.sig  (* c-calls.sig
2   *   *
3   * COPYRIGHT (c) 2000 Bell Labs, Lucent Technologies   * COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
4   *)   *)
5    
6  signature C_CALLS =  signature C_CALLS =
# Line 19  Line 19 
19        | ARGS of c_arg list        | ARGS of c_arg list
20            (* list of arguments corresponding to the contents of a C struct *)            (* list of arguments corresponding to the contents of a C struct *)
21    
22      (* this constant is the offset from the SP to the low-address of the
23       * parameter area (see the paramAlloc callback below).
24       *)
25        val paramAreaOffset : int
26    
27    (* translate a C function call with the given argument list into    (* translate a C function call with the given argument list into
28     * a MLRISC statement list.  The structRet function is called     * a MLRISC statement list.  The arguments are as follows:
29     * to allocate space for returning a C struct.  The result of     *
30     * genCall is a mlrisc list specifying where the result is and the     *    name                    -- an expression that speficies the function.
31     * MLRisc statements that implement the calling sequence.  Functions     *    proto                   -- the function's prototype
32     * with void return type have no result, most others have one result,     *    paramAlloc              -- this callback takes the size and alignment
33     * but some conventions may flatten larger arguments into multiple     *                               constraints on the parameter-passing area
34     * registers (e.g., a register pair for long long results).     *                               in the stack.  It it returns true, then the
35       *                               space for the parameters is allocated by
36       *                               client; otherwise genCall allocates the space.
37       *    structRet               -- this callback thjes the size and alignment
38       *                               of space required for returning a struct
39       *                               value.  It returns the address of the
40       *                               reserved space.
41       *    saveRestoreDedicated    -- this callback takes a list of registers
42       *                               that the call kills and should return an
43       *                               instruction sequence to save/restore any
44       *                               registers that the client run-time model
45       *                               expects to be preserved (e.g., allocation
46       *                               pointers).
47       *    callComment             -- if present, the comment string is attached
48       *                               the CALL instruction as a COMMENT annotaiton.
49       *    args                    -- the arguments to the call.
50       *
51       * The result of genCall is a mlrisc list specifying where the result
52       * is and the MLRisc statements that implement the calling sequence.
53       * Functions with void return type have no result, most others have
54       * one result, but some conventions may flatten larger arguments into
55       * multiple registers (e.g., a register pair for long long results).
56     *     *
57     * The "saveRestoreDedicated" callback receives a list of registers     * WARNING: if the client's implementation of structRet uses the stack
58     * defined by the call instruction and should return instruction     * pointer to address the struct-return area, then paramAlloc should always
59     * sequences to save/restore any dedicated registers around that call     * handle allocating space for the parameter area (i.e., eturn true).
    * (if necessary).  
60     *)     *)
61      val genCall : {      val genCall : {
62              name  : T.rexp,              name  : T.rexp,
63              proto : CTypes.c_proto,              proto : CTypes.c_proto,
64                paramAlloc : {szb : int, align : int} -> bool,
65              structRet : {szb : int, align : int} -> T.rexp,              structRet : {szb : int, align : int} -> T.rexp,
66              saveRestoreDedicated :              saveRestoreDedicated :
67                T.mlrisc list -> { save: T.stm list, restore: T.stm list },                T.mlrisc list -> { save: T.stm list, restore: T.stm list },

Legend:
Removed from v.1042  
changed lines
  Added in v.1043

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