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
ad88a3e1
Commit
ad88a3e1
authored
5 years ago
by
David Bühler
Committed by
Andre Maroneze
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] New annotation eva_allocate to configure allocation builtins.
parent
bde8bd24
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/value/utils/eva_annotations.ml
+55
-0
55 additions, 0 deletions
src/plugins/value/utils/eva_annotations.ml
src/plugins/value/utils/eva_annotations.mli
+3
-0
3 additions, 0 deletions
src/plugins/value/utils/eva_annotations.mli
with
58 additions
and
0 deletions
src/plugins/value/utils/eva_annotations.ml
+
55
−
0
View file @
ad88a3e1
...
@@ -34,6 +34,7 @@ type flow_annotation =
...
@@ -34,6 +34,7 @@ type flow_annotation =
|
FlowSplit
of
term
|
FlowSplit
of
term
|
FlowMerge
of
term
|
FlowMerge
of
term
type
allocation_kind
=
By_stack
|
Fresh
|
Fresh_weak
|
Imprecise
(* We use two representations for annotations :
(* We use two representations for annotations :
- the high level representation (HL) which is exported from this module
- the high level representation (HL) which is exported from this module
...
@@ -248,3 +249,57 @@ module Subdivision = Register (struct
...
@@ -248,3 +249,57 @@ module Subdivision = Register (struct
let
get_subdivision_annot
=
Subdivision
.
get
let
get_subdivision_annot
=
Subdivision
.
get
let
add_subdivision_annot
=
Subdivision
.
add
let
add_subdivision_annot
=
Subdivision
.
add
module
Allocation
=
struct
let
of_string
=
function
|
"by_stack"
->
Some
By_stack
|
"fresh"
->
Some
Fresh
|
"fresh_weak"
->
Some
Fresh_weak
|
"imprecise"
->
Some
Imprecise
|
_
->
None
let
to_string
=
function
|
By_stack
->
"by_stack"
|
Fresh
->
"fresh"
|
Fresh_weak
->
"fresh_weak"
|
Imprecise
->
"imprecise"
include
Register
(
struct
type
t
=
allocation_kind
let
name
=
"eva_allocate"
let
is_loop_annot
=
false
let
parse
~
typing_context
:_
=
function
|
[{
lexpr_node
=
PLvar
s
}]
->
Extlib
.
the
~
exn
:
Parse_error
(
of_string
s
)
|
_
->
raise
Parse_error
let
export
alloc_kind
=
Ext_terms
[
Logic_const
.
tstring
(
to_string
alloc_kind
)]
let
import
=
function
|
Ext_terms
[{
term_node
}]
->
(* Be kind and return By_stack by default. Someone is bound to write a
visitor that will simplify our term into something unrecognizable. *)
begin
match
term_node
with
|
TConst
(
LStr
s
)
->
Extlib
.
opt_conv
By_stack
(
of_string
s
)
|
_
->
By_stack
end
|
_
->
assert
false
let
print
fmt
alloc_kind
=
Format
.
pp_print_string
fmt
(
to_string
alloc_kind
)
end
)
let
get
stmt
=
match
get
stmt
with
|
[]
->
Extlib
.
the
(
of_string
(
Value_parameters
.
AllocBuiltin
.
get
()
))
|
[
x
]
->
x
|
x
::
_
->
Value_parameters
.
warning
~
current
:
true
~
once
:
true
"Several eva_allocate annotations at the same statement; selecting %s\
and ignoring the others."
(
to_string
x
);
x
end
let
get_allocation
=
Allocation
.
get
This diff is collapsed.
Click to expand it.
src/plugins/value/utils/eva_annotations.mli
+
3
−
0
View file @
ad88a3e1
...
@@ -39,10 +39,13 @@ type flow_annotation =
...
@@ -39,10 +39,13 @@ type flow_annotation =
|
FlowSplit
of
Cil_types
.
term
|
FlowSplit
of
Cil_types
.
term
|
FlowMerge
of
Cil_types
.
term
|
FlowMerge
of
Cil_types
.
term
type
allocation_kind
=
By_stack
|
Fresh
|
Fresh_weak
|
Imprecise
val
get_slevel_annot
:
Cil_types
.
stmt
->
slevel_annotation
option
val
get_slevel_annot
:
Cil_types
.
stmt
->
slevel_annotation
option
val
get_unroll_annot
:
Cil_types
.
stmt
->
unroll_annotation
list
val
get_unroll_annot
:
Cil_types
.
stmt
->
unroll_annotation
list
val
get_flow_annot
:
Cil_types
.
stmt
->
flow_annotation
list
val
get_flow_annot
:
Cil_types
.
stmt
->
flow_annotation
list
val
get_subdivision_annot
:
Cil_types
.
stmt
->
int
list
val
get_subdivision_annot
:
Cil_types
.
stmt
->
int
list
val
get_allocation
:
Cil_types
.
stmt
->
allocation_kind
val
add_slevel_annot
:
emitter
:
Emitter
.
t
->
loc
:
Cil_types
.
location
->
val
add_slevel_annot
:
emitter
:
Emitter
.
t
->
loc
:
Cil_types
.
location
->
Cil_types
.
stmt
->
slevel_annotation
->
unit
Cil_types
.
stmt
->
slevel_annotation
->
unit
...
...
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