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
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
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
Charles Southerland
frama-c
Commits
bd647334
Commit
bd647334
authored
4 years ago
by
Basile Desloges
Browse files
Options
Downloads
Patches
Plain Diff
[eacsl:codegen] Add support for bitwise AND, OR and XOR when using GMP parameters
parent
4afbcfd4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/e-acsl/src/code_generator/translate.ml
+14
-3
14 additions, 3 deletions
src/plugins/e-acsl/src/code_generator/translate.ml
with
14 additions
and
3 deletions
src/plugins/e-acsl/src/code_generator/translate.ml
+
14
−
3
View file @
bd647334
...
@@ -57,8 +57,11 @@ let name_of_mpz_arith_bop = function
...
@@ -57,8 +57,11 @@ let name_of_mpz_arith_bop = function
|
Mult
->
"__gmpz_mul"
|
Mult
->
"__gmpz_mul"
|
Div
->
"__gmpz_tdiv_q"
|
Div
->
"__gmpz_tdiv_q"
|
Mod
->
"__gmpz_tdiv_r"
|
Mod
->
"__gmpz_tdiv_r"
|
Lt
|
Gt
|
Le
|
Ge
|
Eq
|
Ne
|
BAnd
|
BXor
|
BOr
|
LAnd
|
LOr
|
BAnd
->
"__gmpz_and"
|
Shiftlt
|
Shiftrt
|
PlusPI
|
IndexPI
|
MinusPI
|
MinusPP
->
assert
false
|
BOr
->
"__gmpz_ior"
|
BXor
->
"__gmpz_xor"
|
Lt
|
Gt
|
Le
|
Ge
|
Eq
|
Ne
|
LAnd
|
LOr
|
Shiftlt
|
Shiftrt
|
PlusPI
|
IndexPI
|
MinusPI
|
MinusPP
->
assert
false
(* Type of a string that represents a number.
(* Type of a string that represents a number.
Used when a string is required to encode a constant number because it is not
Used when a string is required to encode a constant number because it is not
...
@@ -426,7 +429,15 @@ and context_insensitive_term_to_exp kf env t =
...
@@ -426,7 +429,15 @@ and context_insensitive_term_to_exp kf env t =
let
e1
,
env
=
term_to_exp
kf
env
t1
in
let
e1
,
env
=
term_to_exp
kf
env
t1
in
let
e2
,
env
=
term_to_exp
kf
env
t2
in
let
e2
,
env
=
term_to_exp
kf
env
t2
in
if
Gmp_types
.
Z
.
is_t
ty
then
if
Gmp_types
.
Z
.
is_t
ty
then
not_yet
env
"bitwise operator on arbitrary precision"
let
mk_stmts
_v
e
=
let
name
=
name_of_mpz_arith_bop
bop
in
let
instr
=
Constructor
.
mk_lib_call
~
loc
name
[
e
;
e1
;
e2
]
in
[
instr
]
in
let
name
=
Misc
.
name_of_binop
bop
in
let
t
=
Some
t
in
let
_
,
e
,
env
=
Env
.
new_var_and_mpz_init
~
loc
~
name
env
kf
t
mk_stmts
in
e
,
env
,
C_number
,
""
else
begin
else
begin
assert
(
Logic_typing
.
is_integral_type
t
.
term_type
);
assert
(
Logic_typing
.
is_integral_type
t
.
term_type
);
Cil
.
new_exp
~
loc
(
BinOp
(
bop
,
e1
,
e2
,
ty
))
,
env
,
C_number
,
""
Cil
.
new_exp
~
loc
(
BinOp
(
bop
,
e1
,
e2
,
ty
))
,
env
,
C_number
,
""
...
...
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