blob: 2110bcec72b86e9f07ea99496456ade6a5faa05c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
(***********************************************************************)
(* *)
(* Objective Caml *)
(* *)
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright 1996 Institut National de Recherche en Informatique et *)
(* en Automatique. All rights reserved. This file is distributed *)
(* under the terms of the Q Public License version 1.0. *)
(* *)
(***********************************************************************)
(* $Id$ *)
(* 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
| Cextcall of string * machtype * bool
| 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
| Cnegf | Cabsf
| Caddf | Csubf | Cmulf | Cdivf
| Cfloatofint | Cintoffloat
| Ccmpf of comparison
| Craise
| Ccheckbound
type expression =
Cconst_int of int
| Cconst_natint of Nativeint.t
| Cconst_float of string
| Cconst_symbol of string
| Cconst_pointer of int
| 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
| Cloop of expression
| Ccatch of expression * expression
| Cexit
| Ctrywith of expression * Ident.t * expression
type fundecl =
{ fun_name: string;
fun_args: (Ident.t * machtype) list;
fun_body: expression;
fun_fast: bool }
type data_item =
Cdefine_symbol of string
| Cdefine_label of int
| Cint8 of int
| Cint16 of int
| Cint of Nativeint.t
| Cfloat of string
| Csymbol_address of string
| Clabel_address of int
| Cstring of string
| Cskip of int
| Calign of int
type phrase =
Cfunction of fundecl
| Cdata of data_item list
|