-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsimulation_invariant.ml
55 lines (48 loc) · 2.2 KB
/
simulation_invariant.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
(**************************************************************************)
(* This file is part of Conc2Seq plug-in of Frama-C. *)
(* *)
(* Copyright (C) 2016-2017 *)
(* CEA (Commissariat a l'energie atomique et aux energies *)
(* alternatives) *)
(* *)
(* you can redistribute it and/or modify it under the terms of the GNU *)
(* Lesser General Public License as published by the Free Software *)
(* Foundation, version 3. *)
(* *)
(* It is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Lesser General Public License for more details. *)
(* *)
(* See the GNU Lesser General Public License version 3 *)
(* for more details (enclosed in the file LICENCE). *)
(* *)
(**************************************************************************)
open Cil_types
let invariant = ref None
let build () =
match !invariant with
| None ->
let i = { (Cil_const.make_logic_info "simulation")
with l_labels = [FormalLabel("L")] }
in
Logic_utils.add_logic_function i ;
invariant := Some i ;
i
| Some i -> i
let gannot = ref None
let get loc =
match !gannot with
| None ->
let li = build () in
let g = Dfun_or_pred(li, loc) in
Annotations.add_global Options.emitter g ;
gannot := Some g ;
g
| Some g -> g
let app loc lbl =
let li = build () in
Logic_const.papp ~loc (li, [lbl], [])
let reads l =
let li = build () in
li.l_body <- LBreads (List.map Logic_const.new_identified_term l)