Skip to content

Commit 9aa70a7

Browse files
Add doc README.md files to each directory
1 parent 1b7f57d commit 9aa70a7

File tree

32 files changed

+598
-164
lines changed

32 files changed

+598
-164
lines changed

src/analyses/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
\ingroup module_hidden
2+
\defgroup analyses analyses
3+
4+
# Folder analyses
5+
6+
This contains the abstract interpretation framework `ai.h` and several
7+
static analyses that instantiate it.
8+
9+
FIXME: put here a good introduction describing what is contained
10+
in this folder.

src/ansi-c/README

-22
This file was deleted.

src/ansi-c/module.md renamed to src/ansi-c/README.md

+46-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1+
\ingroup module_hidden
12
\defgroup ansi-c ansi-c
23
# Folder ansi-c
34

4-
\author Kareem Khazem
5+
\author Kareem Khazem, Martin Brain
6+
7+
\section overview Overview
8+
9+
Contains the front-end for ANSI C, plus a variety of common extensions.
10+
This parses the file, performs some basic sanity checks (this is one
11+
area in which the UI could be improved; patches most welcome) and then
12+
produces a goto-program (see below). The parser is a traditional Flex /
13+
Bison system.
14+
15+
`internal_addition.c` contains the implementation of various ‘magic’
16+
functions that are that allow control of the analysis from the source
17+
code level. These include assertions, assumptions, atomic blocks, memory
18+
fences and rounding modes.
19+
20+
The `library/` subdirectory contains versions of some of the C standard
21+
header files that make use of the CPROVER built-in functions. This
22+
allows CPROVER programs to be ‘aware’ of the functionality and model it
23+
correctly. Examples include `stdio.c`, `string.c`, `setjmp.c` and
24+
various threading interfaces.
525

626
\section preprocessing Preprocessing & Parsing
727

