Project

General

Profile

Download (6.64 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
val pp_file_open: formatter -> ident -> int -> string
8
val pp_put_var: formatter -> string -> ident -> Types.t -> ident -> unit
9
val pp_ptr: formatter -> ident -> unit
10
val pp_machine_set_reset_name: formatter -> ident -> unit
11
val pp_machine_clear_reset_name: formatter -> ident -> unit
12
val pp_machine_init_name: formatter -> ident -> unit
13
val pp_machine_clear_name: formatter -> ident -> unit
14
val pp_machine_step_name: formatter -> ident -> unit
15
val pp_machine_alloc_name: formatter -> ident -> unit
16
val pp_machine_static_alloc_name: formatter -> ident -> unit
17
val pp_machine_dealloc_name: formatter -> ident -> unit
18
val pp_global_init_name: formatter -> ident -> unit
19
val pp_global_clear_name: formatter -> ident -> unit
20
val pp_machine_static_declare_name: formatter -> ident -> unit
21
val pp_machine_static_link_name: formatter -> ident -> unit
22
val pp_global_init_prototype: formatter -> ident -> unit
23
val pp_global_clear_prototype: formatter -> ident -> unit
24
val pp_alloc_prototype: formatter -> ident * var_decl list -> unit
25
val pp_dealloc_prototype: formatter -> ident -> unit
26
val pp_import_prototype: formatter -> dep_t -> unit
27
val pp_import_alloc_prototype: formatter -> dep_t -> unit
28
val pp_c_var_read: ?test_output:bool -> machine_t -> formatter -> var_decl -> unit
29
val pp_c_var_write: machine_t -> formatter -> var_decl -> unit
30
val pp_c_var: machine_t -> ident -> (formatter -> var_decl -> unit) -> formatter -> var_decl -> unit
31
val pp_c_dimension: formatter -> Dimension.t -> unit
32
val pp_label: formatter -> label -> unit
33
val pp_c_tag: formatter -> label -> unit
34
val pp_reset_assign: ident -> formatter -> bool -> unit
35
val pp_assign: machine_t -> ident -> (formatter -> var_decl -> unit) -> formatter -> var_decl * value_t -> unit
36
val pp_c_type: ?pp_c_basic_type_desc:(Types.t -> string) -> ?var_opt:var_decl ->
37
  ident -> formatter -> Types.t -> unit
38
val pp_basic_c_type: ?pp_c_basic_type_desc:(Types.t -> string) -> ?var_opt:var_decl -> formatter -> Types.t -> unit
39
val pp_machine_memtype_name: ?ghost:bool -> formatter -> ident -> unit
40
val pp_array_suffix: formatter -> ident list -> unit
41
val pp_print_version: formatter -> unit -> unit
42
val pp_machine_struct: ?ghost:bool -> formatter -> machine_t -> unit
43
val pp_reset_flag: ?indirect:bool -> (formatter -> 'a -> unit) -> formatter -> 'a -> unit
44
val pp_reset_flag': ?indirect:bool -> formatter -> ident -> unit
45
val pp_machine_decl: ?ghost:bool -> (formatter -> 'a -> unit) -> formatter -> ident * 'a -> unit
46
val pp_machine_decl': ?ghost:bool -> formatter -> ident * ident -> unit
47
val pp_file: ident -> formatter -> ident * ident -> unit
48
val pp_basic_lib_fun: bool -> ident -> (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
49
val pp_c_decl_input_var: formatter -> var_decl -> unit
50

    
51
(* Prints a value expression [v], with internal function calls only. [pp_var] is
52
   a printer for variables (typically [pp_c_var_read]), but an offset suffix may
53
   be added for array variables *)
54
val pp_c_val: machine_t -> ident -> (formatter -> var_decl -> unit) -> formatter -> value_t -> unit
55

    
56
 (* Prints a constant value *)
57
val pp_c_const: formatter -> constant -> unit
58

    
59
(* Declaration of a local/mem variable: - if it's an array/matrix/etc, its
60
   size(s) should be known in order to statically allocate memory, so we print
61
   the full type *)
62
val pp_c_decl_local_var: ?pp_c_basic_type_desc:(Types.t -> string) -> machine_t -> formatter -> var_decl -> unit
63

    
64
(* type directed initialization: useless wrt the lustre compilation model,
65
   except for MPFR injection, where values are dynamically allocated *)
66
val pp_initialize: machine_t -> ident -> (formatter -> var_decl -> unit) -> formatter -> var_decl -> unit
67

    
68
(* type directed clear: useless wrt the lustre compilation model, except for
69
   MPFR injection, where values are dynamically allocated *)
70
val pp_clear: machine_t -> ident -> (formatter -> var_decl -> unit) -> formatter -> var_decl -> unit
71

    
72
val mk_call_var_decl: Location.t -> ident -> var_decl
73

    
74
val  pp_c_basic_type_desc: Types.t -> string
75

    
76
val has_c_prototype: ident -> dep_t list -> bool
77

    
78
val reset_label: label
79

    
80
type loop_index = LVar of ident | LInt of int ref | LAcc of value_t
81

    
82
val mk_loop_var: machine_t -> unit -> ident
83

    
84
(* Computes the list of nested loop variables together with their dimension
85
   bounds.
86
 *  - LInt r stands for loop expansion (no loop variable, but int loop
87
      index)
88
 *  - LVar v stands for loop variable v *)
89
val mk_loop_variables: machine_t -> Types.t -> int -> (Dimension.t * loop_index) list
90

    
91
val reset_loop_counter: unit -> unit
92

    
93
val reorder_loop_variables: (Dimension.t * loop_index) list -> (Dimension.t * loop_index) list
94

    
95
 (* Prints a [value] of type [var_type] indexed by the suffix list [loop_vars] *)
96
val pp_value_suffix: ?indirect:bool -> machine_t -> ident -> Types.t ->
97
  (Dimension.t * loop_index) list -> (formatter -> var_decl -> unit) -> formatter -> value_t -> unit
98

    
99
(* Generation of a non-clashing name for the self memory variable (for step and
100
   reset functions) *)
101
val mk_self: machine_t -> ident
102
val mk_mem: machine_t -> ident
103
val mk_mem_in: machine_t -> ident
104
val mk_mem_out: machine_t -> ident
105
val mk_mem_reset: machine_t -> ident
106

    
107
(* Generation of a non-clashing name for the attribute variable of static
108
   allocation macro *)
109
val mk_attribute: machine_t -> ident
110

    
111
(* Generation of a non-clashing name for the instance variable of static
112
   allocation macro *)
113
val mk_instance: machine_t -> ident
114

    
115
val mpfr_vars: var_decl list -> var_decl list
116
val mpfr_consts: const_desc list -> const_desc list
117

    
118
val reset_flag_name: string
119

    
120
val file_to_module_name: string -> string
121

    
122
val protect_filename: string -> string
123

    
124
(* Computes the depth to which multi-dimension array assignments should be
125
   expanded. It equals the maximum number of nested static array constructions
126
   accessible from root [v]. *)
127
val expansion_depth: value_t -> int
128

    
129
module type MODIFIERS_GHOST_PROTO = sig
130
  val pp_ghost_parameters :
131
    ?cut:bool ->
132
    formatter ->
133
    (string * (formatter -> string -> unit)) list ->
134
    unit
135
end
136

    
137
module EmptyGhostProto : MODIFIERS_GHOST_PROTO
138

    
139
module Protos (Mod : MODIFIERS_GHOST_PROTO): sig
140
  val print_stateless_prototype: formatter -> ident * var_decl list * var_decl list -> unit
141
  val print_clear_reset_prototype: ident -> ident -> formatter -> ident * var_decl list -> unit
142
  val print_set_reset_prototype: ident -> ident -> formatter -> ident * var_decl list -> unit
143
  val print_step_prototype: ident -> ident -> formatter -> ident * var_decl list * var_decl list -> unit
144
  val print_init_prototype: ident -> formatter -> ident * var_decl list -> unit
145
  val print_clear_prototype: ident -> formatter -> ident * var_decl list -> unit
146
end
(6-6/18)