1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Objective Caml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-06-15 01:17:29 -07:00
|
|
|
(* Second intermediate language (machine independent) *)
|
|
|
|
|
|
|
|
type machtype_component =
|
|
|
|
Addr
|
|
|
|
| Int
|
|
|
|
| Float
|
|
|
|
|
|
|
|
type machtype = machtype_component array
|
|
|
|
|
|
|
|
val typ_void: machtype
|
|
|
|
val typ_addr: machtype
|
|
|
|
val typ_int: machtype
|
|
|
|
val typ_float: machtype
|
|
|
|
|
|
|
|
val size_component: machtype_component -> int
|
|
|
|
val size_machtype: machtype -> int
|
|
|
|
|
|
|
|
type comparison =
|
|
|
|
Ceq
|
|
|
|
| Cne
|
|
|
|
| Clt
|
|
|
|
| Cle
|
|
|
|
| Cgt
|
|
|
|
| Cge
|
|
|
|
|
|
|
|
val negate_comparison: comparison -> comparison
|
|
|
|
val swap_comparison: comparison -> comparison
|
|
|
|
|
|
|
|
type memory_chunk =
|
|
|
|
Byte_unsigned
|
|
|
|
| Byte_signed
|
|
|
|
| Sixteen_unsigned
|
|
|
|
| Sixteen_signed
|
|
|
|
| Word
|
|
|
|
|
|
|
|
type operation =
|
|
|
|
Capply of machtype
|
1995-07-10 02:48:27 -07:00
|
|
|
| Cextcall of string * machtype * bool
|
1995-06-15 01:17:29 -07:00
|
|
|
| Cproj of int * int
|
|
|
|
| Cload of machtype
|
|
|
|
| Cloadchunk of memory_chunk
|
|
|
|
| Calloc
|
|
|
|
| Cstore
|
|
|
|
| Cstorechunk of memory_chunk
|
|
|
|
| Caddi | Csubi | Cmuli | Cdivi | Cmodi
|
|
|
|
| Cand | Cor | Cxor | Clsl | Clsr | Casr
|
|
|
|
| Ccmpi of comparison
|
|
|
|
| Cadda | Csuba
|
|
|
|
| Ccmpa of comparison
|
1996-03-07 05:45:17 -08:00
|
|
|
| Cnegf | Cabsf
|
1995-06-15 01:17:29 -07:00
|
|
|
| Caddf | Csubf | Cmulf | Cdivf
|
|
|
|
| Cfloatofint | Cintoffloat
|
|
|
|
| Ccmpf of comparison
|
|
|
|
| Craise
|
1995-07-07 09:42:05 -07:00
|
|
|
| Ccheckbound
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
type expression =
|
1995-07-02 09:41:48 -07:00
|
|
|
Cconst_int of int
|
1997-03-04 02:19:51 -08:00
|
|
|
| Cconst_natint of Nativeint.t
|
1995-07-02 09:41:48 -07:00
|
|
|
| Cconst_float of string
|
|
|
|
| Cconst_symbol of string
|
|
|
|
| Cconst_pointer of int
|
1995-06-15 01:17:29 -07:00
|
|
|
| Cvar of Ident.t
|
|
|
|
| Clet of Ident.t * expression * expression
|
|
|
|
| Cassign of Ident.t * expression
|
|
|
|
| Ctuple of expression list
|
|
|
|
| Cop of operation * expression list
|
|
|
|
| Csequence of expression * expression
|
|
|
|
| Cifthenelse of expression * expression * expression
|
|
|
|
| Cswitch of expression * int array * expression array
|
1995-07-02 09:41:48 -07:00
|
|
|
| Cloop of expression
|
1995-06-15 01:17:29 -07:00
|
|
|
| Ccatch of expression * expression
|
|
|
|
| Cexit
|
|
|
|
| Ctrywith of expression * Ident.t * expression
|
|
|
|
|
|
|
|
type fundecl =
|
|
|
|
{ fun_name: string;
|
|
|
|
fun_args: (Ident.t * machtype) list;
|
1995-07-02 09:41:48 -07:00
|
|
|
fun_body: expression;
|
|
|
|
fun_fast: bool }
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
type data_item =
|
1995-06-22 03:11:18 -07:00
|
|
|
Cdefine_symbol of string
|
|
|
|
| Cdefine_label of int
|
1995-06-15 01:17:29 -07:00
|
|
|
| Cint8 of int
|
|
|
|
| Cint16 of int
|
1997-03-04 02:19:51 -08:00
|
|
|
| Cint of Nativeint.t
|
1995-06-15 01:17:29 -07:00
|
|
|
| Cfloat of string
|
1995-06-22 03:11:18 -07:00
|
|
|
| Csymbol_address of string
|
|
|
|
| Clabel_address of int
|
1995-06-15 01:17:29 -07:00
|
|
|
| Cstring of string
|
|
|
|
| Cskip of int
|
|
|
|
| Calign of int
|
|
|
|
|
|
|
|
type phrase =
|
|
|
|
Cfunction of fundecl
|
|
|
|
| Cdata of data_item list
|
|
|
|
|