Revision 2863281f
Added by Pierre-Loïc Garoche almost 7 years ago
src/optimize_machine.ml | ||
---|---|---|
14 | 14 |
open Machine_code_types |
15 | 15 |
open Corelang |
16 | 16 |
open Causality |
17 |
open Machine_code
|
|
17 |
open Machine_code_common
|
|
18 | 18 |
open Dimension |
19 | 19 |
|
20 | 20 |
|
... | ... | |
228 | 228 |
let static_call_unfold elim (inst, (n, args)) = |
229 | 229 |
let replace v = |
230 | 230 |
try |
231 |
Machine_code.dimension_of_value (IMap.find v elim)
|
|
231 |
dimension_of_value (IMap.find v elim) |
|
232 | 232 |
with Not_found -> Dimension.mkdim_ident Location.dummy_loc v |
233 | 233 |
in (inst, (n, List.map (Dimension.expr_replace_expr replace) args)) |
234 | 234 |
|
... | ... | |
578 | 578 |
Log.report ~level:1 |
579 | 579 |
(fun fmt -> Format.fprintf fmt ".. machines optimization: sub-expression elimination@,"); |
580 | 580 |
let machine_code = machines_cse machine_code in |
581 |
Log.report ~level:3 (fun fmt -> Format.fprintf fmt ".. generated machines (sub-expr elim):@ %a@ "Machine_code.pp_machines machine_code);
|
|
581 |
Log.report ~level:3 (fun fmt -> Format.fprintf fmt ".. generated machines (sub-expr elim):@ %a@ "pp_machines machine_code); |
|
582 | 582 |
machine_code |
583 | 583 |
end |
584 | 584 |
else |
... | ... | |
593 | 593 |
let machine_code, removed_table = machines_unfold (Corelang.get_consts prog) node_schs machine_code in |
594 | 594 |
Log.report ~level:3 (fun fmt -> Format.fprintf fmt "\t@[Eliminated constants: @[%a@]@]@ " |
595 | 595 |
(pp_imap pp_elim) removed_table); |
596 |
Log.report ~level:3 (fun fmt -> Format.fprintf fmt ".. generated machines (const inlining):@ %a@ "Machine_code.pp_machines machine_code);
|
|
596 |
Log.report ~level:3 (fun fmt -> Format.fprintf fmt ".. generated machines (const inlining):@ %a@ "pp_machines machine_code); |
|
597 | 597 |
machine_code, removed_table |
598 | 598 |
end |
599 | 599 |
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