adding optional postprocessing step to transfer functions

Reviewed By: jeremydubreil

Differential Revision: D3237864

fb-gh-sync-id: e6e5f92
fbshipit-source-id: e6e5f92
master
Sam Blackshear 9 years ago committed by Facebook Github Bot 7
parent 90a5a5912f
commit 49d32859cb

@ -53,7 +53,8 @@ module Make
if A.is_bottom astate_acc if A.is_bottom astate_acc
then astate_acc then astate_acc
else T.exec_instr astate_acc proc_data instr in else T.exec_instr astate_acc proc_data instr in
IList.fold_left exec_instrs astate_pre (C.instrs node) in let astate_post_instrs = IList.fold_left exec_instrs astate_pre (C.instrs node) in
T.postprocess astate_post_instrs node_id proc_data in
L.out "Post for node %a is %a@." Cfg.Node.pp_id node_id A.pp astate_post; L.out "Post for node %a is %a@." Cfg.Node.pp_id node_id A.pp astate_post;
let inv_map' = M.add node_id { pre=astate_pre; post=astate_post; visit_count; } inv_map in let inv_map' = M.add node_id { pre=astate_pre; post=astate_post; visit_count; } inv_map in
inv_map', S.schedule_succs work_queue node in inv_map', S.schedule_succs work_queue node in

@ -21,6 +21,8 @@ module TransferFunctions = struct
type astate = Domain.astate type astate = Domain.astate
type extras = ProcData.no_extras type extras = ProcData.no_extras
let postprocess = TransferFunctions.no_postprocessing
let rec add_address_taken_pvars exp astate = match exp with let rec add_address_taken_pvars exp astate = match exp with
| Sil.Lvar pvar -> | Sil.Lvar pvar ->
Domain.add pvar astate Domain.add pvar astate

@ -305,6 +305,8 @@ module TransferFunctions = struct
type astate = Domain.astate type astate = Domain.astate
type extras = ProcData.no_extras type extras = ProcData.no_extras
let postprocess = TransferFunctions.no_postprocessing
(* This is specific to the @NoAllocation and @PerformanceCritical checker (* This is specific to the @NoAllocation and @PerformanceCritical checker
and the "unlikely" method is used to guard branches that are expected to run sufficiently and the "unlikely" method is used to guard branches that are expected to run sufficiently
rarely to not affect the performances *) rarely to not affect the performances *)

@ -83,6 +83,8 @@ module TransferFunctions = struct
type astate = Domain.astate type astate = Domain.astate
type extras = ProcData.no_extras type extras = ProcData.no_extras
let postprocess = TransferFunctions.no_postprocessing
let exec_instr astate _ = function let exec_instr astate _ = function
| Sil.Letderef (lhs_id, Sil.Var rhs_id, _, _) -> | Sil.Letderef (lhs_id, Sil.Var rhs_id, _, _) ->
(* note: logical vars are SSA, don't need to worry about overwriting existing bindings *) (* note: logical vars are SSA, don't need to worry about overwriting existing bindings *)

@ -22,6 +22,8 @@ module TransferFunctions = struct
type astate = Domain.astate type astate = Domain.astate
type extras = ProcData.no_extras type extras = ProcData.no_extras
let postprocess = TransferFunctions.no_postprocessing
(* add all of the vars read in [exp] to the live set *) (* add all of the vars read in [exp] to the live set *)
let exp_add_live exp astate = let exp_add_live exp astate =
let (ids, pvars) = Sil.exp_get_vars exp in let (ids, pvars) = Sil.exp_get_vars exp in

@ -9,11 +9,16 @@
open! Utils open! Utils
module type S = sig module type S = sig
type astate (* abstract state to propagate *) type astate (* abstract state to propagate *)
type extras (* read-only extra state (results of previous analyses, globals, etc.) *) type extras (* read-only extra state (results of previous analyses, globals, etc.) *)
(* {A} instr {A'}. [caller_pdesc] is the procdesc of the current procedure *) (* {A} instr {A'}. [caller_pdesc] is the procdesc of the current procedure *)
val exec_instr : astate -> extras ProcData.t -> Sil.instr -> astate val exec_instr : astate -> extras ProcData.t -> Sil.instr -> astate
(* optional postprocessing step to be performed after executing node [id]. *)
val postprocess : astate -> Cfg.Node.id -> extras ProcData.t -> astate
end end
(* default postprocessing: do nothing *)
let no_postprocessing astate _ _ = astate

@ -52,6 +52,8 @@ module PathCountTransferFunctions = struct
type astate = PathCountDomain.astate type astate = PathCountDomain.astate
type extras = ProcData.no_extras type extras = ProcData.no_extras
let postprocess = TransferFunctions.no_postprocessing
(* just propagate the current path count *) (* just propagate the current path count *)
let exec_instr astate _ _ = astate let exec_instr astate _ _ = astate
end end

Loading…
Cancel
Save