Project

General

Profile

Revision f4cba4b8 src/causality.ml

View differences:

src/causality.ml
148 148
    List.fold_left eq_memory_variables ISet.empty (get_node_eqs nd)
149 149

  
150 150
  let node_input_variables nd =
151
    List.fold_left (fun inputs v -> ISet.add v.var_id inputs) ISet.empty nd.node_inputs
151
    List.fold_left (fun inputs v -> ISet.add v.var_id inputs) ISet.empty 
152
      (if nd.node_iscontract then
153
         nd.node_inputs@nd.node_outputs
154
       else
155
         nd.node_inputs)
156
    
157
  let node_output_variables nd =
158
    List.fold_left (fun outputs v -> ISet.add v.var_id outputs) ISet.empty
159
      (if nd.node_iscontract then [] else nd.node_outputs)
152 160

  
153 161
  let node_local_variables nd =
154 162
    List.fold_left (fun locals v -> ISet.add v.var_id locals) ISet.empty nd.node_locals
......
156 164
  let node_constant_variables nd =
157 165
    List.fold_left (fun locals v -> if v.var_dec_const then ISet.add v.var_id locals else locals) ISet.empty nd.node_locals
158 166

  
159
  let node_output_variables nd =
160
    List.fold_left (fun outputs v -> ISet.add v.var_id outputs) ISet.empty nd.node_outputs
161

  
162 167
  let node_auxiliary_variables nd =
163 168
    ISet.diff (node_local_variables nd) (node_memory_variables nd)
164 169

  
......
170 175
(* computes the equivalence relation relating variables 
171 176
   in the same equation lhs, under the form of a table 
172 177
   of class representatives *)
173
  let node_eq_equiv nd =
178
  let eqs_eq_equiv eqs =
174 179
    let eq_equiv = Hashtbl.create 23 in
175 180
    List.iter (fun eq ->
176 181
      let first = List.hd eq.eq_lhs in
177 182
      List.iter (fun v -> Hashtbl.add eq_equiv v first) eq.eq_lhs
178 183
    )
179
      (get_node_eqs nd);
184
      eqs;
180 185
    eq_equiv
181

  
186
    
187
  let node_eq_equiv nd = eqs_eq_equiv  (get_node_eqs nd)
188
  
182 189
(* Create a tuple of right dimension, according to [expr] type, *)
183 190
(* filled with variable [v] *)
184 191
  let adjust_tuple v expr =
......
624 631
    ISet.iter (fun m -> IdentDepGraph.add_edge g world m) mems;
625 632
  end
626 633

  
634
(* Takes a node and return a pair (node', graph) where node' is node
635
   rebuilt with the equations enriched with new ones introduced to
636
   "break cycles" *)
627 637
let global_dependency node =
628 638
  let mems = ExprDep.node_memory_variables node in
629 639
  let inputs =

Also available in: Unified diff