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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/compiler/FLINT/flint/flint.sig
ViewVC logotype

Annotation of /sml/trunk/src/compiler/FLINT/flint/flint.sig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 199 - (view) (download) (as text)

1 : monnier 16 (* COPYRIGHT (c) 1997 YALE FLINT PROJECT *)
2 :     (* flint.sig *)
3 :    
4 :     signature FLINT =
5 :     sig
6 :    
7 :     type tkind = LtyDef.tkind
8 :     type tyc = LtyDef.tyc
9 :     type lty = LtyDef.lty
10 : monnier 45
11 : monnier 16 type tvar = LtyDef.tvar
12 :     type lvar = LambdaVar.lvar
13 :    
14 : monnier 45 type fflag = LtyDef.fflag
15 :     type rflag = LtyDef.rflag
16 :    
17 : monnier 184
18 :     (* what kind of inlining behavior is desired for the function *)
19 :     datatype ilhint
20 :     = IH_ALWAYS (* inline whenever possible *)
21 :     | IH_UNROLL (* only inline once within itself *)
22 :     | IH_SAFE (* only if trivially size-safe *)
23 :    
24 :     (* what kind of recursive function (aka loop) is this *)
25 :     (* the distinction between LK_LOOP and LK_UNKNOWN is not clear
26 :     * and might get dropped so that we only need `tail:bool' *)
27 :     datatype loopkind
28 :     = LK_UNKNOWN (* something else *)
29 :     | LK_LOOP (* loop wrapped in a preheader *)
30 : monnier 199 | LK_TAIL (* like LK_LOOP but tail-recursive *)
31 : monnier 184
32 :     (* calling convention *)
33 :     datatype cconv
34 :     = CC_FCT (* it's a functor *)
35 :     | CC_FUN of fflag (* it's a function *)
36 :    
37 : monnier 16 (** classifying various kinds of functions *)
38 : monnier 184 type fkind
39 :     = {inline: ilhint, (* when should it be inlined *)
40 :     known : bool, (* are all the call sites known *)
41 :     cconv : cconv, (* calling convention *)
42 :     isrec : (lty list * loopkind) option} (* is it recursive *)
43 : monnier 16
44 :     (** classifying various kinds of records *)
45 :     datatype rkind
46 : monnier 45 = RK_VECTOR of tyc (* vector: all elements have same type *)
47 :     | RK_STRUCT (* module: elements may be polymorphic *)
48 :     | RK_TUPLE of rflag (* tuple: all fields are monomorphic *)
49 : monnier 16
50 :     (*
51 :     * dcon records the name of the constructor (for debugging), the
52 : monnier 45 * corresponding conrep, and the flint type lty (which must be an
53 :     * arrow type). The use of conrep will go away soon.
54 : monnier 16 *)
55 :     type dcon = Symbol.symbol * Access.conrep * lty
56 :    
57 :     (*
58 :     * con: used to specify all possible switching statements. Efficient switch
59 :     * generation can be applied to DATAcon and INTcon. Otherwise, the switch is
60 :     * just a short-hand of the binary branch trees. Some of these instances
61 : monnier 45 * such as REALcon and VLENcon will go away soon.
62 : monnier 16 *)
63 :     datatype con
64 : monnier 45 = DATAcon of dcon * tyc list * lvar
65 : monnier 16 | INTcon of int (* should use InfInf.int *)
66 :     | INT32con of Int32.int
67 :     | WORDcon of word
68 :     | WORD32con of Word32.word
69 :     | REALcon of string
70 :     | STRINGcon of string
71 : monnier 45 | VLENcon of int
72 : monnier 16
73 :     (** simple values, including variables and static constants. *)
74 :     datatype value
75 :     = VAR of lvar
76 :     | INT of int (* should use InfInf.int *)
77 :     | INT32 of Int32.int
78 :     | WORD of word
79 :     | WORD32 of Word32.word
80 :     | REAL of string
81 :     | STRING of string
82 :    
83 :     (** the definitions of the lambda expressions *)
84 :     datatype lexp
85 :     = RET of value list
86 :     | LET of lvar list * lexp * lexp
87 :    
88 :     | FIX of fundec list * lexp
89 : monnier 45 | APP of value * value list
90 : monnier 16
91 : monnier 45 | TFN of tfundec * lexp
92 :     | TAPP of value * tyc list
93 : monnier 16
94 :     | SWITCH of value * Access.consig * (con * lexp) list * lexp option
95 : monnier 45 | CON of dcon * tyc list * value * lvar * lexp
96 : monnier 16
97 :     | RECORD of rkind * value list * lvar * lexp
98 :     | SELECT of value * int * lvar * lexp (* add rkind ? *)
99 :    
100 : monnier 45 | RAISE of value * lty list
101 : monnier 16 | HANDLE of lexp * value
102 :    
103 : monnier 45 | BRANCH of primop * value list * lexp * lexp
104 : monnier 16 | PRIMOP of primop * value list * lvar * lexp
105 :    
106 :     withtype fundec = fkind * lvar * (lvar * lty) list * lexp
107 : monnier 45 and tfundec = lvar * (tvar * tkind) list * lexp
108 :     and dict = {default: lvar, table: (tyc list * lvar) list}
109 :     and primop = dict option * PrimOp.primop * lty * tyc list
110 :     (* Invariant: primop's lty is always fully closed *)
111 : monnier 16
112 : monnier 45 type prog = fundec (* was "lvar * lty * lexp" *)
113 : monnier 16
114 :     end (* signature FLINT *)
115 : monnier 95
116 :     (*
117 : monnier 118 * $Log$
118 : monnier 95 *)

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