Revision 2863281f
Added by Pierre-Loïc Garoche almost 7 years ago
src/backends/C/c_backend_src.ml | ||
---|---|---|
13 | 13 |
open Lustre_types |
14 | 14 |
open Machine_code_types |
15 | 15 |
open Corelang |
16 |
open Machine_code |
|
16 |
open Machine_code_common
|
|
17 | 17 |
open C_backend_common |
18 | 18 |
|
19 | 19 |
module type MODIFIERS_SRC = |
... | ... | |
146 | 146 |
( |
147 | 147 |
match loop_vars, value.value_desc with |
148 | 148 |
| (x, LAcc i) :: q, _ when is_const_index i -> |
149 |
let r = ref (Dimension.size_const_dimension (Machine_code.dimension_of_value i)) in
|
|
149 |
let r = ref (Dimension.size_const_dimension (dimension_of_value i)) in |
|
150 | 150 |
pp_value_suffix self var_type ((x, LInt r)::q) pp_value fmt value |
151 | 151 |
| (_, LInt r) :: q, Cst (Const_array cl) -> |
152 | 152 |
let var_type = Types.array_element_type var_type in |
... | ... | |
175 | 175 |
then Format.fprintf fmt "%a%a" pp_value v pp_suffix loop_vars |
176 | 176 |
else Format.fprintf fmt "%s->_reg.%a%a" self pp_value v pp_suffix loop_vars |
177 | 177 |
| _ , Cst cst -> pp_c_const_suffix var_type fmt cst |
178 |
| _ , _ -> (Format.eprintf "internal error: C_backend_src.pp_value_suffix %a %a %a@." Types.print_ty var_type Machine_code.pp_val value pp_suffix loop_vars; assert false)
|
|
178 |
| _ , _ -> (Format.eprintf "internal error: C_backend_src.pp_value_suffix %a %a %a@." Types.print_ty var_type pp_val value pp_suffix loop_vars; assert false) |
|
179 | 179 |
) |
180 | 180 |
|
181 | 181 |
(* Subsumes C_backend_common.pp_c_val to cope with aggressive substitution |
... | ... | |
611 | 611 |
print_global_init_prototype baseNAME |
612 | 612 |
(pp_c_basic_type_desc Type_predef.type_bool) |
613 | 613 |
(* constants *) |
614 |
(Utils.fprintf_list ~sep:"@," (pp_const_initialize (pp_c_var_read Machine_code.empty_machine))) constants
|
|
614 |
(Utils.fprintf_list ~sep:"@," (pp_const_initialize (pp_c_var_read empty_machine))) constants |
|
615 | 615 |
(Utils.pp_final_char_if_non_empty "@," dependencies) |
616 | 616 |
(* dependencies initialization *) |
617 | 617 |
(Utils.fprintf_list ~sep:"@," print_import_init) dependencies |
... | ... | |
623 | 623 |
print_global_clear_prototype baseNAME |
624 | 624 |
(pp_c_basic_type_desc Type_predef.type_bool) |
625 | 625 |
(* constants *) |
626 |
(Utils.fprintf_list ~sep:"@," (pp_const_clear (pp_c_var_read Machine_code.empty_machine))) constants
|
|
626 |
(Utils.fprintf_list ~sep:"@," (pp_const_clear (pp_c_var_read empty_machine))) constants |
|
627 | 627 |
(Utils.pp_final_char_if_non_empty "@," dependencies) |
628 | 628 |
(* dependencies initialization *) |
629 | 629 |
(Utils.fprintf_list ~sep:"@," print_import_clear) dependencies |
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