Project

General

Profile

Revision 53206908 src/liveness.ml

View differences:

src/liveness.ml
115 115
(* checks whether a variable is aliasable,
116 116
   depending on its (address) type *)
117 117
let is_aliasable var =
118
 Types.is_address_type var.var_type
118
  (not (!Options.mpfr && Types.is_real_type var.var_type)) && Types.is_address_type var.var_type
119 119
 
120 120
(* checks whether a variable [v] is an input of the [var] equation, with an address type.
121 121
   if so, [var] could not safely reuse/alias [v], should [v] be dead in the caller node,
......
127 127
    | None           -> []
128 128
    | Some (_, args) -> List.fold_right (fun e r -> match e.expr_desc with Expr_ident id -> id::r | _ -> r) args [] in
129 129
  fun v -> is_aliasable v && List.mem v.var_id inputs_var
130
(*
131
    let res =
132
is_aliasable v && List.mem v.var_id inputs_var
133
    in (Format.eprintf "aliasable %s by %s = %B@." var v.var_id res; res)
134
*)
130

  
135 131
(* replace variable [v] by [v'] in graph [g].
136 132
   [v'] is a dead variable
137 133
*)
......
207 203
    let disjoint_live = Disjunction.CISet.inter disjoint live in
208 204
    Log.report ~level:7 (fun fmt -> Format.fprintf fmt "disjoint live:%a@." Disjunction.pp_ciset disjoint_live);
209 205
    let reuse = Disjunction.CISet.max_elt disjoint_live in
210
    (*let reuse' = Hashtbl.find ctx.policy reuse.var_id in*)
211 206
    begin
212 207
      IdentDepGraph.add_edge ctx.dep_graph var.var_id reuse.var_id;
213
      (*if reuse != reuse' then IdentDepGraph.add_edge ctx.dep_graph reuse.var_id reuse'.var_id;*)
214 208
      Hashtbl.add ctx.policy var.var_id reuse;
215 209
      ctx.evaluated <- Disjunction.CISet.add var ctx.evaluated;
216 210
      (*Format.eprintf "%s reused by live@." var.var_id;*)
......
220 214
    let dead = Disjunction.CISet.filter (fun v -> is_graph_root v.var_id ctx.dep_graph) quasi_dead in
221 215
    Log.report ~level:7 (fun fmt -> Format.fprintf fmt "dead:%a@." Disjunction.pp_ciset dead);
222 216
    let reuse = Disjunction.CISet.choose dead in
223
    (*let reuse' = Hashtbl.find ctx.policy reuse.var_id in*)
224 217
    begin
225 218
      IdentDepGraph.add_edge ctx.dep_graph var.var_id reuse.var_id;
226
      (*if reuse != reuse' then IdentDepGraph.add_edge ctx.dep_graph reuse.var_id reuse'.var_id;*)
227 219
      Hashtbl.add ctx.policy var.var_id reuse;
228 220
      ctx.evaluated <- Disjunction.CISet.add var ctx.evaluated;
229
      (*Format.eprintf "%s reused by dead %a@." var.var_id Disjunction.pp_ciset dead;*)
221
      (*Format.eprintf "%s reused by dead %s@." var.var_id reuse.var_id;*)
230 222
    end
231 223
      with Not_found ->
232 224
    begin

Also available in: Unified diff