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
|
|
18
|
val filter_static_inputs : var_decl list -> expr list -> Dimension.t list
|
19
|
|
20
|
val compute_generic_calls : program_t -> unit
|
21
|
|
22
|
val get_callee : expr -> (ident * expr list) option
|
23
|
|
24
|
val get_calls : (ident -> bool) -> node_desc -> expr list
|
25
|
end
|
26
|
|
27
|
(* Look for cycles in a dependency graph *)
|
28
|
module CycleDetection : sig
|
29
|
val check_cycles : IdentDepGraph.t -> unit
|
30
|
end
|
31
|
|
32
|
(* A module to sort dependencies among local variables when relying on clocked
|
33
|
declarations *)
|
34
|
module VarClockDep : sig
|
35
|
val sort : var_decl list -> var_decl list
|
36
|
end
|
37
|
|
38
|
module ExprDep : sig
|
39
|
(* instance vars represent node instance calls, they are not part of the
|
40
|
program/schedule, but used to simplify causality analysis *)
|
41
|
val mk_instance_var : ident -> ident
|
42
|
|
43
|
val mk_read_var : ident -> ident
|
44
|
|
45
|
val is_instance_var : ident -> bool
|
46
|
|
47
|
val is_ghost_var : ident -> bool
|
48
|
|
49
|
val is_read_var : ident -> bool
|
50
|
|
51
|
val undo_instance_var : ident -> ident
|
52
|
|
53
|
val undo_read_var : ident -> ident
|
54
|
|
55
|
val node_eq_equiv : node_desc -> (ident, ident) Hashtbl.t
|
56
|
|
57
|
val node_input_variables : node_desc -> ISet.t
|
58
|
|
59
|
val node_local_variables : node_desc -> ISet.t
|
60
|
|
61
|
val node_output_variables : node_desc -> ISet.t
|
62
|
|
63
|
val node_memory_variables : node_desc -> ISet.t
|
64
|
end
|
65
|
|
66
|
(* Module used to compute static disjunction of variables based upon their
|
67
|
clocks. *)
|
68
|
module Disjunction : sig
|
69
|
module CISet : Set.S with type elt = var_decl
|
70
|
|
71
|
(* map: var |-> list of disjoint vars, sorted in increasing branch length
|
72
|
order, maybe removing shorter branches *)
|
73
|
type disjoint_map = (ident, CISet.t) Hashtbl.t
|
74
|
|
75
|
val pp_ciset : Format.formatter -> CISet.t -> unit
|
76
|
|
77
|
val clock_disjoint_map : var_decl list -> disjoint_map
|
78
|
|
79
|
val pp_disjoint_map : Format.formatter -> disjoint_map -> unit
|
80
|
end
|
81
|
|
82
|
(* Tests whether [v] is a root of graph [g], i.e. a source *)
|
83
|
val is_graph_root : ident -> IdentDepGraph.t -> bool
|
84
|
|
85
|
(* Computes the set of graph roots, i.e. the sources of acyclic graph [g] *)
|
86
|
val graph_roots : IdentDepGraph.t -> ident list
|
87
|
|
88
|
(* Takes a node and return a pair (node', graph) where node' is node rebuilt
|
89
|
with the equations enriched with new ones introduced to "break cycles" *)
|
90
|
val global_dependency : node_desc -> node_desc * IdentDepGraph.t
|
91
|
|
92
|
val pp_dep_graph : Format.formatter -> IdentDepGraph.t -> unit
|