Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
d2663a1f
Commit
d2663a1f
authored
5 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] Relaxed heuristic for automatic loop unroll.
parent
d5a31905
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
headers/header_spec.txt
+2
-0
2 additions, 0 deletions
headers/header_spec.txt
src/plugins/value/partitioning/auto_loop_unroll.ml
+12
-8
12 additions, 8 deletions
src/plugins/value/partitioning/auto_loop_unroll.ml
with
14 additions
and
8 deletions
headers/header_spec.txt
+
2
−
0
View file @
d2663a1f
...
@@ -1259,6 +1259,8 @@ src/plugins/value/legacy/function_args.ml: CEA_LGPL_OR_PROPRIETARY
...
@@ -1259,6 +1259,8 @@ src/plugins/value/legacy/function_args.ml: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/legacy/function_args.mli: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/legacy/function_args.mli: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/register.ml: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/register.ml: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/register.mli: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/register.mli: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/partitioning/auto_loop_unroll.ml: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/partitioning/auto_loop_unroll.mli: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/partitioning/partitioning_parameters.ml: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/partitioning/partitioning_parameters.ml: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/partitioning/partitioning_parameters.mli: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/partitioning/partitioning_parameters.mli: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/partitioning/per_stmt_slevel.ml: CEA_LGPL_OR_PROPRIETARY
src/plugins/value/partitioning/per_stmt_slevel.ml: CEA_LGPL_OR_PROPRIETARY
...
...
This diff is collapsed.
Click to expand it.
src/plugins/value/partitioning/auto_loop_unroll.ml
+
12
−
8
View file @
d2663a1f
...
@@ -38,10 +38,10 @@
...
@@ -38,10 +38,10 @@
The heuristic is syntactic and limited to the current function: it does not
The heuristic is syntactic and limited to the current function: it does not
handle assignment through pointers or function calls.
handle assignment through pointers or function calls.
Thus, the condition [cond]
must
only contains direct accesses to variables
Thus, the condition [cond]
should
only contains direct accesses to variables
whose address is never taken (they cannot be modified through pointers). If
whose address is never taken (they cannot be modified through pointers). If
the loop contains a function call, the condition [cond]
must
not contain
any
the loop contains a function call, the condition [cond]
should
not contain
global variable (as they may be modified in the function called).
global variable
s
(as they may be modified in the function called).
A first analyze of the loop gathers all such variables modified within the
A first analyze of the loop gathers all such variables modified within the
loop; all others are constant, and can be evaluated in the loop entry state.
loop; all others are constant, and can be evaluated in the loop entry state.
...
@@ -113,7 +113,7 @@ end
...
@@ -113,7 +113,7 @@ end
(* The status of a lvalue for the automatic loop unroll heuristic. *)
(* The status of a lvalue for the automatic loop unroll heuristic. *)
type
var_status
=
type
var_status
=
|
Constant
(* The lvalue is constant within the loop. *)
|
Constant
(* The lvalue is
probably
constant within the loop. *)
|
Candidate
(* The lvalue is a good candidate for the heuristic:
|
Candidate
(* The lvalue is a good candidate for the heuristic:
integer type, access to a varinfo whose address is not taken,
integer type, access to a varinfo whose address is not taken,
modified within the loop but not in another function called
modified within the loop but not in another function called
...
@@ -134,13 +134,17 @@ let classify loop_effect lval =
...
@@ -134,13 +134,17 @@ let classify loop_effect lval =
|
AlignOf
_
|
AlignOfE
_
|
AddrOf
_
|
StartOf
_
->
true
|
AlignOf
_
|
AlignOfE
_
|
AddrOf
_
|
StartOf
_
->
true
and
classify_lval
=
function
and
classify_lval
=
function
|
Var
varinfo
,
offset
->
|
Var
varinfo
,
offset
->
if
varinfo
.
vaddrof
if
(
varinfo
.
vglob
&&
loop_effect
.
call
)
||
(
varinfo
.
vglob
&&
loop_effect
.
call
)
||
not
(
is_const_offset
offset
)
||
not
(
is_const_offset
offset
)
then
Unsuitable
then
Unsuitable
else
if
Cil_datatype
.
Varinfo
.
Set
.
mem
varinfo
loop_effect
.
written_vars
else
if
Cil_datatype
.
Varinfo
.
Set
.
mem
varinfo
loop_effect
.
written_vars
then
if
is_integer
lval
then
Candidate
else
Unsuitable
then
else
Constant
if
is_integer
lval
&&
not
varinfo
.
vaddrof
then
Candidate
else
Unsuitable
else
(* If the address of the variable is taken, it could be modified within
the loop. We suppose here that this is not the case, but this could
lead to some loop unrolling. *)
Constant
|
Mem
_
,
_
->
Unsuitable
(* Pointers are not supported by the heuristic. *)
|
Mem
_
,
_
->
Unsuitable
(* Pointers are not supported by the heuristic. *)
and
is_const_offset
=
function
and
is_const_offset
=
function
|
NoOffset
->
true
|
NoOffset
->
true
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment