Project

General

Profile

Download (7.35 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
  ?var_is_contract:bool ->
81
  ?pp_c_basic_type_desc:(Types.t -> string) ->
82
  ?var_opt:var_decl ->
83
  ident ->
84
  formatter ->
85
  Types.t ->
86
  unit
87

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

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

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

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

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

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

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

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

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

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

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

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

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

    
132
(* Prints a constant value *)
133
val pp_c_const : formatter -> constant -> unit
134

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

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

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

    
165
val pp_static_declare_macro :
166
  ?ghost:bool -> formatter -> machine_t * ident * ident -> unit
167

    
168
val pp_static_link_macro :
169
  ?ghost:bool -> formatter -> machine_t * ident * ident -> unit
170

    
171
val pp_static_alloc_macro :
172
  ?ghost:bool -> formatter -> machine_t * ident * ident -> unit
173

    
174
val mk_call_var_decl : Location.t -> ident -> var_decl
175

    
176
val pp_c_basic_type_desc : Types.t -> string
177

    
178
val has_c_prototype : ident -> dep_t list -> bool
179

    
180
val reset_label : label
181

    
182
type loop_index = LVar of ident | LInt of int ref | LAcc of value_t
183

    
184
val mk_loop_var : machine_t -> unit -> ident
185

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

    
194
val reset_loop_counter : unit -> unit
195

    
196
val reorder_loop_variables :
197
  (Dimension.t * loop_index) list -> (Dimension.t * loop_index) list
198

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

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

    
215
val mk_mem : machine_t -> ident
216

    
217
val mk_mem_c : machine_t -> ident
218

    
219
val mk_mem_in : machine_t -> ident
220

    
221
val mk_mem_out : machine_t -> ident
222

    
223
val mk_mem_in_c : machine_t -> ident
224

    
225
val mk_mem_out_c : machine_t -> ident
226

    
227
val mk_mem_reset : machine_t -> ident
228

    
229
(* Generation of a non-clashing name for the attribute variable of static
230
   allocation macro *)
231
val mk_attribute : machine_t -> ident
232

    
233
(* Generation of a non-clashing name for the instance variable of static
234
   allocation macro *)
235
val mk_instance : machine_t -> ident
236

    
237
val mpfr_vars : var_decl list -> var_decl list
238

    
239
val mpfr_consts : const_desc list -> const_desc list
240

    
241
val reset_flag_name : string
242

    
243
val file_to_module_name : string -> string
244

    
245
val protect_filename : string -> string
246

    
247
(* Computes the depth to which multi-dimension array assignments should be
248
   expanded. It equals the maximum number of nested static array constructions
249
   accessible from root [v]. *)
250
val expansion_depth : value_t -> int
251

    
252
module type MODIFIERS_GHOST_PROTO = sig
253
  val pp_ghost_parameters :
254
    ?cut:bool ->
255
    formatter ->
256
    (string * (formatter -> string -> unit)) list ->
257
    unit
258
end
259

    
260
module EmptyGhostProto : MODIFIERS_GHOST_PROTO
261

    
262
module Protos (Mod : MODIFIERS_GHOST_PROTO) : sig
263
  val pp_stateless_prototype :
264
    formatter -> ident * var_decl list * var_decl list -> unit
265

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

    
269
  val pp_set_reset_prototype :
270
    ident -> ident -> formatter -> ident * var_decl list -> unit
271

    
272
  val pp_step_prototype :
273
    ident -> ident -> formatter -> ident * var_decl list * var_decl list -> unit
274

    
275
  val pp_init_prototype : ident -> formatter -> ident * var_decl list -> unit
276

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