Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
E-language compiler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Sellami Youssef
E-language compiler
Commits
d685e24d
Commit
d685e24d
authored
1 month ago
by
Sellami Youssef
Browse files
Options
Downloads
Patches
Plain Diff
nop elimination
parent
230a40cd
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cfg_nop_elim.ml
+10
-4
10 additions, 4 deletions
src/cfg_nop_elim.ml
with
10 additions
and
4 deletions
src/cfg_nop_elim.ml
+
10
−
4
View file @
d685e24d
...
...
@@ -66,6 +66,7 @@ let replace_succs nop_succs (n: cfg_node) =
|
Cassign
(
s
,
e
,
i
)
->
Cassign
(
s
,
e
,
replace_succ
nop_succs
i
)
|
Cprint
(
e
,
i
)
->
Cprint
(
e
,
replace_succ
nop_succs
i
)
|
Ccmp
(
e
,
i1
,
i2
)
->
Ccmp
(
e
,
replace_succ
nop_succs
i1
,
replace_succ
nop_succs
i2
)
|
Cnop
i
->
Cnop
(
replace_succ
nop_succs
i
)
|
_
->
n
(* [nop_elim_fun f] applique la fonction [replace_succs] à chaque nœud du CFG. *)
...
...
@@ -79,13 +80,18 @@ let nop_elim_fun ({ cfgfunargs; cfgfunbody; cfgentry } as f: cfg_fun) =
(inaccessibles), et appliquer la fonction [replace_succs] aux nœuds qui
resteront.
*)
let
cfgfunbody
=
Hashtbl
.
filter_map
(
fun
n
node
->
(* TODO *)
if
Set
.
is_empty
(
preds
cfgfunbody
n
)
&&
n
!=
cfgentry
then
None
else
Some
(
replace_succs
nop_transf
node
)
)
cfgfunbody
in
let
cfgfunbody_corr_links
=
Hashtbl
.
map
(
fun
n
node
->
replace_succs
nop_transf
node
)
cfgfunbody
in
let
cfgfunbody_wout_inacc
=
Hashtbl
.
filter_map
(
fun
n
node
->
match
node
with
|
Cnop
i
->
None
|
_
->
if
Set
.
is_empty
(
preds
cfgfunbody_corr_links
n
)
&&
n
!=
cfgentry
then
None
else
Some
node
)
cfgfunbody_corr_links
in
(* La fonction renvoyée est composée du nouveau [cfgfunbody] que l'on vient de
calculer, et le point d'entrée est transformé en conséquence. *)
{
f
with
cfgfunbody
;
cfgentry
=
replace_succ
nop_transf
cfgentry
}
{
f
with
cfgfunbody
=
cfgfunbody_wout_inacc
;
cfgentry
=
replace_succ
nop_transf
cfgentry
}
let
nop_elim_gdef
gd
=
match
gd
with
...
...
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