Project

General

Profile

Revision 7065d912

View differences:

src/corelang.ml
1173 1173

  
1174 1174

  
1175 1175

  
1176
(* Generate a new local [node] variable *)
1177
let cpt_fresh = ref 0
1178

  
1179
let reset_cpt_fresh () =
1180
    cpt_fresh := 0
1181
    
1182
let mk_fresh_var node loc ty ck =
1183
  let vars = get_node_vars node in
1184
  let rec aux () =
1185
  incr cpt_fresh;
1186
  let s = Printf.sprintf "__%s_%d" node.node_id !cpt_fresh in
1187
  if List.exists (fun v -> v.var_id = s) vars then aux () else
1188
  {
1189
    var_id = s;
1190
    var_orig = false;
1191
    var_dec_type = dummy_type_dec;
1192
    var_dec_clock = dummy_clock_dec;
1193
    var_dec_const = false;
1194
    var_dec_value = None;
1195
    var_parent_nodeid = Some node.node_id;
1196
    var_type = ty;
1197
    var_clock = ck;
1198
    var_loc = loc
1199
  }
1200
  in aux ()
1176 1201

  
1177 1202
(* Local Variables: *)
1178 1203
(* compile-command:"make -C .." *)
src/corelang.mli
162 162
(* val mkpredef_call: Location.t -> ident -> eexpr list -> eexpr*)
163 163

  
164 164
val expr_contains_expr: tag -> expr -> bool
165

  
166
val reset_cpt_fresh: unit -> unit
167
val mk_fresh_var: node_desc -> Location.t -> Types.type_expr ->  Clocks.clock_expr -> var_decl
165 168
(* Local Variables: *)
166 169
(* compile-command:"make -C .." *)
167 170
(* End: *)
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