@@ -24,8 +44,6 @@ digraph G {
2444
\enddot
2545

2646

27-
28-
---
2947
\section type-checking Type-checking
3048

3149
In the \ref ansi-c and \ref java_bytecode directories.
@@ -112,3 +130,28 @@ called symbols. Thus, for example:
112130
parameter and return types of the function. The value of the symbol is
113131
the function's body (a \ref codet), and the symbol is stored in the
114132
symbol table with `foo` as the key.
133+
134+
135+
\section performance Parsing performance considerations
136+
137+
* Measured on trunk/regression/ansi-c/windows_h_VS_2012/main.i
138+
139+
* 13%: Copying into i_preprocessed
140+
141+
* 5%: ansi_c_parser.read()
142+
143+
* 53%: yyansi_clex()
144+
145+
* 29%: parser (without typechecking)
146+
147+
\section references Compiler References
148+
149+
CodeWarrior C Compilers Reference 3.2:
150+
151+
http://cache.freescale.com/files/soft_dev_tools/doc/ref_manual/CCOMPILERRM.pdf
152+
153+
http://cache.freescale.com/files/soft_dev_tools/doc/ref_manual/ASMX86RM.pdf
154+
155+
ARM 4.1 Compiler Reference:
156+
157+
http://infocenter.arm.com/help/topic/com.arm.doc.dui0491c/DUI0491C_arm_compiler_reference.pdf

src/assembler/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
\ingroup module_hidden
2+
\defgroup assembler assembler
3+
4+
# Folder assembler
5+
6+
`assembler/`provides front-end processing for assembler.

src/big-int/README

-1
This file was deleted.

src/big-int/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
\ingroup module_hidden
2+
\defgroup big-int big-int
3+
4+
# Folder big-int
5+
6+
\author Martin Brain
7+
8+
CPROVER is distributed with its own multi-precision arithmetic library;
9+
mainly for historical and portability reasons. The library is externally
10+
developed and thus `big-int` contains the source as it is distributed:
11+
[http://www.dirk-zoller.de/](http://www.dirk-zoller.de/).
12+
13+
This should not be used directly, see `util/mp_arith.h` for the CPROVER
14+
interface.

src/cbmc/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
\ingroup module_hidden
2+
\defgroup cbmc cbmc
3+
4+
# Folder CBMC
5+
6+
\author Martin Brain
7+
8+
This contains the first full application. CBMC is a bounded model
9+
checker that uses the front ends (`ansi-c`, `cpp`, goto-program or
10+
others) to create a goto-program, `goto-symex` to unwind the loops the
11+
given number of times and to produce and equation system and finally
12+
`solvers` to find a counter-example (technically, `goto-symex` is then
13+
used to construct the counter-example trace).

src/cbmc/module.md

-47
This file was deleted.

src/clobber/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
\ingroup module_hidden
2+
\defgroup clobber clobber
3+
4+
# Folder clobber
5+
6+
`clobber\` is a module that is a tool.

src/cpp/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
\ingroup module_hidden
2+
\defgroup cpp cpp
3+
4+
# Folder cpp
5+
6+
\author Martin Brain
7+
8+
This directory contains the C++ front-end. It supports the subset of C++
9+
commonly found in embedded and system applications. Consequentially it
10+
doesn’t have full support for templates and many of the more advanced
11+
and obscure C++ features. The subset of the language that can be handled
12+
is being extended over time so bug reports of programs that cannot be
13+
parsed are useful.
14+
15+
The functionality is very similar to the ANSI C front end; parsing the
16+
code and converting to goto-programs. It makes use of code from
17+
`langapi` and `ansi-c`.

src/goto-analyzer/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
\ingroup module_hidden
2+
\defgroup goto-analyzer goto-analyzer
3+
4+
# Folder goto-analyzer
5+
6+
`goto-analyzer/` is a tool performing static analyses on goto
7+
programs. It provides the front end for many of the static analyses
8+
in the \ref analyses directory.

src/goto-cc/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
\ingroup module_hidden
2+
\defgroup goto-cc goto-cc
3+
4+
# Folder goto-cc
5+
6+
\author Martin Brain
7+
8+
`goto-cc` is a compiler replacement that just performs the first step of
9+
the process; converting C or C++ programs to goto-binaries. It is
10+
intended to be dropped in to an existing build procedure in place of the
11+
compiler, thus it emulates flags that would affect the semantics of the
12+
code produced. Which set of flags are emulated depends on the naming of
13+
the `goto-cc/` binary. If it is called `goto-cc` then it emulates GCC
14+
flags, `goto-armcc` emulates the ARM compiler, `goto-cl` emulates VCC
15+
and `goto-cw` emulates the Code Warrior compiler. The output of this
16+
tool can then be used with `cbmc` or `goto-instrument`.

src/goto-diff/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
\ingroup module_hidden
2+
\defgroup goto-diff goto-diff
3+
4+
# Folder goto-diff
5+
6+
`goto-diff/` is a tool that offers functionality similar to the `diff`
7+
tool, but for GOTO programs.

src/goto-instrument/README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
\ingroup module_hidden
2+
\defgroup goto-instrument goto-instrument
3+
4+
# Folder goto-instrument
5+
6+
\author Martin Brain
7+
8+
The `goto-instrument/` directory contains a number of tools, one per
9+
file, that are built into the `goto-instrument` program. All of them
10+
take in a goto-program (produced by `goto-cc`) and either modify it or
11+
perform some analysis. Examples include `nondet_static.cpp` which
12+
initialises static variables to a non-deterministic value,
13+
`nondet_volatile.cpp` which assigns a non-deterministic value to any
14+
volatile variable before it is read and `weak_memory.h` which performs
15+
the necessary transformations to reason about weak memory models. The
16+
exception to the “one file for each piece of functionality” rule are the
17+
program instrumentation options (mostly those given as “Safety checks”
18+
in the `goto-instrument` help text) which are included in the
19+
`goto-program/` directory. An example of this is
20+
`goto-program/stack_depth.h` and the general rule seems to be that
21+
transformations and instrumentation that `cbmc` uses should be in
22+
`goto-program/`, others should be in `goto-instrument`.
23+
24+
`goto-instrument` is a very good template for new analysis tools. New
25+
developers are advised to copy the directory, remove all files apart
26+
from `main.*`, `parseoptions.*` and the `Makefile` and use these as the
27+
skeleton of their application. The `doit()` method in `parseoptions.cpp`
28+
is the preferred location for the top level control for the program.

0 commit comments

Comments
 (0)