let set annots wenv res e obj =
try let _ = HE.find res.tbl e in Wp_parameters.fatal "strange loop ?"
with Not_found ->
begin
let e_annot = annots.WpAnnot.get_annots e in
let h_prop = WpAnnot.get_hyp_only e_annot in
let g_prop = WpAnnot.get_goal_only e_annot in
let b_prop = WpAnnot.get_hyp_goal e_annot in
let h_assigns = WpAnnot.get_asgn_hyp e_annot in
let g_assigns = WpAnnot.get_asgn_goal e_annot in
let obj = collect_oblig wenv res e obj in
let obj =
if WpAnnot.new_loop_computation annots.WpAnnot.info then
begin match res.mode with
| Pass1 ->
let obj = List.fold_left (add_goal wenv) obj g_prop in
let obj = match g_assigns with None -> obj
| Some a -> add_assigns_goal wenv a obj
in
let obj = List.fold_left (add_hyp wenv) obj b_prop in
let obj = List.fold_left (add_goal wenv) obj b_prop in
let obj = List.fold_left (add_hyp wenv) obj h_prop in
let is_loop =
match Cil2cfg.node_type (Cil2cfg.edge_src e) with
| Cil2cfg.Vloop _ -> true
| _ -> false
in
let obj =
if is_loop then obj
else use_assigns wenv res e obj h_assigns
in obj
| Pass2 ->
let (hi, gi) = get_memo res e in
let obj = match gi with
| [] ->
let obj = List.fold_left (add_hyp wenv) obj b_prop in
let obj = List.fold_left (add_hyp wenv) obj h_prop in
obj
| _ ->
List.fold_left (add_inv_goal wenv) obj gi
in
assert (hi = []);
let obj = use_assigns wenv res e obj h_assigns in
obj
end
else
begin match res.mode with
| Pass1 ->
let i = WpAnnot.get_inv e_annot in
List.fold_left (add_goal wenv) obj i
| Pass2 ->
let (hi, gi) = get_memo res e in
let obj = List.fold_left (add_goal wenv) obj g_prop in
let obj = match g_assigns with None -> obj
| Some a -> add_assigns_goal wenv a obj
in
let obj =
List.fold_left (add_inv_goal wenv) obj gi in
let obj = List.fold_left (add_hyp wenv) obj b_prop in
let obj = List.fold_left (add_goal wenv) obj b_prop in
let obj =
List.fold_left (add_hyp wenv) obj h_prop in
let obj =
List.fold_left (add_inv_hyp wenv) obj hi in
let obj = use_assigns wenv res e obj h_assigns in
obj
end
in
let obj = do_labels wenv e obj in
Wp_parameters.debug ~level:3
"[set_wp_edge] %a@." Cil2cfg.pp_edge e;
Wp_parameters.debug ~level:3 " = @[<hov2> %a@]@." W.pretty obj;
Format.print_flush ();
HE.replace res.tbl e (Some obj);
find res e
end