Revision f6acf47b
Added by Pierre-Loïc Garoche about 9 years ago
src/main_lustre_compiler.ml | ||
---|---|---|
112 | 112 |
in |
113 | 113 |
|
114 | 114 |
(* Checking stateless/stateful status *) |
115 |
if Scopes.Plugin.is_active () then
|
|
115 |
if Plugins.check_force_stateful () then
|
|
116 | 116 |
force_stateful_decls prog |
117 | 117 |
else |
118 | 118 |
check_stateless_decls prog; |
... | ... | |
275 | 275 |
in |
276 | 276 |
|
277 | 277 |
(* Salsa optimize machine code *) |
278 |
let machine_code = |
|
279 |
if !Options.salsa_enabled then |
|
280 |
begin |
|
281 |
check_main (); |
|
282 |
Log.report ~level:1 (fun fmt -> fprintf fmt ".. salsa machines optimization (phase 3)@ "); |
|
283 |
(* Selecting float constants for Salsa *) |
|
284 |
let constEnv = List.fold_left ( |
|
285 |
fun accu c_topdecl -> |
|
286 |
match c_topdecl.top_decl_desc with |
|
287 |
| Const c when Types.is_real_type c.const_type -> |
|
288 |
(c.const_id, c.const_value) :: accu |
|
289 |
| _ -> accu |
|
290 |
) [] (Corelang.get_consts prog) |
|
291 |
in |
|
292 |
List.map |
|
293 |
(Machine_salsa_opt.machine_t2machine_t_optimized_by_salsa constEnv) |
|
294 |
machine_code |
|
295 |
end |
|
296 |
else |
|
297 |
machine_code |
|
298 |
in |
|
299 | 278 |
Log.report ~level:3 (fun fmt -> fprintf fmt "@[<v 2>@ %a@]@ " |
300 | 279 |
(Utils.fprintf_list ~sep:"@ " Machine_code.pp_machine) |
301 | 280 |
machine_code); |
... | ... | |
391 | 370 |
let machine_code = |
392 | 371 |
stage2 prog |
393 | 372 |
in |
394 |
if Scopes.Plugin.show_scopes () then |
|
395 |
begin |
|
396 |
let all_scopes = Scopes.compute_scopes prog !Options.main_node in |
|
397 |
(* Printing scopes *) |
|
398 |
if !Options.verbose_level >= 1 then |
|
399 |
Format.printf "Possible scopes are:@ "; |
|
400 |
Format.printf "@[<v>%a@ @]@.@?" Scopes.print_scopes all_scopes; |
|
401 |
exit 0 |
|
402 |
|
|
403 |
end; |
|
404 | 373 |
|
405 |
let machine_code = |
|
406 |
if Scopes.Plugin.is_active () then |
|
407 |
Scopes.Plugin.process_scopes !Options.main_node prog machine_code |
|
408 |
else |
|
409 |
machine_code |
|
410 |
in |
|
374 |
let machine_code = Plugins.refine_machine_code prog machine_code in |
|
411 | 375 |
|
412 | 376 |
stage3 prog machine_code dependencies basename; |
413 | 377 |
begin |
... | ... | |
443 | 407 |
try |
444 | 408 |
Printexc.record_backtrace true; |
445 | 409 |
|
446 |
let options = Options.options @ |
|
447 |
List.flatten ( |
|
448 |
List.map Options.plugin_opt [ |
|
449 |
Scopes.Plugin.name, Scopes.Plugin.activate, Scopes.Plugin.options |
|
450 |
] |
|
451 |
) |
|
452 |
in |
|
410 |
let options = Options.options @ (Plugins.options ()) in |
|
453 | 411 |
|
454 | 412 |
Arg.parse options anonymous usage |
455 | 413 |
with |
Also available in: Unified diff
Plugin based framework