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
aae0b835
Commit
aae0b835
authored
4 years ago
by
Basile Desloges
Browse files
Options
Downloads
Patches
Plain Diff
[eacsl] Update loop environment with variant information
parent
42a86155
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
src/plugins/e-acsl/src/code_generator/env.ml
+37
-8
37 additions, 8 deletions
src/plugins/e-acsl/src/code_generator/env.ml
src/plugins/e-acsl/src/code_generator/env.mli
+5
-2
5 additions, 2 deletions
src/plugins/e-acsl/src/code_generator/env.mli
with
42 additions
and
10 deletions
src/plugins/e-acsl/src/code_generator/env.ml
+
37
−
8
View file @
aae0b835
...
@@ -54,6 +54,11 @@ type local_env = {
...
@@ -54,6 +54,11 @@ type local_env = {
rte
:
bool
rte
:
bool
}
}
type
loop_env
=
{
variant
:
(
term
*
logic_info
option
)
option
;
invariants
:
toplevel_predicate
list
;
}
type
t
=
{
type
t
=
{
lscope
:
Lscope
.
t
;
lscope
:
Lscope
.
t
;
lscope_reset
:
bool
;
lscope_reset
:
bool
;
...
@@ -67,8 +72,8 @@ type t = {
...
@@ -67,8 +72,8 @@ type t = {
(* Stack of contracts for active functions and statements *)
(* Stack of contracts for active functions and statements *)
var_mapping
:
Varinfo
.
t
Stack
.
t
Logic_var
.
Map
.
t
;
var_mapping
:
Varinfo
.
t
Stack
.
t
Logic_var
.
Map
.
t
;
(* records of C bindings for logic vars *)
(* records of C bindings for logic vars *)
loop_
i
nv
ariants
:
toplevel_predicate
list
list
;
loop_
e
nv
s
:
loop_env
list
;
(* list of loop
i
nv
aria
nt
s
for each currently visited loops *)
(* list of loop
e
nv
ironme
nt for each currently visited loops *)
cpt
:
int
;
cpt
:
int
;
(* counter used when generating variables *)
(* counter used when generating variables *)
}
}
...
@@ -88,6 +93,9 @@ let empty_local_env =
...
@@ -88,6 +93,9 @@ let empty_local_env =
mp_tbl
=
empty_mp_tbl
;
mp_tbl
=
empty_mp_tbl
;
rte
=
true
}
rte
=
true
}
let
empty_loop_env
=
{
variant
=
None
;
invariants
=
[]
}
let
empty
=
let
empty
=
{
lscope
=
Lscope
.
empty
;
{
lscope
=
Lscope
.
empty
;
lscope_reset
=
true
;
lscope_reset
=
true
;
...
@@ -97,7 +105,7 @@ let empty =
...
@@ -97,7 +105,7 @@ let empty =
env_stack
=
[]
;
env_stack
=
[]
;
contract_stack
=
[]
;
contract_stack
=
[]
;
var_mapping
=
Logic_var
.
Map
.
empty
;
var_mapping
=
Logic_var
.
Map
.
empty
;
loop_
i
nv
ariant
s
=
[]
;
loop_
e
nvs
=
[]
;
cpt
=
0
}
cpt
=
0
}
let
top
env
=
match
env
.
env_stack
with
let
top
env
=
match
env
.
env_stack
with
...
@@ -113,15 +121,36 @@ let has_no_new_stmt env =
...
@@ -113,15 +121,36 @@ let has_no_new_stmt env =
(* ************************************************************************** *)
(* ************************************************************************** *)
let
push_loop
env
=
let
push_loop
env
=
{
env
with
loop_
i
nv
ariants
=
[]
::
env
.
loop_
i
nv
ariant
s
}
{
env
with
loop_
e
nv
s
=
empty_loop_env
::
env
.
loop_
e
nvs
}
let
add_loop_invariant
env
inv
=
match
env
.
loop_invariants
with
let
top_loop_env
env
=
match
env
.
loop_envs
with
|
[]
->
assert
false
|
[]
->
assert
false
|
invs
::
tl
->
{
env
with
loop_invariants
=
(
inv
::
invs
)
::
tl
}
|
loop_env
::
tl
->
loop_env
,
tl
let
set_loop_variant
?
measure
env
t
=
let
loop_env
,
tl
=
top_loop_env
env
in
let
loop_env
=
{
loop_env
with
variant
=
Some
(
t
,
measure
)
}
in
{
env
with
loop_envs
=
loop_env
::
tl
}
let
pop_loop
env
=
match
env
.
loop_invariants
with
let
add_loop_invariant
env
inv
=
match
env
.
loop_envs
with
|
[]
->
assert
false
|
[]
->
assert
false
|
invs
::
tl
->
invs
,
{
env
with
loop_invariants
=
tl
}
|
loop_env
::
tl
->
let
loop_env
=
{
loop_env
with
invariants
=
inv
::
loop_env
.
invariants
}
in
{
env
with
loop_envs
=
loop_env
::
tl
}
let
top_loop_variant
env
=
let
loop_env
,
_
=
top_loop_env
env
in
loop_env
.
variant
let
top_loop_invariants
env
=
let
loop_env
,
_
=
top_loop_env
env
in
loop_env
.
invariants
let
pop_loop
env
=
let
_
,
tl
=
top_loop_env
env
in
{
env
with
loop_envs
=
tl
}
(* ************************************************************************** *)
(* ************************************************************************** *)
(** {2 RTEs} *)
(** {2 RTEs} *)
...
...
This diff is collapsed.
Click to expand it.
src/plugins/e-acsl/src/code_generator/env.mli
+
5
−
2
View file @
aae0b835
...
@@ -153,12 +153,15 @@ val annotation_kind: t -> Smart_stmt.annotation_kind
...
@@ -153,12 +153,15 @@ val annotation_kind: t -> Smart_stmt.annotation_kind
val
set_annotation_kind
:
t
->
Smart_stmt
.
annotation_kind
->
t
val
set_annotation_kind
:
t
->
Smart_stmt
.
annotation_kind
->
t
(* ************************************************************************** *)
(* ************************************************************************** *)
(** {2 Loop
invariant
s} *)
(** {2 Loop
annotation
s} *)
(* ************************************************************************** *)
(* ************************************************************************** *)
val
push_loop
:
t
->
t
val
push_loop
:
t
->
t
val
set_loop_variant
:
?
measure
:
logic_info
->
t
->
term
->
t
val
add_loop_invariant
:
t
->
toplevel_predicate
->
t
val
add_loop_invariant
:
t
->
toplevel_predicate
->
t
val
pop_loop
:
t
->
toplevel_predicate
list
*
t
val
top_loop_variant
:
t
->
(
term
*
logic_info
option
)
option
val
top_loop_invariants
:
t
->
toplevel_predicate
list
val
pop_loop
:
t
->
t
(* ************************************************************************** *)
(* ************************************************************************** *)
(** {2 RTEs} *)
(** {2 RTEs} *)
...
...
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