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
b1355b8b
Commit
b1355b8b
authored
5 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[wp] support for float builtins
parent
95e3102b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/Cfloat.ml
+28
-14
28 additions, 14 deletions
src/plugins/wp/Cfloat.ml
with
28 additions
and
14 deletions
src/plugins/wp/Cfloat.ml
+
28
−
14
View file @
b1355b8b
...
...
@@ -360,31 +360,45 @@ let flt_div ft = Compute.get (Context.get model, ft, DIV) |> fst
let
flt_of_real
ft
=
Compute
.
get
(
Context
.
get
model
,
ft
,
ROUND
)
|>
fst
let
real_of_flt
ft
=
Compute
.
get
(
Context
.
get
model
,
ft
,
REAL
)
|>
fst
(* -------------------------------------------------------------------------- *)
(* --- Builtins --- *)
(* -------------------------------------------------------------------------- *)
let
make_hack
?
(
converse
=
false
)
ft
op
xs
=
let
builtin
kind
ft
op
xs
=
let
phi
,
impl
=
Compute
.
get
((
Context
.
get
model
)
,
ft
,
op
)
in
let
xs
=
(
if
converse
then
List
.
rev
xs
else
xs
)
in
try
impl
xs
with
Not_found
->
F
.
e_fun
~
result
:
Logic
.
Bool
phi
xs
let
register_builtin
ft
=
let
xs
=
(
if
kind
=
`ReV
then
List
.
rev
xs
else
xs
)
in
try
impl
xs
with
Not_found
->
let
result
=
match
kind
with
|
`Binop
|
`Unop
->
ftau
ft
|
`Rel
|
`ReV
->
Logic
.
Bool
in
F
.
e_fun
~
result
phi
xs
let
register_builtins
ft
=
begin
let
suffix
=
float_name
ft
in
LogicBuiltins
.
hack
(
"
\\
eq_"
^
suffix
)
(
make_hack
ft
EQ
)
;
LogicBuiltins
.
hack
(
"
\\
ne_"
^
suffix
)
(
make_hack
ft
NE
)
;
LogicBuiltins
.
hack
(
"
\\
lt_"
^
suffix
)
(
make_hack
~
converse
:
false
ft
LT
)
;
LogicBuiltins
.
hack
(
"
\\
gt_"
^
suffix
)
(
make_hack
~
converse
:
true
ft
LT
)
;
LogicBuiltins
.
hack
(
"
\\
le_"
^
suffix
)
(
make_hack
~
converse
:
false
ft
LE
)
;
LogicBuiltins
.
hack
(
"
\\
ge_"
^
suffix
)
(
make_hack
~
converse
:
true
ft
LE
)
let
register
(
prefix
,
kind
,
op
)
=
LogicBuiltins
.
hack
(
Printf
.
sprintf
"
\\
%s_%s"
prefix
suffix
)
(
builtin
kind
ft
op
)
in
List
.
iter
register
[
"eq"
,
`Rel
,
EQ
;
"ne"
,
`Rel
,
NE
;
"lt"
,
`Rel
,
LT
;
"gt"
,
`ReV
,
LT
;
"le"
,
`Rel
,
LE
;
"ge"
,
`ReV
,
LE
;
"neg"
,
`Unop
,
NEG
;
"add"
,
`Binop
,
ADD
;
"sub"
,
`Binop
,
SUB
;
"mul"
,
`Binop
,
MUL
;
"div"
,
`Binop
,
DIV
;
]
;
end
let
()
=
Context
.
register
begin
fun
()
->
register_builtin
Float32
;
register_builtin
Float64
;
register_builtin
s
Float32
;
register_builtin
s
Float64
;
end
(* -------------------------------------------------------------------------- *)
...
...
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