1
|
open Utils
|
2
|
open Lustre_types
|
3
|
|
4
|
type error =
|
5
|
| DataCycle of ident list list
|
6
|
(* multiple failed partitions at once *)
|
7
|
| NodeCycle of ident list
|
8
|
|
9
|
exception Error of error
|
10
|
|
11
|
val pp_error: Format.formatter -> error -> unit
|
12
|
|
13
|
val world: ident
|
14
|
|
15
|
module NodeDep: sig
|
16
|
val dependence_graph: program_t -> IdentDepGraph.t
|
17
|
val filter_static_inputs: var_decl list -> expr list -> Dimension.t list
|
18
|
val compute_generic_calls: program_t -> unit
|
19
|
val get_callee: expr -> (ident * expr list) option
|
20
|
val get_calls: (ident -> bool) -> node_desc -> expr list
|
21
|
end
|
22
|
|
23
|
(* Look for cycles in a dependency graph *)
|
24
|
module CycleDetection: sig
|
25
|
val check_cycles: IdentDepGraph.t -> unit
|
26
|
end
|
27
|
|
28
|
(* A module to sort dependencies among local variables when relying on clocked
|
29
|
declarations *)
|
30
|
module VarClockDep: sig
|
31
|
val sort: var_decl list -> var_decl list
|
32
|
end
|
33
|
|
34
|
module ExprDep: sig
|
35
|
(* instance vars represent node instance calls, they are not part of the
|
36
|
program/schedule, but used to simplify causality analysis *)
|
37
|
val mk_instance_var: ident -> ident
|
38
|
val is_instance_var: ident -> bool
|
39
|
val is_ghost_var: ident -> bool
|
40
|
val is_read_var: ident -> bool
|
41
|
val undo_instance_var: ident -> ident
|
42
|
val undo_read_var: ident -> ident
|
43
|
val node_eq_equiv: node_desc -> (ident, ident) Hashtbl.t
|
44
|
val node_input_variables: node_desc -> ISet.t
|
45
|
val node_local_variables: node_desc -> ISet.t
|
46
|
val node_output_variables: node_desc -> ISet.t
|
47
|
val node_memory_variables: node_desc -> ISet.t
|
48
|
end
|
49
|
|
50
|
(* Module used to compute static disjunction of variables based upon their
|
51
|
clocks. *)
|
52
|
module Disjunction: sig
|
53
|
module CISet: Set.S with type elt = var_decl
|
54
|
|
55
|
(* map: var |-> list of disjoint vars, sorted in increasing branch length
|
56
|
order, maybe removing shorter branches *)
|
57
|
type disjoint_map = (ident, CISet.t) Hashtbl.t
|
58
|
|
59
|
val pp_ciset: Format.formatter -> CISet.t -> unit
|
60
|
|
61
|
val clock_disjoint_map: var_decl list -> disjoint_map
|
62
|
|
63
|
val pp_disjoint_map: Format.formatter -> disjoint_map -> unit
|
64
|
end
|
65
|
|
66
|
(* Tests whether [v] is a root of graph [g], i.e. a source *)
|
67
|
val is_graph_root: ident -> IdentDepGraph.t -> bool
|
68
|
|
69
|
(* Computes the set of graph roots, i.e. the sources of acyclic graph [g] *)
|
70
|
val graph_roots: IdentDepGraph.t -> ident list
|
71
|
|
72
|
(* Takes a node and return a pair (node', graph) where node' is node rebuilt
|
73
|
with the equations enriched with new ones introduced to "break cycles" *)
|
74
|
val global_dependency: node_desc -> node_desc * IdentDepGraph.t
|
75
|
|
76
|
val pp_dep_graph: Format.formatter -> IdentDepGraph.t -> unit
|