Project

General

Profile

Revision d4807c3d src/normalization.ml

View differences:

src/normalization.ml
142 142
      mkeq expr.expr_loc (List.map (fun v -> v.var_id) new_aliases, expr)
143 143
    in (new_def::defs, new_aliases@vars), replace_expr new_aliases expr
144 144

  
145
(* Create an alias for [expr], if [opt] *)
145
(* Create an alias for [expr], if [expr] is not already an alias (i.e. an ident)
146
   and [opt] is true *)
146 147
let mk_expr_alias_opt opt node defvars expr =
147
 if opt
148
 then
149
   mk_expr_alias node defvars expr
150
 else
151
   defvars, expr
148
  match expr.expr_desc with
149
  | Expr_ident alias ->
150
    defvars, expr
151
  | _                -> 
152
    if opt
153
    then
154
      mk_expr_alias node defvars expr
155
    else
156
      defvars, expr
152 157

  
153 158
(* Create a (normalized) expression from [ref_e], 
154 159
   replacing description with [norm_d],
......
286 291
  | _ -> normalize_expr ~alias:alias node offsets defvars expr
287 292

  
288 293
and normalize_guard node defvars expr =
289
  match expr.expr_desc with
290
  | Expr_ident _ -> defvars, expr
291
  | _ ->
292
    let defvars, norm_expr = normalize_expr node [] defvars expr in
293
    mk_expr_alias_opt true node defvars norm_expr
294
  let defvars, norm_expr = normalize_expr node [] defvars expr in
295
  mk_expr_alias_opt true node defvars norm_expr
294 296

  
295 297
(* outputs cannot be memories as well. If so, introduce new local variable.
296 298
*)

Also available in: Unified diff