let record_for_individual_froms (call_stack, instrstates) =
if Parameters.Dynamic.Bool.get "-calldeps"
then begin
let module Froms_To_Use =
struct
let get _f callsite =
let _current_function, table = List.hd !call_froms_stack in
begin try
InstrHashtbl.find table callsite
with Not_found ->
raise Call_did_not_take_place
end
end
in
let module Values_To_Use =
struct
let get_state k =
try InstrHashtbl.find instrstates k
with Not_found -> Relations_type.Model.bottom
let lval_to_loc_with_deps kinstr ~with_alarms:_ ~deps lv =
let state = get_state kinstr in
!Db.Value.lval_to_loc_with_deps_state state
~deps lv
let lval_to_loc_with_deps = ref lval_to_loc_with_deps
let expr_to_kernel_function kinstr ~with_alarms:_ ~deps exp =
let state = get_state kinstr in
!Db.Value.expr_to_kernel_function_state state ~deps exp
let expr_to_kernel_function = ref expr_to_kernel_function
let access_expr kinstr expr =
let state = get_state kinstr in
!Db.Value.eval_expr ~with_alarms:CilE.warn_none_mode state expr
let access_expr = ref access_expr
end
in
let module Recording_To_Do =
struct
let record_kf _kf _last_froms = ()
end
in
let module Callwise_Froms =
Make(Values_To_Use)(Froms_To_Use)(Recording_To_Do)
in
let current_function, call_site = List.hd call_stack in
let froms = Callwise_Froms.compute_and_return current_function in
record_callwise_dependencies_in_db call_site froms;
match !call_froms_stack with
(current_function2, _) :: (((_caller, table) :: _) as tail) ->
assert (
if current_function2 != current_function then begin
From_parameters.result "calldeps %a != %a@."
Kernel_function.pretty_name current_function
Kernel_function.pretty_name current_function2;
false
end else
true);
call_froms_stack := tail;
merge_call_froms table call_site froms
| _ ->
Callwise_Dependencies.mark_as_computed ()
end