Skip to content
Snippets Groups Projects
Commit 8c44e216 authored by David Bühler's avatar David Bühler
Browse files

[Slicing] Minor simplifications in the use of Eva results.

parent e6c234b9
No related branches found
No related tags found
No related merge requests found
...@@ -54,9 +54,7 @@ let exists_fun_callers fpred kf = ...@@ -54,9 +54,7 @@ let exists_fun_callers fpred kf =
then false (* no way to call the initial [kf]. *) then false (* no way to call the initial [kf]. *)
else begin else begin
table := Kernel_function.Set.add kf !table ; table := Kernel_function.Set.add kf !table ;
List.exists List.exists exists_fun_callers (Eva.Results.callers kf)
(fun kf -> exists_fun_callers kf)
(Eva.Results.callers kf)
end end
in in
exists_fun_callers kf exists_fun_callers kf
...@@ -1454,12 +1452,11 @@ let merge_fun_callers get_list get_value merge is_top acc kf = ...@@ -1454,12 +1452,11 @@ let merge_fun_callers get_list get_value merge is_top acc kf =
raise StopMerging (* acceleration when top is reached *) raise StopMerging (* acceleration when top is reached *)
in in
let rec merge_fun_callers kf = let rec merge_fun_callers kf =
let merge_fun_caller kf = merge_fun_callers kf in
let vf = Kernel_function.get_vi kf in let vf = Kernel_function.get_vi kf in
if not (Cil_datatype.Varinfo.Set.mem vf !table) then begin if not (Cil_datatype.Varinfo.Set.mem vf !table) then begin
table := Cil_datatype.Varinfo.Set.add vf !table ; table := Cil_datatype.Varinfo.Set.add vf !table ;
List.iter (fun x -> merge (get_value x)) (get_list kf) ; List.iter (fun x -> merge (get_value x)) (get_list kf) ;
List.iter merge_fun_caller (Eva.Results.callers kf) List.iter merge_fun_callers (Eva.Results.callers kf)
end end
(* else no way to add something, the [kf] contribution is already (* else no way to add something, the [kf] contribution is already
accumulated. *) accumulated. *)
......
...@@ -55,6 +55,11 @@ let apply_all ~propagate_to_callers = ...@@ -55,6 +55,11 @@ let apply_all ~propagate_to_callers =
let get_select_kf (fvar, _select) = Globals.Functions.get fvar let get_select_kf (fvar, _select) = Globals.Functions.get fvar
let get_lval_zone ?(access=Locations.Read) stmt lval =
let open Eva.Results in
before stmt |> eval_address lval |> as_zone ~access
|> default Locations.Zone.bottom
(** Utilities for [kinstr]. *) (** Utilities for [kinstr]. *)
module Kinstr: sig module Kinstr: sig
val iter_from_func : (stmt -> unit) -> kernel_function -> unit val iter_from_func : (stmt -> unit) -> kernel_function -> unit
...@@ -76,12 +81,8 @@ struct ...@@ -76,12 +81,8 @@ struct
(* returns [read_zone] joined to [Zone.t read] by [lv], [Zone.t written] by [lv] *) (* returns [read_zone] joined to [Zone.t read] by [lv], [Zone.t written] by [lv] *)
(* The modified locations are [looking_for], those address are (* The modified locations are [looking_for], those address are
function of [deps]. *) function of [deps]. *)
let zloc, deps = let zloc = get_lval_zone ~access:Locations.Write stmt lv in
Eva.Results.( let deps = Eva.Results.(before stmt |> address_deps lv) in
before stmt |> eval_address lv |> as_zone ~access:Locations.Write |>
default Locations.Zone.bottom,
before stmt |> address_deps lv)
in
Locations.Zone.join read_zone deps, zloc Locations.Zone.join read_zone deps, zloc
in in
let call_process lv f args _loc = let call_process lv f args _loc =
...@@ -320,10 +321,7 @@ let select_stmt_lval set mark lval_str ~before ki ~eval kf = ...@@ -320,10 +321,7 @@ let select_stmt_lval set mark lval_str ~before ki ~eval kf =
let lval = let lval =
!Db.Properties.Interp.term_lval_to_lval ~result:None lval_term !Db.Properties.Interp.term_lval_to_lval ~result:None lval_term
in in
let zone = let zone = get_lval_zone eval lval in
Eva.Results.(before eval |> eval_address lval |> as_zone) |>
Result.value ~default:Locations.Zone.bottom
in
Locations.Zone.join zone acc) Locations.Zone.join zone acc)
lval_str lval_str
Locations.Zone.bottom Locations.Zone.bottom
...@@ -353,10 +351,7 @@ let select_lval_rw set mark ~rd ~wr ~eval kf ki_opt= ...@@ -353,10 +351,7 @@ let select_lval_rw set mark ~rd ~wr ~eval kf ki_opt=
let lval_term = !Db.Properties.Interp.term_lval kf lval_str in let lval_term = !Db.Properties.Interp.term_lval kf lval_str in
let lval = !Db.Properties.Interp.term_lval_to_lval ~result:None lval_term in let lval = !Db.Properties.Interp.term_lval_to_lval ~result:None lval_term in
let access = if for_writing then Locations.Write else Locations.Read in let access = if for_writing then Locations.Write else Locations.Read in
let zone = let zone = get_lval_zone ~access eval lval in
Eva.Results.(before eval |> eval_address lval |> as_zone ~access) |>
Result.value ~default:Locations.Zone.bottom
in
Locations.Zone.join zone acc) Locations.Zone.join zone acc)
lval_str Locations.Zone.bottom lval_str Locations.Zone.bottom
in SlicingParameters.debug ~level:3 in SlicingParameters.debug ~level:3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment