Skip to content
Snippets Groups Projects
Commit fe127485 authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[Doc/Eva] update FAQ about loop unrolling

parent a68668e8
No related branches found
No related tags found
No related merge requests found
...@@ -5247,33 +5247,35 @@ return \lstinline|6| and \lstinline|36| respectively. ...@@ -5247,33 +5247,35 @@ return \lstinline|6| and \lstinline|36| respectively.
\newcommand{\question}[1]{\stepcounter{question}{\vspace{5mm}\noindent \bf {\large Q.\arabic{question}}~~~{#1}\medskip}} \newcommand{\question}[1]{\stepcounter{question}{\vspace{5mm}\noindent \bf {\large Q.\arabic{question}}~~~{#1}\medskip}}
\question{Which option should I use to improve the handling of loops \question{Which option should I use to improve the handling of loops
in my program, {\tt -ulevel} or {\tt -eva-slevel}?} in my program?}
The options \lstinline|-ulevel| and \lstinline|-eva-slevel| have different sets of The recommended way is to use \lstinline|loop unroll| annotations, which are
advantages and drawbacks. The main drawback of \lstinline|-ulevel| is that the most precise and stable mechanism currently in \Eva{}.
it performs a syntactic modification of the analyzed source code, Alternatively, using \lstinline|-eva-slevel| is the next best approach.
which may hamper its manipulation. On the other hand, syntactic
unrolling, by explicitly separating iteration steps, allows to use Both approaches do have a minor drawback, in that they do not allow to observe
the graphical user interface a specific iteration step of the loop.
\lstinline|frama-c-gui| to observe values or express properties for a In fact, they may even be a little
specific iteration step of the loop.
The \lstinline|-eva-slevel| option does not allow to observe a specific
iteration step of the loop. In fact, this option may even be a little
confusing for the user when the program contains loops for which the confusing for the user when the program contains loops for which the
analysis cannot decide easily the truth value of the condition, analysis cannot decide easily the truth value of the condition,
nested loops, or if-then-else nested loops, or if-then-else
statements\footnote{if-then-else statements are ``unrolled'' statements\footnote{if-then-else statements are ``unrolled''
in a manner similar to loops}. The main advantages of this option are in a manner similar to loops}. The main advantage of these options are
that it leaves the source code unchanged and that it works with that they leave the source code unchanged. Also, \lstinline|-eva-slevel| works
loops that are built using \lstinline|goto|s instead of \lstinline|for| or \lstinline|while|. with loops that are built using \lstinline|goto|s instead of \lstinline|for|
% The \lstinline|-eva-slevel| option requires less memory than or \lstinline|while|.
% \lstinline|-ulevel|, and as a consequence it can sometimes be faster. \lstinline|-eva-slevel| also improves precision when evaluating \lstinline|if|
It also improves precision when evaluating \lstinline|if| or or \lstinline|switch| conditionals (but it is consumed by them).
\lstinline|switch| conditionals.
A current drawback of semantic unrolling is that it can only be specified The Frama-C kernel has an option \lstinline|-ulevel|, which performs a
crudely at the function level, whereas syntactic unrolling can be syntactic modification of the analyzed source code. Its advantage is that,
specified loop by loop. by explicitly separating iteration steps, it allows to use
the graphical user interface to observe values or express properties for a
specific iteration step of the loop. However, the duplication of loop
statements and variables can lead to cluttered code. Also, the transformation
increases the size of the code in the Frama-C AST and, for large functions,
this has a significant impact in the analysis
time. For these reasons, \lstinline|-ulevel| is seldom used nowadays.
\question{Alarms that occur after a true alarm in the analyzed code \question{Alarms that occur after a true alarm in the analyzed code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment