Skip to content
Snippets Groups Projects
Commit bed9a667 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

Merge branch 'fix/andre/rmtmps-locals' into 'master'

[Kernel] cleanup unused code in Rmtmps

See merge request frama-c/frama-c!3529
parents 3873db16 c08c6e47
No related branches found
No related tags found
No related merge requests found
...@@ -790,8 +790,6 @@ let remove_unused_labels ?(is_removable=label_removable) func = ...@@ -790,8 +790,6 @@ let remove_unused_labels ?(is_removable=label_removable) func =
(visitCilBlock (new removeUnusedLabels is_removable usedLabels) func.sbody) (visitCilBlock (new removeUnusedLabels is_removable usedLabels) func.sbody)
let removeUnmarked isRoot ast reachable_tbl = let removeUnmarked isRoot ast reachable_tbl =
let removedLocals = ref [] in
let filterGlobal global = let filterGlobal global =
match global with match global with
(* unused global types, variables, and functions are simply removed *) (* unused global types, variables, and functions are simply removed *)
...@@ -823,11 +821,7 @@ let removeUnmarked isRoot ast reachable_tbl = ...@@ -823,11 +821,7 @@ let removeUnmarked isRoot ast reachable_tbl =
if (local.vtemp || local.vstorage = Static) && if (local.vtemp || local.vstorage = Static) &&
not (is_reachable reachable_tbl (Var local)) then not (is_reachable reachable_tbl (Var local)) then
begin begin
(* along the way, record the interesting locals that were removed *) Kernel.debug ~dkey "removing local: %s" local.vname;
let name = local.vname in
(Kernel.debug ~dkey "removing local: %s" name);
removedLocals :=
(func.svar.vname ^ "::" ^ name) :: !removedLocals;
false false
end else true end else true
in in
...@@ -873,8 +867,7 @@ let removeUnmarked isRoot ast reachable_tbl = ...@@ -873,8 +867,7 @@ let removeUnmarked isRoot ast reachable_tbl =
end; end;
Kernel.debug ~dkey "kept global %s (%a)" (global_type_and_name rg) Printer.pp_global rg Kernel.debug ~dkey "kept global %s (%a)" (global_type_and_name rg) Printer.pp_global rg
) keptGlobals; ) keptGlobals;
end; end
!removedLocals
(*********************************************************************** (***********************************************************************
...@@ -914,7 +907,7 @@ let removeUnused ?(isRoot=isExportedRoot) ast = ...@@ -914,7 +907,7 @@ let removeUnused ?(isRoot=isExportedRoot) ast =
markReferenced ast; markReferenced ast;
(* take out the trash *) (* take out the trash *)
ignore (removeUnmarked isRoot ast reachable_tbl) removeUnmarked isRoot ast reachable_tbl
end end
(* (*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment