-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME
180 lines (138 loc) · 6.14 KB
/
README
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
* INSTALLATION:
PAGAI needs:
- GMP and MPFR. On Debian systems, install packages:
libmpfr-dev libgmp3-dev
- CMake, for the compilation. On Debian systems, install packages:
cmake
(you may want to install cmake-gui too for a graphical configuration
tool)
- Yices, Z3, CUDD, LLVM, Apron and the PPL (can be automatically
installed for you). See the top of external/Makefile for required
versions of these tools. In particular, Pagai won't work if you
don't have the exact version of LLVM.
- curl or wget, if you want automatic dependencies installation.
The simplest way to compile PAGAI is to run:
./autoinstall.sh
from the toplevel. This will download and compile most dependencies
for you (it takes time, and ~550Mb of disk space).
PARALLEL_MAKE_OPTS=-j4 ./autoinstall.sh will compile dependencies
trying to use 4 cores (adjust as needed).
If you don't want the dependencies to be installed for you, run:
cmake .
make
from the toplevel.
Alternatively, one can use an out-of-tree build with:
mkdir build
../autoinstall-out-of-tree.sh
or, without the external dependency installation:
mkdir build
cd build
cmake ..
make
Variables (path to libraries, build options, ...) can be set for each
build with e.g.
cmake -DSTATIC_LINK=ON .
cmake -i .
cmake-gui .
For running Pagai, you should make sure your PATH variable contains the
directory of the SMT solver you want to use (e.g. Z3, CVC4, etc.)
On MacOS, please compile with clang and not g++: there are strange
template instantiations errors with g++, leading to duplicate symbols
when linking.
* Optional APRON extensions
PAGAI can use APRON linked with
- the Parma Polyhedra Library http://bugseng.com/products/ppl/ (-DENABLE_PPL)
- OptOptagons, from ETHZ https://github.com/eth-srl/OptOctagon (-DENABLE_OPT_OCT)
* USAGE:
- With a C input
If you want to use Pagai with a C input, you first need to setup a pagai.conf file in the same directory as the Pagai executable. This conf file contains only one variable so far, named ResourceDir. This variable should be set to the path of your LLVM/Clang installation. In particular, make sure you set ResourceDir so that the path $(ResourceDir)/lib/clang/3.4/include/ exists and contains e.g. float.h.
The pagai.conf file should have the form:
"ResourceDir <dir>"
example:
--> cat pagai.conf
ResourceDir /Users/julien/work/pagai/external/llvm
- With a LLVM .bc input
The pagai.conf file is only used for compiling C/C++ code into LLVM bitcode. If you directly give to Pagai a bitcode file, it will process it. Note that you will need to compile into bitcode with clang and the -g and -emit-llvm arguments.
pagai -h should give you the list of arguments:
Options:
-i [ --input ] arg input
-h [ --help ] Print help messages
-I [ --include-path ] arg include path (same as -I for clang)
-s [ --solver ] arg (=z3_api) * z3
* z3_qfnra
* mathsat
* smtinterpol
* cvc3
* cvc4
* z3_api
-d [ --domain ] arg (=pk) abstract domain
* box (Apron boxes)
* oct (Octagons)
* pk (NewPolka strict polyhedra)
* pkeq (NewPolka linear equalities)
-t [ --technique ] arg (=lw+pf) technique
* lw (Lookahead Widening, SAS'06)
* g (Guided Static Analysis, SAS'07)
* pf (Path Focusing, SAS'11)
* lw+pf (SAS'12)
* s (simple abstract interpretation)
* dis (lw+pf, using disjunctive invariants)
* pf_incr
* incr
--new-narrowing When the decreasing sequence fails (SAS12)
--main arg label name of the entry point
--no-undefined-check no undefined check
--pointers pointers
--optimize optimize
--instcombining instcombining
--loop-unroll unroll loops
--skipnonlinear ignore non linear arithmetic
--noinline do not inline functions
-o [ --output ] arg C output
--output-bc arg LLVM IR output
--output-bc-v2 arg LLVM IR output (v2)
--svcomp SV-Comp mode
--wcet wcet mode
--debug debug
-c [ --compare ] arg compare list of techniques
--comparedomains compare abstract domains
--printformula print SMT formula
--printall print all
--quiet quiet mode
--dump-ll dump analyzed ll file
--force-old-output use old output
--timeout arg timeout
--log-smt write all the SMT requests into a log file
--annotated arg name of the annotated C file
--domain2 arg not for use
--new-narrowing2 not for use
* EXAMPLE
--> ./pagai ../ex/wcet_bicycle2.c
// ResourceDir is /Users/julien/work/pagai/external/llvm/lib/clang/3.4
// analysis: AIopt
/* processing Function bicycle */
#include "../pagai_assert.h"
void bicycle() {
int /* reachable */
count=0, phase=0;
for(int i=0; i<10000; // safe
i++) {
/* invariant:
-2*count+phase+3*i = 0
14998-count+phase >= 0
1-phase >= 0
phase >= 0
count-2*phase >= 0
*/
if (phase == 0) {
// safe
count += 2; phase = 1;
} else if (phase == 1) {
// safe
count += 1; phase = 0;
}
}
/* assert OK */
assert(count <= 15000);
/* reachable */
}