Project

General

Profile

Revision e49b6d55 src/normalization.ml

View differences:

src/normalization.ml
80 80
let get_expr_alias defs expr =
81 81
 try Some (List.find (fun eq -> is_eq_expr eq.eq_rhs expr) defs)
82 82
 with
83
   Not_found -> None
84

  
83
 | Not_found -> None
84
  
85 85
(* Replace [expr] with (tuple of) [locals] *)
86 86
let replace_expr locals expr =
87 87
 match locals with
......
156 156
   taking propagated [offsets] into account
157 157
   in order to change expression type *)
158 158
let mk_norm_expr offsets ref_e norm_d =
159
(*Format.eprintf "mk_norm_expr %a %a @." Printers.pp_expr ref_e Printers.pp_expr { ref_e with expr_desc = norm_d};*)
159
  (*Format.eprintf "mk_norm_expr %a %a @." Printers.pp_expr ref_e Printers.pp_expr { ref_e with expr_desc = norm_d};*)
160 160
  let drop_array_type ty =
161 161
    Types.map_tuple_type Types.array_element_type ty in
162 162
  { ref_e with
163 163
    expr_desc = norm_d;
164 164
    expr_type = Utils.repeat (List.length offsets) drop_array_type ref_e.expr_type }
165

  
165
														
166 166
(* normalize_<foo> : defs * used vars -> <foo> -> (updated defs * updated vars) * normalized <foo> *)
167 167
let rec normalize_list alias node offsets norm_element defvars elist =
168 168
  List.fold_right
......
172 172
    ) elist (defvars, [])
173 173

  
174 174
let rec normalize_expr ?(alias=true) node offsets defvars expr =
175
(*Format.eprintf "normalize %B %a:%a [%a]@." alias Printers.pp_expr expr Types.print_ty expr.expr_type (Utils.fprintf_list ~sep:"," Dimension.pp_dimension) offsets;*)
175
  (*Format.eprintf "normalize %B %a:%a [%a]@." alias Printers.pp_expr expr Types.print_ty expr.expr_type (Utils.fprintf_list ~sep:"," Dimension.pp_dimension) offsets;*)
176 176
  match expr.expr_desc with
177 177
  | Expr_const _
178 178
  | Expr_ident _ -> defvars, unfold_offsets expr offsets

Also available in: Unified diff