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
bcf4c0dd
Commit
bcf4c0dd
authored
6 years ago
by
Julien Signoles
Browse files
Options
Downloads
Patches
Plain Diff
[translate] optimize logic function applications
parent
91e9333c
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/translate.ml
+15
-17
15 additions, 17 deletions
src/plugins/e-acsl/translate.ml
with
15 additions
and
17 deletions
src/plugins/e-acsl/translate.ml
+
15
−
17
View file @
bcf4c0dd
...
@@ -450,14 +450,14 @@ and context_insensitive_term_to_exp kf env t =
...
@@ -450,14 +450,14 @@ and context_insensitive_term_to_exp kf env t =
Cil
.
mkAddrOrStartOf
~
loc
lv
,
env
,
false
,
"startof"
Cil
.
mkAddrOrStartOf
~
loc
lv
,
env
,
false
,
"startof"
|
Tapp
(
li
,
[]
,
targs
)
->
|
Tapp
(
li
,
[]
,
targs
)
->
let
fname
=
li
.
l_var_info
.
lv_name
in
let
fname
=
li
.
l_var_info
.
lv_name
in
let
args
,
env
=
(* args computed in the reverse order *)
let
args
,
env
=
try
try
List
.
fold_
lef
t
List
.
fold_
righ
t
(
fun
(
l
,
env
)
a
->
(
fun
targ
(
l
,
env
)
->
let
e
,
env
=
term_to_exp
kf
env
a
in
let
e
,
env
=
term_to_exp
kf
env
targ
in
e
::
l
,
env
)
e
::
l
,
env
)
([]
,
env
)
targs
targs
([]
,
env
)
with
Invalid_argument
_
->
with
Invalid_argument
_
->
Options
.
fatal
"[Tapp] unexpected number of arguments when calling %s"
Options
.
fatal
"[Tapp] unexpected number of arguments when calling %s"
fname
fname
...
@@ -465,17 +465,15 @@ and context_insensitive_term_to_exp kf env t =
...
@@ -465,17 +465,15 @@ and context_insensitive_term_to_exp kf env t =
(* build the varinfo (as an expression) which stores the result of the
(* build the varinfo (as an expression) which stores the result of the
function call. *)
function call. *)
let
_
,
e
,
env
=
let
_
,
e
,
env
=
if
Builtins
.
mem
li
.
l_var_info
.
lv_name
then
begin
if
Builtins
.
mem
li
.
l_var_info
.
lv_name
then
(* E-ACSL built-in function call *)
(* E-ACSL built-in function call *)
Env
.
new_var
Env
.
new_var
~
loc
~
loc
~
name
:
(
fname
^
"_app"
)
~
name
:
(
fname
^
"_app"
)
env
env
(
Some
t
)
(
Some
t
)
(
Misc
.
cty
(
Extlib
.
the
li
.
l_type
))
(
Misc
.
cty
(
Extlib
.
the
li
.
l_type
))
(
fun
vi
_
->
(
fun
vi
_
->
[
Misc
.
mk_call
~
loc
~
result
:
(
Cil
.
var
vi
)
fname
args
])
[
Misc
.
mk_call
~
loc
~
result
:
(
Cil
.
var
vi
)
fname
(
List
.
rev
args
)
])
end
else
else
let
args_lty
=
let
args_lty
=
List
.
map
List
.
map
...
@@ -485,7 +483,7 @@ and context_insensitive_term_to_exp kf env t =
...
@@ -485,7 +483,7 @@ and context_insensitive_term_to_exp kf env t =
|
Typing
.
C_type
_
|
Typing
.
Other
->
Ctype
(
Typing
.
get_typ
targ
))
|
Typing
.
C_type
_
|
Typing
.
Other
->
Ctype
(
Typing
.
get_typ
targ
))
targs
targs
in
in
Logic_functions
.
generate
~
loc
env
t
li
(
List
.
rev
args
)
args_lty
Logic_functions
.
generate
~
loc
env
t
li
args
args_lty
in
in
e
,
env
,
false
,
"app"
e
,
env
,
false
,
"app"
|
Tapp
(
_
,
_
::
_
,
_
)
->
|
Tapp
(
_
,
_
::
_
,
_
)
->
...
...
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