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/compiler/ElabData/prim/primop.sig
ViewVC logotype

Diff of /sml/trunk/compiler/ElabData/prim/primop.sig

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

sml/trunk/src/compiler/FLINT/kernel/primop.sig revision 251, Mon Apr 19 02:55:26 1999 UTC sml/trunk/compiler/Semant/prim/primop.sig revision 4428, Tue Sep 19 17:42:58 2017 UTC
# Line 129  Line 129 
129    
130  datatype arithop  datatype arithop
131    = + | - | * | / | ~           (* int or float *)    = + | - | * | / | ~           (* int or float *)
132    | ABS                         (* floating point only *)    | ABS | FSQRT | FSIN | FCOS | FTAN            (* floating point only *)
133    | LSHIFT | RSHIFT | RSHIFTL   (* int only *)    | LSHIFT | RSHIFT | RSHIFTL   (* int only *)
134    | ANDB | ORB | XORB | NOTB    (* int only *)    | ANDB | ORB | XORB | NOTB    (* int only *)
135      | REM | DIV | MOD                             (* int only *)
136    
137  datatype cmpop = > | >= | < | <= | LEU | LTU | GEU | GTU | EQL | NEQ  datatype cmpop = > | >= | < | <= | LEU | LTU | GEU | GTU | EQL | NEQ
138                                    | FSGN (* floating point only *)
139    
140  (*  (* datatype primop:
141   * Various primitive operations.  Those that are designated "inline" are   * Various primitive operations. Those that are designated "inline" (L:) in
142   * expanded into lambda code in terms of other operators,   * the comments are expanded into lambda code in terms of other operators,
143   * as is the "checked=true" version of NUMSUBSCRIPT or NUMUPDATE.   * as are the "checked=true" versions of NUMSUBSCRIPT and NUMUPDATE (L?:).
144   * NUMSUBSCRIPT and NUMUPDATE are for arrays of floats or integers   * "Environmental" primops (occurring in the InLine structure) are indicated
145   * stored WITHOUT boxing or tags.   * by "E:" in the comment.
146   *)   *)
147  datatype primop  datatype primop
148    = ARITH of {oper: arithop, overflow: bool, kind: numkind}    = ARITH of {oper: arithop, overflow: bool, kind: numkind}  (* E: arithmetic ops *)
149    | INLLSHIFT of numkind    | INLLSHIFT of numkind       (* E: left shift *)
150    | INLRSHIFT of numkind    | INLRSHIFT of numkind       (* E: right shift *)
151    | INLRSHIFTL of numkind    | INLRSHIFTL of numkind      (* E: right shift logical *)
152    | CMP of {oper: cmpop, kind: numkind}    | CMP of {oper: cmpop, kind: numkind}  (* generic compare *)
153    
154    | TESTU of int * int    | TESTU of int * int         (* E: conversions to int, e.g. testu_31_31 *)
155    | TEST of int * int    | TEST of int * int          (* E: conversions to int, e.g. test_32_31_w *)
156    | TRUNC of int * int    | TRUNC of int * int         (* E: truncations to smaller int/word, e.g. trunc_32_31_i *)
157    | EXTEND of int * int    | EXTEND of int * int        (* E: extensions to int32, word32 *)
158    | COPY of int * int    | COPY of int * int          (* E: conversions, e.g. copy_32_32_ii *)
159    
160    | ROUND of {floor: bool, fromkind: numkind, tokind: numkind}    | TEST_INF of int            (* E: intinf conversions, e.g. test_inf_31 *)
161    | REAL of {fromkind: numkind, tokind: numkind}    | TRUNC_INF of int           (* E: intinf truncations, e.g. trunc_inf_31 *)
162      | EXTEND_INF of int          (* E: intinf extensions, e.g. extend_8_inf *)
163    | NUMSUBSCRIPT of {kind: numkind, checked: bool, immutable: bool}    | COPY_INF of int            (* E: conversions to intinf, e.g. copy_8_inf *)
164    | NUMUPDATE of {kind: numkind, checked: bool}  
165      | ROUND of {floor: bool, fromkind: numkind, tokind: numkind}       (* E: floor, round *)
166    | SUBSCRIPT                  (* polymorphic array subscript *)    | REAL of {fromkind: numkind, tokind: numkind}                     (* E: real, real32 *)
167    | SUBSCRIPTV                 (* poly vector subscript *)  
168    | INLSUBSCRIPT               (* inline poly array subscript *)    | NUMSUBSCRIPT of {kind: numkind, checked: bool, immutable: bool}  (* E: L?: ordof, etc. *)
169    | INLSUBSCRIPTV              (* inline poly vector subscript *)    | NUMUPDATE of {kind: numkind, checked: bool}                      (* E: L?: store, etc. *)
170    | INLMKARRAY                 (* inline poly array creation *)  
171      | SUBSCRIPT                  (* E: polymorphic array subscript *)
172    | PTREQL | PTRNEQ            (* pointer equality *)    | SUBSCRIPTV                 (* E: poly vector subscript *)
173    | POLYEQL | POLYNEQ          (* polymorphic equality *)    | INLSUBSCRIPT               (* E: L: poly array subscript *)
174    | BOXED | UNBOXED            (* boxity tests *)    | INLSUBSCRIPTV              (* E: L: poly vector subscript *)
175    | LENGTH                     (* vector, string, array, ... length *)    | INLMKARRAY                 (* E: L: poly array creation *)
176    | OBJLENGTH                  (* length of arbitrary heap object *)  
177    | CAST    | PTREQL | PTRNEQ            (* E: pointer equality *)
178    | WCAST    | POLYEQL | POLYNEQ          (* E: polymorphic equality *)
179    | GETRUNVEC                  (* get the pointer to the run-vector *)    | BOXED | UNBOXED            (* E: boxity tests *)
180    | MARKEXN                    (* mark an exception value with a string *)    | LENGTH                     (* E: vector, string, array, ... length *)
181    | GETHDLR | SETHDLR          (* get/set exn handler pointer *)    | OBJLENGTH                  (* E: length of arbitrary heap object *)
182    | GETVAR | SETVAR            (* get/set var register *)    | CAST                       (* E: cast *)
183    | GETPSEUDO | SETPSEUDO      (* get/set pseudo registers *)    | GETHDLR | SETHDLR          (* E: get/set exn handler pointer *)
184    | SETMARK | DISPOSE          (* capture/dispose frames *)    | GETVAR | SETVAR            (* E: get/set var register *)
185    | MAKEREF                    (* allocate a ref cell *)    | GETPSEUDO | SETPSEUDO      (* E: get/set pseudo registers *)
186    | CALLCC | CAPTURE | THROW   (* continuation operations *)    | SETMARK | DISPOSE          (* E: capture/dispose frames *)
187    | ISOLATE                    (* isolating a function *)    | MAKEREF                    (* E: allocate a ref cell *)
188    | DEREF                      (* dereferencing *)    | CALLCC | CAPTURE | THROW   (* E: continuation operations *)
189    | ASSIGN                     (* assignment *)    | ISOLATE                    (* E: isolating a function *)
190      | DEREF                      (* E: dereferencing *)
191      | ASSIGN                     (* E: assignment *)
192      | UPDATE                     (* E: array or reference update (maybe boxed) *)
193      | INLUPDATE                  (* E: L: array update (maybe boxed) *)
194      | UNBOXEDUPDATE              (* E: update array of integers WITH tags
195                                    * removed by Zhong, put back by Matthias (see FLINT/trans/primopmap.sml) *)
196      | GETTAG                     (* E: extract the tag portion of an
197                                    * object's descriptor as an ML int *)
198      | MKSPECIAL                  (* E: make a special object *)
199      | SETSPECIAL                 (* E: set the state of a special object *)
200      | GETSPECIAL                 (* E: get the state of a special object *)
201      | INLMIN of numkind          (* E: L: min *)
202      | INLMAX of numkind          (* E: L: max *)
203      | INLABS of numkind          (* E: L: abs *)
204      | INLNOT                     (* E: L: bool not operator *)
205      | INLCOMPOSE                 (* E: L: compose "op o"  operator *)
206      | INLBEFORE                  (* E: L: "before" operator *)
207      | INLIGNORE                  (* E: L: "ignore" function *)
208    
209    (* primops to support new array representations *)
210      | NEW_ARRAY0                 (* E: allocate zero-length array header *)
211      | GET_SEQ_DATA               (* E: get data pointer from arr/vec header *)
212      | SUBSCRIPT_REC              (* E: record subscript operation *)
213      | SUBSCRIPT_RAW64            (* E: raw64 subscript operation *)
214    
215      | INLIDENTITY                (* E: polymorphic identity *)
216    
217      | CVT64                      (* E: convert between external and
218                                    * internal representation of compiler
219                                    * simulated 64-bit scalars, e.g. w64p *)
220    
221    (* Primops to support new experimental C FFI. *)
222      | RAW_LOAD of numkind         (* E: load from arbitrary memory location *)
223      | RAW_STORE of numkind        (* E: store to arbitrary memory location *)
224        (* make a call to a C-function;
225         * The primop carries C function prototype information and specifies
226         * which of its (ML-) arguments are floating point. C prototype
227         * information is for use by the backend, ML information is for
228         * use by the CPS converter. *)
229      | RAW_CCALL of { c_proto: CTypes.c_proto,
230                       ml_args: ccall_type list,
231                       ml_res_opt: ccall_type option,
232                       reentrant: bool
233                     } option  (* E: *)
234       (* Allocate uninitialized storage on the heap.
235        * The record is meant to hold short-lived C objects, i.e., they
236        * are not ML pointers.  The representation is
237        * the same as RECORD with tag tag_raw32 or tag_fblock.
238        *)
239      | RAW_RECORD of { fblock: bool }  (* E: *)
240    
241    (* non-environmental primops (not found in InLine) *)
242    
243    | UNBOXEDASSIGN              (* assignment to integer reference *)    | UNBOXEDASSIGN              (* assignment to integer reference *)
244    | UPDATE                     (* array update (maybe boxed) *)  
245    | INLUPDATE                  (* inline array update (maybe boxed) *)    | WCAST                      (* ? *)
246    | BOXEDUPDATE                (* boxed array update *)    | MARKEXN                    (* mark an exception value with a string *)
247    | UNBOXEDUPDATE              (* update array of integers WITH tags *)  
248      | INL_ARRAY                  (* L: polymorphic array allocation *)
249    | GETTAG                     (* extract the tag portion of an *)    | INL_VECTOR                 (* L: polymorphic vector allocation *)
250                                 (* object's descriptor as an ML int *)    | INL_MONOARRAY of numkind   (* L: monomorphic array allocation *)
251    | MKSPECIAL                  (* make a special object *)    | INL_MONOVECTOR of numkind  (* L: monomorphic vector allocation *)
   | SETSPECIAL                 (* set the state of a special object *)  
   | GETSPECIAL                 (* get the state of a special object *)  
   | USELVAR | DEFLVAR  
   | INLDIV | INLMOD | INLREM   (* inline interger arithmetic *)  
   | INLMIN |INLMAX | INLABS    (* inline interger arithmetic *)  
   | INLNOT                     (* inline bool not operator *)  
   | INLCOMPOSE                 (* inline compose "op o"  operator *)  
   | INLBEFORE                  (* inline "before" operator *)  
   | INL_ARRAY                  (* inline polymorphic array allocation *)  
   | INL_VECTOR                 (* inline polymorphic vector allocation *)  
   | INL_MONOARRAY of numkind   (* inline monomorphic array allocation *)  
   | INL_MONOVECTOR of numkind  (* inline monomorphic vector allocation *)  
252    
253    | MKETAG                     (* make a new exception tag *)    | MKETAG                     (* make a new exception tag *)
254    | WRAP                       (* box a value by wrapping it *)    | WRAP                       (* box a value by wrapping it *)
255    | UNWRAP                     (* unbox a value by unwrapping it *)    | UNWRAP                     (* unbox a value by unwrapping it *)
 (* Primops to support new array representations *)  
   | NEW_ARRAY0                  (* allocate zero-length array header *)  
   | GET_SEQ_DATA                (* get data pointer from arr/vec header *)  
   | SUBSCRIPT_REC               (* record subscript operation *)  
   | SUBSCRIPT_RAW64             (* raw64 subscript operation *)  
256    
257    and ccall_type =
258        CCI32 |                             (* passed as int32 *)
259        CCI64 |                             (* int64, currently unused *)
260        CCR64 |                             (* passed as real64 *)
261        CCML                                (* passed as Unsafe.Object.object *)
262    
263  val IADD : primop  (* default integer addition *)  val IADD : primop  (* default integer addition *)
264  val ISUB : primop  (* default integer subtraction *)  val ISUB : primop  (* default integer subtraction *)
# Line 233  Line 276 
276    
277  val prNumkind : numkind -> string  val prNumkind : numkind -> string
278  val prPrimop: primop -> string  val prPrimop: primop -> string
 val purePrimop : primop -> bool  
279  val mayRaise : primop -> bool  val mayRaise : primop -> bool
280  (* This should return more than just a boolean.  (* This should return more than just a boolean.
281   * True means "can not be dead-code eliminated" *)   * True means "can not be dead-code eliminated" *)

Legend:
Removed from v.251  
changed lines
  Added in v.4428

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