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
4af8386d
Commit
4af8386d
authored
5 years ago
by
Patrick Baudin
Browse files
Options
Downloads
Patches
Plain Diff
[WP] minor
parent
102fe48e
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/wp/Cint.ml
+19
-10
19 additions, 10 deletions
src/plugins/wp/Cint.ml
src/plugins/wp/Cint.mli
+1
-2
1 addition, 2 deletions
src/plugins/wp/Cint.mli
with
20 additions
and
12 deletions
src/plugins/wp/Cint.ml
+
19
−
10
View file @
4af8386d
...
@@ -97,12 +97,15 @@ let f_lsr = Lang.extern_f ~library ~result "lsr"
...
@@ -97,12 +97,15 @@ let f_lsr = Lang.extern_f ~library ~result "lsr"
let
f_bitwised
=
[
f_lnot
;
f_lor
;
f_land
;
f_lxor
;
f_lsl
;
f_lsr
]
let
f_bitwised
=
[
f_lnot
;
f_lor
;
f_land
;
f_lxor
;
f_lsl
;
f_lsr
]
let
f_bit_stdlib
=
Lang
.
extern_p
~
library
~
bool
:
"bit_testb"
~
prop
:
"bit_test"
()
(* [f_bit_stdlib] is related to the function [bit_test] of Frama-C StdLib *)
let
f_bit
=
Lang
.
extern_p
~
library
~
bool
:
"bit_testb"
~
prop
:
"bit_test"
()
let
f_bit_stdlib
=
Lang
.
extern_p
~
library
~
bool
:
"bit_testb"
~
prop
:
"bit_test"
()
let
f_bit_export
=
Lang
.
extern_p
~
library
~
bool
:
"bit_testb"
~
prop
:
"bit_test"
()
(* [f_bit_positive] is actually exported in forgoting the fact the position is positive *)
let
f_bit_positive
=
Lang
.
extern_p
~
library
~
bool
:
"bit_testb"
~
prop
:
"bit_test"
()
(* At export, some constructs such as [e & (1 << k)] are written into [f_bit_export] construct *)
let
f_bit_export
=
Lang
.
extern_p
~
library
~
bool
:
"bit_testb"
~
prop
:
"bit_test"
()
let
()
=
let
open
LogicBuiltins
in
add_builtin
"
\\
bit_test_stdlib"
[
Z
;
Z
]
f_bit_stdlib
let
()
=
let
open
LogicBuiltins
in
add_builtin
"
\\
bit_test_stdlib"
[
Z
;
Z
]
f_bit_stdlib
let
()
=
let
open
LogicBuiltins
in
add_builtin
"
\\
bit_test"
[
Z
;
Z
]
f_bit
let
()
=
let
open
LogicBuiltins
in
add_builtin
"
\\
bit_test"
[
Z
;
Z
]
f_bit
_positive
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
(* --- Matching utilities for simplifications --- *)
(* --- Matching utilities for simplifications --- *)
...
@@ -475,10 +478,14 @@ let smp2 f zf = (* f(c1,c2) ~> zf(c1,c2), f(c1,c2,...) ~> f(zf(c1,c2),...) *)
...
@@ -475,10 +478,14 @@ let smp2 f zf = (* f(c1,c2) ~> zf(c1,c2), f(c1,c2,...) ~> f(zf(c1,c2),...) *)
end
end
|
_
->
raise
Not_found
|
_
->
raise
Not_found
let
bitk_positive
k
e
=
F
.
e_fun
f_bit
[
e
;
k
]
let
bitk_positive
k
e
=
F
.
e_fun
f_bit_positive
[
e
;
k
]
let
smp_intro_bitk_positive
=
function
let
smp_mk_bit_stdlib
=
function
|
[
a
;
k
]
when
is_positive_or_null
k
->
bitk_positive
k
a
|
[
a
;
k
]
when
is_positive_or_null
k
->
|
[
a
;
k
]
->
(* TODO: expand the current logic definition of the ACSL stdlib symbol *)
(* No need to expand the logic definition of the ACSL stdlib symbol when
[k] is positive (the definition must comply with that simplification). *)
bitk_positive
k
a
|
[
a
;
k
]
->
(* TODO: expand the current logic definition of the ACSL stdlib symbol *)
F
.
e_neq
F
.
e_zero
(
F
.
e_fun
f_land
[
a
;
(
F
.
e_fun
f_lsl
[
F
.
e_one
;
k
])])
F
.
e_neq
F
.
e_zero
(
F
.
e_fun
f_land
[
a
;
(
F
.
e_fun
f_lsl
[
F
.
e_one
;
k
])])
|
_
->
raise
Not_found
|
_
->
raise
Not_found
...
@@ -778,8 +785,10 @@ let () =
...
@@ -778,8 +785,10 @@ let () =
begin
begin
let
mk_builtin
n
f
?
eq
?
leq
smp
=
n
,
{
f
;
eq
;
leq
;
smp
}
in
let
mk_builtin
n
f
?
eq
?
leq
smp
=
n
,
{
f
;
eq
;
leq
;
smp
}
in
let
bi_lbit_stdlib
=
mk_builtin
"f_bit_stdlib"
f_bit_stdlib
smp_intro_bitk_positive
in
(* From [smp_mk_bit_stdlib], the built-in [f_bit_stdlib] is such that there is
let
bi_lbit
=
mk_builtin
"f_bit"
f_bit
smp_bitk_positive
in
no creation of [e_fun f_bit_stdlib args] *)
let
bi_lbit_stdlib
=
mk_builtin
"f_bit_stdlib"
f_bit_stdlib
smp_mk_bit_stdlib
in
let
bi_lbit
=
mk_builtin
"f_bit"
f_bit_positive
smp_bitk_positive
in
let
bi_lnot
=
mk_builtin
"f_lnot"
f_lnot
~
eq
:
smp_eq_with_lnot
let
bi_lnot
=
mk_builtin
"f_lnot"
f_lnot
~
eq
:
smp_eq_with_lnot
(
smp1
Integer
.
lognot
)
in
(
smp1
Integer
.
lognot
)
in
let
bi_lxor
=
mk_builtin
"f_lxor"
f_lxor
~
eq
:
smp_eq_with_lxor
let
bi_lxor
=
mk_builtin
"f_lxor"
f_lxor
~
eq
:
smp_eq_with_lxor
...
...
This diff is collapsed.
Click to expand it.
src/plugins/wp/Cint.mli
+
1
−
2
View file @
4af8386d
...
@@ -71,9 +71,8 @@ val f_lxor : lfun
...
@@ -71,9 +71,8 @@ val f_lxor : lfun
val
f_lor
:
lfun
val
f_lor
:
lfun
val
f_lsl
:
lfun
val
f_lsl
:
lfun
val
f_lsr
:
lfun
val
f_lsr
:
lfun
val
f_bit
:
lfun
val
f_bitwised
:
lfun
list
(** All except f_bit *)
val
f_bitwised
:
lfun
list
(** All except f_bit
_positive
*)
(** Simplifiers *)
(** Simplifiers *)
...
...
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