Revision 58fd528a
Added by Pierre-Loïc Garoche almost 5 years ago
src/tools/tiny/tiny_verifier.ml | ||
---|---|---|
1 | 1 |
|
2 | 2 |
let active = ref false |
3 | 3 |
let tiny_debug = ref false |
4 |
let tiny_help = ref false |
|
5 |
let descending = ref 1 |
|
6 |
let unrolling = ref 0 |
|
4 | 7 |
|
5 |
|
|
8 |
|
|
9 |
|
|
10 |
let quiet () = Tiny.Report.verbosity := 0 |
|
11 |
|
|
12 |
let print_tiny_help () = |
|
13 |
let open Format in |
|
14 |
Format.eprintf "@[Tiny verifier plugin produces a simple imperative code \ |
|
15 |
output for the provided main node, inlining all calls. This \ |
|
16 |
code can then be analyzed using tiny analyzer options.@]"; |
|
17 |
Format.eprintf "@.@?"; |
|
18 |
flush stdout |
|
19 |
|
|
20 |
|
|
6 | 21 |
let tiny_run ~basename prog machines = |
22 |
if !tiny_help then ( |
|
23 |
let _ = print_tiny_help () in |
|
24 |
exit 0 |
|
25 |
); |
|
7 | 26 |
let node_name = |
8 | 27 |
match !Options.main_node with |
9 | 28 |
| "" -> ( |
... | ... | |
39 | 58 |
|
40 | 59 |
Format.printf "%a@." Tiny.Ast.fprint_stm ast; |
41 | 60 |
|
42 |
() |
|
61 |
let dom = |
|
62 |
let open Tiny.Load_domains in |
|
63 |
prepare_domains (List.map get_domain !domains) |
|
64 |
in |
|
65 |
let results = Tiny.Analyze.analyze dom !descending !unrolling env ast in |
|
66 |
let module Results = (val results: Tiny.Analyze.Results) in |
|
67 |
let module Dom = Results.Dom in |
|
68 |
let module PrintResults = Tiny.PrintResults.Make (Dom) in |
|
69 |
let m = Results.results in |
|
70 |
(* if !Tiny.Report.verbosity > 1 then *) |
|
71 |
PrintResults.print m ast None (* no !output_file *); |
|
72 |
(* else PrintResults.print_invariants m ast !output_file *) |
|
73 |
|
|
74 |
() |
|
43 | 75 |
|
44 | 76 |
|
45 | 77 |
module Verifier = |
... | ... | |
48 | 80 |
let name = "tiny" |
49 | 81 |
let options = |
50 | 82 |
[ |
51 |
"-debug", Arg.Set tiny_debug, "tiny debug" |
|
83 |
"-debug", Arg.Set tiny_debug, "tiny debug"; |
|
84 |
("-abstract-domain", Arg.String Tiny.Load_domains.decl_domain, |
|
85 |
"<domain> Use abstract domain <domain> " ^ Tiny.Domains.available_domains_str); |
|
86 |
(* ("-a", Arg.String Tiny.Load_domains.decl_domain, |
|
87 |
* "<domain> Use abstract domain <domain> " ^ Tiny.Domains.available_domains_str); *) |
|
88 |
("-param", Arg.String Tiny.Load_domains.set_param, |
|
89 |
"<p> Send <p> to the abstract domain, syntax <dom>:<p> can be used \ |
|
90 |
to target the (sub)domain <dom>"); |
|
91 |
(* ("-p", Arg.String Tiny.Load_domains.set_param, |
|
92 |
* "<p> Send <p> to the abstract domain, syntax <dom>:<p> can be used \ |
|
93 |
* to target the (sub)domain <dom>"); *) |
|
94 |
("-help-domain", Arg.String Tiny.Load_domains.help_domain, |
|
95 |
"<domain> Print params of <domain>"); |
|
96 |
(* ("-h", Arg.String Tiny.Load_domains.help_domain, "<domain> Print params of <domain>"); *) |
|
97 |
(* ("--compile", Arg.Set compile_mode, " Compilation mode: compile to C"); |
|
98 |
("-c", Arg.Set compile_mode, " Compilation mode: compile to C");*) |
|
99 |
|
|
100 |
("-quiet", Arg.Unit quiet, " Quiet mode"); |
|
101 |
(* ("-q", Arg.Unit quiet, " Quiet mode"); *) |
|
102 |
("-verbose", Arg.Set_int Tiny.Report.verbosity, |
|
103 |
"<n> Verbosity level (default is 1)"); |
|
104 |
(* ("-v", Arg.Set_int Tiny.Report.verbosity, "<n> Verbosity level (default is 1)"); *) |
|
105 |
(* ("--output", Arg.String set_output_file, |
|
106 |
"<filename> Output results to file <filename> (default is \ |
|
107 |
standard ouput)"); |
|
108 |
("-o", Arg.String set_output_file, |
|
109 |
"<filename> Output results to file <filename> (default is standard ouput)"); |
|
110 |
*) |
|
111 |
("-descending", Arg.Set_int descending, |
|
112 |
"<n> Perform <n> descending iterations after fixpoint of a loop \ |
|
113 |
is reached (default is 1)"); |
|
114 |
(* ("-d", Arg.Set_int descending, |
|
115 |
* "<n> Perform <n> descending iterations after fixpoint of a loop \ |
|
116 |
* is reached (default is 1)"); *) |
|
117 |
("-unrolling", Arg.Set_int unrolling, |
|
118 |
"<n> Unroll loops <n> times before computing fixpoint (default is 0)"); |
|
119 |
(* (\* ("-u", Arg.Set_int unrolling, |
|
120 |
* * "<n> Unroll loops <n> times before computing fixpoint (default is 0)"); *\) *) |
|
121 |
"-help", Arg.Set tiny_help, "tiny help and usage"; |
|
122 |
|
|
123 |
|
|
52 | 124 |
] |
53 | 125 |
|
54 | 126 |
let activate () = |
Also available in: Unified diff
Added some missing locations in tiny plugin