Project

General

Profile

Revision 7065d912 src/normalization.ml

View differences:

src/normalization.ml
74 74
    { expr with expr_desc = Expr_ite (expr_once loc ck, e1, e2) }
75 75
 | _                   -> assert false
76 76

  
77
let cpt_fresh = ref 0
78

  
79
(* Generate a new local [node] variable *)
80
let mk_fresh_var node loc ty ck =
81
  let vars = get_node_vars node in
82
  let rec aux () =
83
  incr cpt_fresh;
84
  let s = Printf.sprintf "__%s_%d" node.node_id !cpt_fresh in
85
  if List.exists (fun v -> v.var_id = s) vars then aux () else
86
  {
87
    var_id = s;
88
    var_orig = false;
89
    var_dec_type = dummy_type_dec;
90
    var_dec_clock = dummy_clock_dec;
91
    var_dec_const = false;
92
    var_dec_value = None;
93
    var_parent_nodeid = Some node.node_id;
94
    var_type = ty;
95
    var_clock = ck;
96
    var_loc = loc
97
  }
98
  in aux ()
77

  
99 78

  
100 79
(* Get the equation in [defs] with [expr] as rhs, if any *)
101 80
let get_expr_alias defs expr =
......
397 376
    -
398 377
*)
399 378
let normalize_node node =
400
  cpt_fresh := 0;
379
  reset_cpt_fresh ();
401 380
  let inputs_outputs = node.node_inputs@node.node_outputs in
402 381
  let orig_vars = inputs_outputs@node.node_locals in
403 382
  let not_is_orig_var v =

Also available in: Unified diff