1
|
open LustreSpec
|
2
|
|
3
|
let plugins =
|
4
|
[
|
5
|
(module Scopes.Plugin : PluginType.PluginType);
|
6
|
(module Salsa_plugin.Plugin : PluginType.PluginType)
|
7
|
]
|
8
|
|
9
|
|
10
|
let options () =
|
11
|
List.flatten (
|
12
|
List.map Options.plugin_opt (
|
13
|
List.map (fun m ->
|
14
|
let module M = (val m : PluginType.PluginType) in
|
15
|
(M.name, M.activate, M.options)
|
16
|
) plugins
|
17
|
))
|
18
|
|
19
|
let check_force_stateful () =
|
20
|
List.exists (fun m ->
|
21
|
let module M = (val m : PluginType.PluginType) in
|
22
|
M.check_force_stateful ()
|
23
|
) plugins
|
24
|
|
25
|
let refine_machine_code prog machine_code =
|
26
|
List.fold_left (fun accu m ->
|
27
|
let module M = (val m : PluginType.PluginType) in
|
28
|
M.refine_machine_code prog accu
|
29
|
) machine_code plugins
|
30
|
|
31
|
|
32
|
let c_backend_main_loop_body_suffix fmt () =
|
33
|
List.iter (fun (m: (module PluginType.PluginType)) ->
|
34
|
let module M = (val m : PluginType.PluginType) in
|
35
|
M.c_backend_main_loop_body_suffix fmt ()) plugins
|
36
|
|
37
|
(* Specific treatment of annotations when inlining, specific of declared plugins *)
|
38
|
|
39
|
let inline_annots rename_var_fun annot_list =
|
40
|
List.map (
|
41
|
fun ann ->
|
42
|
{ ann with
|
43
|
annots = List.fold_left (
|
44
|
fun accu (sl, eexpr) ->
|
45
|
let items =
|
46
|
match sl with
|
47
|
| plugin_name::args ->
|
48
|
if plugin_name = "salsa" then
|
49
|
match args with
|
50
|
| ["ranges";varname] ->
|
51
|
[["salsa";"ranges";(rename_var_fun varname)], eexpr]
|
52
|
| _ -> [(sl, eexpr)]
|
53
|
else
|
54
|
[(sl, eexpr)]
|
55
|
| _ -> assert false
|
56
|
in
|
57
|
items@accu
|
58
|
) [] ann.annots
|
59
|
}
|
60
|
) annot_list
|
61
|
|
62
|
(* Local Variables: *)
|
63
|
(* compile-command:"make -C .." *)
|
64
|
(* End: *)
|