Revision 2863281f
Added by Pierre-Loïc Garoche almost 7 years ago
src/backends/C/c_backend_header.ml | ||
---|---|---|
13 | 13 |
open Lustre_types |
14 | 14 |
open Corelang |
15 | 15 |
open Machine_code_types |
16 |
open Machine_code_common |
|
16 | 17 |
open C_backend_common |
17 | 18 |
|
18 | 19 |
(********************************************************************************************) |
... | ... | |
22 | 23 |
|
23 | 24 |
module type MODIFIERS_HDR = |
24 | 25 |
sig |
25 |
val print_machine_decl_prefix: Format.formatter -> Machine_code_types.machine_t -> unit
|
|
26 |
val print_machine_decl_prefix: Format.formatter -> machine_t -> unit |
|
26 | 27 |
end |
27 | 28 |
|
28 | 29 |
module EmptyMod = |
... | ... | |
44 | 45 |
fprintf fmt "#include <mpfr.h>@." |
45 | 46 |
end; |
46 | 47 |
if !Options.cpp then |
47 |
fprintf fmt "#include \"%s/arrow.hpp\"@.@." Machine_code.arrow_top_decl.top_decl_owner
|
|
48 |
fprintf fmt "#include \"%s/arrow.hpp\"@.@." Arrow.arrow_top_decl.top_decl_owner
|
|
48 | 49 |
else |
49 |
fprintf fmt "#include \"%s/arrow.h\"@.@." Machine_code.arrow_top_decl.top_decl_owner
|
|
50 |
fprintf fmt "#include \"%s/arrow.h\"@.@." Arrow.arrow_top_decl.top_decl_owner
|
|
50 | 51 |
|
51 | 52 |
end |
52 | 53 |
|
53 | 54 |
let rec print_static_val pp_var fmt v = |
54 |
let open Machine_code_types in |
|
55 | 55 |
match v.value_desc with |
56 | 56 |
| Cst c -> pp_c_const fmt c |
57 | 57 |
| LocalVar v -> pp_var fmt v |
... | ... | |
62 | 62 |
Format.fprintf fmt "%s %a = %a" |
63 | 63 |
attr |
64 | 64 |
(pp_c_type (Format.sprintf "%s ## %s" inst v.var_id)) v.var_type |
65 |
(print_static_val pp_var) (Machine_code.get_const_assign m v)
|
|
65 |
(print_static_val pp_var) (get_const_assign m v) |
|
66 | 66 |
|
67 | 67 |
let print_static_constant_decl (m, attr, inst) fmt const_locals = |
68 | 68 |
let pp_var fmt v = |
... | ... | |
82 | 82 |
Format.fprintf fmt "%s ## %s" inst v.var_id |
83 | 83 |
else |
84 | 84 |
Format.fprintf fmt "%s" v.var_id in |
85 |
let values = List.map (Machine_code.value_of_dimension m) static in
|
|
85 |
let values = List.map (value_of_dimension m) static in |
|
86 | 86 |
fprintf fmt "%a(%s, %a%t%s)" |
87 | 87 |
pp_machine_static_declare_name (node_name n) |
88 | 88 |
attr |
... | ... | |
162 | 162 |
let print_machine_decl fmt m = |
163 | 163 |
begin |
164 | 164 |
Mod.print_machine_decl_prefix fmt m; |
165 |
if fst (Machine_code.get_stateless_status m) then
|
|
165 |
if fst (get_stateless_status m) then |
|
166 | 166 |
begin |
167 | 167 |
fprintf fmt "extern %a;@.@." |
168 | 168 |
print_stateless_prototype |
... | ... | |
211 | 211 |
|
212 | 212 |
let print_machine_alloc_decl fmt m = |
213 | 213 |
Mod.print_machine_decl_prefix fmt m; |
214 |
if fst (Machine_code.get_stateless_status m) then
|
|
214 |
if fst (get_stateless_status m) then |
|
215 | 215 |
begin |
216 | 216 |
end |
217 | 217 |
else |
Also available in: Unified diff
Further restructuring:
- arrow.ml* to define basic builder for arrow (node, name, ...)
- machine_code_common similar to corelang but for machine_code (printers, some builders, ...)
- machine_code restricted to the translatation from normalized nodes to machines