package / ocaml-base-compiler.4.10.0 / middle_end / clambda_primitives.mli
1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. *)
9 (* *)
10 (* All rights reserved. This file is distributed under the terms of *)
11 (* the GNU Lesser General Public License version 2.1, with the *)
12 (* special exception on linking described in the file LICENSE. *)
13 (* *)
14 (**************************************************************************)
15
16 type mutable_flag = Asttypes.mutable_flag
17
18 type immediate_or_pointer = Lambda.immediate_or_pointer
19
20 type initialization_or_assignment = Lambda.initialization_or_assignment
21
22 type is_safe = Lambda.is_safe
23
24 type boxed =
25 | Boxed
26 | Unboxed
27
28 type memory_access_size =
29 | Sixteen
30 | Thirty_two
31 | Sixty_four
32
33 type primitive =
34 | Pread_symbol of string
35 (* Operations on heap blocks *)
36 | Pmakeblock of int * mutable_flag * block_shape
37 | Pfield of int
38 | Pfield_computed
39 | Psetfield of int * immediate_or_pointer * initialization_or_assignment
40 | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
41 | Pfloatfield of int
42 | Psetfloatfield of int * initialization_or_assignment
43 | Pduprecord of Types.record_representation * int
44 (* External call *)
45 | Pccall of Primitive.description
46 (* Exceptions *)
47 | Praise of raise_kind
48 (* Boolean operations *)
49 | Psequand | Psequor | Pnot
50 (* Integer operations *)
51 | Pnegint | Paddint | Psubint | Pmulint
52 | Pdivint of is_safe | Pmodint of is_safe
53 | Pandint | Porint | Pxorint
54 | Plslint | Plsrint | Pasrint
55 | Pintcomp of integer_comparison
56 | Poffsetint of int
57 | Poffsetref of int
58 (* Float operations *)
59 | Pintoffloat | Pfloatofint
60 | Pnegfloat | Pabsfloat
61 | Paddfloat | Psubfloat | Pmulfloat | Pdivfloat
62 | Pfloatcomp of float_comparison
63 (* String operations *)
64 | Pstringlength | Pstringrefu | Pstringrefs
65 | Pbyteslength | Pbytesrefu | Pbytessetu | Pbytesrefs | Pbytessets
66 (* Array operations *)
67 | Pmakearray of array_kind * mutable_flag
68 (** For [Pmakearray], the list of arguments must not be empty. The empty
69 array should be represented by a distinguished constant in the middle
70 end. *)
71 | Pduparray of array_kind * mutable_flag
72 (** For [Pduparray], the argument must be an immutable array.
73 The arguments of [Pduparray] give the kind and mutability of the
74 array being *produced* by the duplication. *)
75 | Parraylength of array_kind
76 | Parrayrefu of array_kind
77 | Parraysetu of array_kind
78 | Parrayrefs of array_kind
79 | Parraysets of array_kind
80 (* Test if the argument is a block or an immediate integer *)
81 | Pisint
82 (* Test if the (integer) argument is outside an interval *)
83 | Pisout
84 (* Operations on boxed integers (Nativeint.t, Int32.t, Int64.t) *)
85 | Pbintofint of boxed_integer
86 | Pintofbint of boxed_integer
87 | Pcvtbint of boxed_integer (*source*) * boxed_integer (*destination*)
88 | Pnegbint of boxed_integer
89 | Paddbint of boxed_integer
90 | Psubbint of boxed_integer
91 | Pmulbint of boxed_integer
92 | Pdivbint of { size : boxed_integer; is_safe : is_safe }
93 | Pmodbint of { size : boxed_integer; is_safe : is_safe }
94 | Pandbint of boxed_integer
95 | Porbint of boxed_integer
96 | Pxorbint of boxed_integer
97 | Plslbint of boxed_integer
98 | Plsrbint of boxed_integer
99 | Pasrbint of boxed_integer
100 | Pbintcomp of boxed_integer * integer_comparison
101 (* Operations on big arrays: (unsafe, #dimensions, kind, layout) *)
102 | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
103 | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
104 (* size of the nth dimension of a big array *)
105 | Pbigarraydim of int
106 (* load/set 16,32,64 bits from a string: (unsafe)*)
107 | Pstring_load of (memory_access_size * is_safe)
108 | Pbytes_load of (memory_access_size * is_safe)
109 | Pbytes_set of (memory_access_size * is_safe)
110 (* load/set 16,32,64 bits from a
111 (char, int8_unsigned_elt, c_layout) Bigarray.Array1.t : (unsafe) *)
112 | Pbigstring_load of (memory_access_size * is_safe)
113 | Pbigstring_set of (memory_access_size * is_safe)
114 (* byte swap *)
115 | Pbswap16
116 | Pbbswap of boxed_integer
117 (* Integer to external pointer *)
118 | Pint_as_pointer
119 (* Inhibition of optimisation *)
120 | Popaque
121
122 and integer_comparison = Lambda.integer_comparison =
123 Ceq | Cne | Clt | Cgt | Cle | Cge
124
125 and float_comparison = Lambda.float_comparison =
126 CFeq | CFneq | CFlt | CFnlt | CFgt | CFngt | CFle | CFnle | CFge | CFnge
127
128 and array_kind = Lambda.array_kind =
129 Pgenarray | Paddrarray | Pintarray | Pfloatarray
130
131 and value_kind = Lambda.value_kind =
132 (* CR mshinwell: Pfloatval should be renamed to Pboxedfloatval *)
133 Pgenval | Pfloatval | Pboxedintval of boxed_integer | Pintval
134
135 and block_shape = Lambda.block_shape
136 and boxed_integer = Primitive.boxed_integer =
137 Pnativeint | Pint32 | Pint64
138
139 and bigarray_kind = Lambda.bigarray_kind =
140 Pbigarray_unknown
141 | Pbigarray_float32 | Pbigarray_float64
142 | Pbigarray_sint8 | Pbigarray_uint8
143 | Pbigarray_sint16 | Pbigarray_uint16
144 | Pbigarray_int32 | Pbigarray_int64
145 | Pbigarray_caml_int | Pbigarray_native_int
146 | Pbigarray_complex32 | Pbigarray_complex64
147
148 and bigarray_layout = Lambda.bigarray_layout =
149 Pbigarray_unknown_layout
150 | Pbigarray_c_layout
151 | Pbigarray_fortran_layout
152
153 and raise_kind = Lambda.raise_kind =
154 | Raise_regular
155 | Raise_reraise
156 | Raise_notrace
157
158 val equal : primitive -> primitive -> bool
159