Skip to content
Snippets Groups Projects
Commit d405e0dd authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[wp] Use KFmap in cfgGenerator to minimize diffs

parent 3e671795
No related branches found
No related tags found
No related merge requests found
...@@ -27,15 +27,17 @@ open Wp_parameters ...@@ -27,15 +27,17 @@ open Wp_parameters
(* --- Task Manager --- *) (* --- Task Manager --- *)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
module KFmap = Kernel_function.Map
type task = { type task = {
mutable lemmas: LogicUsage.logic_lemma list ; mutable lemmas: LogicUsage.logic_lemma list ;
mutable modes: CfgCalculus.mode list ; mutable modes: CfgCalculus.mode KFmap.t ;
mutable props: CfgCalculus.props ; mutable props: CfgCalculus.props ;
} }
let empty () = { let empty () = {
lemmas = []; lemmas = [];
modes = []; modes = KFmap.empty;
props = `All ; props = `All ;
} }
...@@ -80,7 +82,7 @@ let apply task ~kf ?bhvs ?prop () = ...@@ -80,7 +82,7 @@ let apply task ~kf ?bhvs ?prop () =
| [] -> [empty_default_behavior] | [] -> [empty_default_behavior]
| bhvs -> bhvs in | bhvs -> bhvs in
List.iter (fun bhv -> List.iter (fun bhv ->
task.modes <- { kf ; bhv } :: task.modes task.modes <- KFmap.add kf { CfgCalculus.kf ; bhv } task.modes
) bhvs ; ) bhvs ;
Option.iter (fun ip -> task.props <- `PropId ip) prop ; Option.iter (fun ip -> task.props <- `PropId ip) prop ;
end end
...@@ -178,10 +180,10 @@ struct ...@@ -178,10 +180,10 @@ struct
if l.LogicUsage.lem_kind <> `Axiom then if l.LogicUsage.lem_kind <> `Axiom then
let wpo = VCG.compile_lemma l in let wpo = VCG.compile_lemma l in
collection := Bag.add wpo !collection collection := Bag.add wpo !collection
) (List.rev task.lemmas) ; ) task.lemmas ;
end () ; end () ;
List.iter KFmap.iter
(fun (mode : CfgCalculus.mode) -> (fun _ (mode : CfgCalculus.mode) ->
WpContext.on_context (model,WpContext.Kf mode.kf) WpContext.on_context (model,WpContext.Kf mode.kf)
begin fun () -> begin fun () ->
LogicUsage.iter_lemmas VCG.register_lemma ; LogicUsage.iter_lemmas VCG.register_lemma ;
...@@ -243,8 +245,8 @@ let generator setup driver = ...@@ -243,8 +245,8 @@ let generator setup driver =
let dump task = let dump task =
let module WP = CfgCalculus.Make(CfgDump) in let module WP = CfgCalculus.Make(CfgDump) in
let props = task.props in let props = task.props in
List.iter KFmap.iter
(fun (mode : CfgCalculus.mode) -> (fun _ (mode : CfgCalculus.mode) ->
let bhv = let bhv =
if Cil.is_default_behavior mode.bhv if Cil.is_default_behavior mode.bhv
then None else Some mode.bhv.b_name in then None else Some mode.bhv.b_name in
......
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