Project

General

Profile

Download (7.19 KB) Statistics
| Branch: | Tag: | Revision:
1
open Utils
2
open Format
3
open Lustre_types
4
open Machine_code_types
5

    
6
val pp_file_decl : formatter -> ident -> int -> unit
7

    
8
val pp_file_open : formatter -> ident -> int -> string
9

    
10
val pp_put_var : formatter -> string -> ident -> Types.t -> ident -> unit
11

    
12
val pp_ptr : formatter -> ident -> unit
13

    
14
val pp_machine_set_reset_name : formatter -> ident -> unit
15

    
16
val pp_machine_clear_reset_name : formatter -> ident -> unit
17

    
18
val pp_machine_init_name : formatter -> ident -> unit
19

    
20
val pp_machine_clear_name : formatter -> ident -> unit
21

    
22
val pp_machine_step_name : formatter -> ident -> unit
23

    
24
val pp_machine_alloc_name : formatter -> ident -> unit
25

    
26
val pp_machine_static_alloc_name : ?ghost:bool -> formatter -> ident -> unit
27

    
28
val pp_machine_dealloc_name : formatter -> ident -> unit
29

    
30
val pp_global_init_name : formatter -> ident -> unit
31

    
32
val pp_global_clear_name : formatter -> ident -> unit
33

    
34
val pp_machine_static_declare_name : ?ghost:bool -> formatter -> ident -> unit
35

    
36
val pp_machine_static_link_name : ?ghost:bool -> formatter -> ident -> unit
37

    
38
val pp_global_init_prototype : formatter -> ident -> unit
39

    
40
val pp_global_clear_prototype : formatter -> ident -> unit
41

    
42
val pp_alloc_prototype : formatter -> ident * var_decl list -> unit
43

    
44
val pp_dealloc_prototype : formatter -> ident -> unit
45

    
46
val pp_import_prototype : formatter -> dep_t -> unit
47

    
48
val pp_import_alloc_prototype : formatter -> dep_t -> unit
49

    
50
val pp_c_var_read :
51
  ?test_output:bool -> machine_t -> formatter -> var_decl -> unit
52

    
53
val pp_c_var_write : machine_t -> formatter -> var_decl -> unit
54

    
55
val pp_c_var :
56
  machine_t ->
57
  ident ->
58
  (formatter -> var_decl -> unit) ->
59
  formatter ->
60
  var_decl ->
61
  unit
62

    
63
val pp_c_dimension : formatter -> Dimension.t -> unit
64

    
65
val pp_label : formatter -> label -> unit
66

    
67
val pp_c_tag : formatter -> label -> unit
68

    
69
val pp_reset_assign : ident -> formatter -> bool -> unit
70

    
71
val pp_assign :
72
  machine_t ->
73
  ident ->
74
  (formatter -> var_decl -> unit) ->
75
  formatter ->
76
  var_decl * value_t ->
77
  unit
78

    
79
val pp_c_type :
80
  ?pp_c_basic_type_desc:(Types.t -> string) ->
81
  ?var_opt:var_decl ->
82
  ident ->
83
  formatter ->
84
  Types.t ->
85
  unit
86

    
87
val pp_basic_c_type :
88
  ?pp_c_basic_type_desc:(Types.t -> string) ->
89
  ?var_opt:var_decl ->
90
  formatter ->
91
  Types.t ->
92
  unit
