]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/contrib/asmcomp/clambda.ml
update
[l4.git] / l4 / pkg / ocaml / contrib / asmcomp / clambda.ml
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                           Objective Caml                            *)
4 (*                                                                     *)
5 (*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
6 (*                                                                     *)
7 (*  Copyright 1996 Institut National de Recherche en Informatique et   *)
8 (*  en Automatique.  All rights reserved.  This file is distributed    *)
9 (*  under the terms of the Q Public License version 1.0.               *)
10 (*                                                                     *)
11 (***********************************************************************)
12
13 (* $Id: clambda.ml 7812 2007-01-29 12:11:18Z xleroy $ *)
14
15 (* A variant of the "lambda" code with direct / indirect calls explicit
16    and closures explicit too *)
17
18 open Asttypes
19 open Lambda
20
21 type function_label = string
22
23 type ulambda =
24     Uvar of Ident.t
25   | Uconst of structured_constant
26   | Udirect_apply of function_label * ulambda list * Debuginfo.t
27   | Ugeneric_apply of ulambda * ulambda list * Debuginfo.t
28   | Uclosure of (function_label * int * Ident.t list * ulambda) list
29               * ulambda list
30   | Uoffset of ulambda * int
31   | Ulet of Ident.t * ulambda * ulambda
32   | Uletrec of (Ident.t * ulambda) list * ulambda
33   | Uprim of primitive * ulambda list * Debuginfo.t
34   | Uswitch of ulambda * ulambda_switch
35   | Ustaticfail of int * ulambda list
36   | Ucatch of int * Ident.t list * ulambda * ulambda
37   | Utrywith of ulambda * Ident.t * ulambda
38   | Uifthenelse of ulambda * ulambda * ulambda
39   | Usequence of ulambda * ulambda
40   | Uwhile of ulambda * ulambda
41   | Ufor of Ident.t * ulambda * ulambda * direction_flag * ulambda
42   | Uassign of Ident.t * ulambda
43   | Usend of meth_kind * ulambda * ulambda * ulambda list * Debuginfo.t
44
45 and ulambda_switch =
46   { us_index_consts: int array;
47     us_actions_consts : ulambda array;
48     us_index_blocks: int array;
49     us_actions_blocks: ulambda array}
50
51 (* Description of known functions *)
52
53 type function_description =
54   { fun_label: function_label;          (* Label of direct entry point *)
55     fun_arity: int;                     (* Number of arguments *)
56     mutable fun_closed: bool;           (* True if environment not used *)
57     mutable fun_inline: (Ident.t list * ulambda) option }
58
59 (* Approximation of values *)
60
61 type value_approximation =
62     Value_closure of function_description * value_approximation
63   | Value_tuple of value_approximation array
64   | Value_unknown
65   | Value_integer of int
66   | Value_constptr of int