Skip to content
Snippets Groups Projects
Commit 7cd272b1 authored by David Bühler's avatar David Bühler Committed by Virgile Prevosto
Browse files

[kernel] Optimizes the [Substitute_const_globals] visitor.

Only visits function and variable definitions.
parent 32e51f13
No related branches found
No related tags found
No related merge requests found
...@@ -59,8 +59,8 @@ class constGlobSubstVisitorClass : cilVisitor = object ...@@ -59,8 +59,8 @@ class constGlobSubstVisitorClass : cilVisitor = object
if is_arithmetic_type typ && isConstType typ if is_arithmetic_type typ && isConstType typ
then ChangeDoChildrenPost ([g], List.map register) then ChangeDoChildrenPost ([g], List.map register)
else DoChildren else DoChildren
| _ -> | GFun _ -> DoChildren
DoChildren | _ -> SkipChildren
(* Visit expressions and replace lvals, with a registered varinfo in (* Visit expressions and replace lvals, with a registered varinfo in
[vi_to_init_opt], with respective initializing constant expressions. *) [vi_to_init_opt], with respective initializing constant expressions. *)
...@@ -104,6 +104,10 @@ class constGlobSubstVisitorClass : cilVisitor = object ...@@ -104,6 +104,10 @@ class constGlobSubstVisitorClass : cilVisitor = object
end end
| _ -> | _ ->
DoChildren DoChildren
method! vtype _ = SkipChildren
method! vspec _ = SkipChildren
method! vcode_annot _ = SkipChildren
end end
let constGlobSubstVisitor = new constGlobSubstVisitorClass let constGlobSubstVisitor = new constGlobSubstVisitorClass
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