93

    
94
val pp_machine_memtype_name : ?ghost:bool -> formatter -> ident -> unit
95

    
96
val pp_array_suffix : formatter -> ident list -> unit
97

    
98
val pp_print_version : formatter -> unit -> unit
99

    
100
val pp_machine_struct : ?ghost:bool -> formatter -> machine_t -> unit
101

    
102
val pp_reset_flag :
103
  ?indirect:bool -> (formatter -> 'a -> unit) -> formatter -> 'a -> unit
104

    
105
val pp_reset_flag' : ?indirect:bool -> formatter -> ident -> unit
106

    
107
val pp_machine_decl :
108
  ?ghost:bool -> (formatter -> 'a -> unit) -> formatter -> ident * 'a -> unit
109

    
110
val pp_machine_decl' : ?ghost:bool -> formatter -> ident * ident -> unit
111

    
112
val pp_file : ident -> formatter -> ident * ident -> unit
113

    
114
val pp_basic_lib_fun :
115
  bool -> ident -> (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
116

    
117
val pp_c_decl_input_var : formatter -> var_decl -> unit
118

    
119
(* Prints a value expression [v], with internal function calls only. [pp_var] is
120
   a printer for variables (typically [pp_c_var_read]), but an offset suffix may
121
   be added for array variables *)
122
val pp_c_val :
123
  machine_t ->
124
  ident ->
125
  (formatter -> var_decl -> unit) ->
126
  formatter ->
127
  value_t ->
128
  unit
129

    
130
(* Prints a constant value *)
131
val pp_c_const : formatter -> constant -> unit
132

    
133
(* Declaration of a local/mem variable: - if it's an array/matrix/etc, its
134
   size(s) should be known in order to statically allocate memory, so we print
135
   the full type *)
136
val pp_c_decl_local_var :
137
  ?pp_c_basic_type_desc:(Types.t -> string) ->
138
  machine_t ->
139
  formatter ->
140
  var_decl ->
141
  unit
142

    
143
(* type directed initialization: useless wrt the lustre compilation model,
144
   except for MPFR injection, where values are dynamically allocated *)
145
val pp_initialize :
146
  machine_t ->
147
  ident ->
148
  (formatter -> var_decl -> unit) ->
149
  formatter ->
150
  var_decl ->
151
  unit
152

    
153
(* type directed clear: useless wrt the lustre compilation model, except for
154
   MPFR injection, where values are dynamically allocated *)
155
val pp_clear :
156
  machine_t ->
157
  ident ->
158
  (formatter -> var_decl -> unit) ->
159
  formatter ->
160
  var_decl ->
161
  unit
162

    
163
val pp_static_declare_macro :
164
  ?ghost:bool -> formatter -> machine_t * ident * ident -> unit
165

    
166
val pp_static_link_macro :
167
  ?ghost:bool -> formatter -> machine_t * ident * ident -> unit
168

    
169
val pp_static_alloc_macro :
170
  ?ghost:bool -> formatter -> machine_t * ident * ident -> unit
171

    
172
val mk_call_var_decl : Location.t -> ident -> var_decl
173

    
174
val pp_c_basic_type_desc : Types.t -> string
175

    
176
val has_c_prototype : ident -> dep_t list -> bool
177

    
178
val reset_label : label
179

    
180
type loop_index = LVar of ident | LInt of int ref | LAcc of value_t
181

    
182
val mk_loop_var : machine_t -> unit -> ident
183

    
184
(* Computes the list of nested loop variables together with their dimension
185
   bounds.
186
 *  - LInt r stands for loop expansion (no loop variable, but int loop
187
      index)
188
 *  - LVar v stands for loop variable v *)
189
val mk_loop_variables :
190
  machine_t -> Types.t -> int -> (Dimension.t * loop_index) list
191

    
192
val reset_loop_counter : unit -> unit
193

    
194
val reorder_loop_variables :
195
  (Dimension.t * loop_index) list -> (Dimension.t * loop_index) list
196

    
197
(* Prints a [value] of type [var_type] indexed by the suffix list [loop_vars] *)
198
val pp_value_suffix :
199
  ?indirect:bool ->
200
  machine_t ->
201
  ident ->
202
  Types.t ->
203
  (Dimension.t * loop_index) list ->
204
  (formatter -> var_decl -> unit) ->
205
  formatter ->
206
  value_t ->
207
  unit
208

    
209
(* Generation of a non-clashing name for the self memory variable (for step and
210
   reset functions) *)
211
val mk_self : machine_t -> ident
212

    
213
val mk_mem : machine_t -> ident
214

    
215
val mk_mem_in : machine_t -> ident
216

    
217
val mk_mem_out : machine_t -> ident
218

    
219
val mk_mem_reset : machine_t -> ident
220

    
221
(* Generation of a non-clashing name for the attribute variable of static
222
   allocation macro *)
223
val mk_attribute : machine_t -> ident
224

    
225
(* Generation of a non-clashing name for the instance variable of static
226
   allocation macro *)
227
val mk_instance : machine_t -> ident
228

    
229
val mpfr_vars : var_decl list -> var_decl list
230

    
231
val mpfr_consts : const_desc list -> const_desc list
232

    
233
val reset_flag_name : string
234

    
235
val file_to_module_name : string -> string
236

    
237
val protect_filename : string -> string
238

    
239
(* Computes the depth to which multi-dimension array assignments should be
240
   expanded. It equals the maximum number of nested static array constructions
241
   accessible from root [v]. *)
242
val expansion_depth : value_t -> int
243

    
244
module type MODIFIERS_GHOST_PROTO = sig
245
  val pp_ghost_parameters :
246
    ?cut:bool ->
247
    formatter ->
248
    (string * (formatter -> string -> unit)) list ->
249
    unit
250
end
251

    
252
module EmptyGhostProto : MODIFIERS_GHOST_PROTO
253

    
254
module Protos (Mod : MODIFIERS_GHOST_PROTO) : sig
255
  val pp_stateless_prototype :
256
    formatter -> ident * var_decl list * var_decl list -> unit
257

    
258
  val pp_clear_reset_prototype :
259
    ident -> ident -> formatter -> ident * var_decl list -> unit
260

    
261
  val pp_set_reset_prototype :
262
    ident -> ident -> formatter -> ident * var_decl list -> unit
263

    
264
  val pp_step_prototype :
265
    ident -> ident -> formatter -> ident * var_decl list * var_decl list -> unit
266

    
267
  val pp_init_prototype : ident -> formatter -> ident * var_decl list -> unit
268

    
269
  val pp_clear_prototype : ident -> formatter -> ident * var_decl list -> unit
270
end
(6-6/18)