From 1dfd6df8760f0aa5b2e7d1b50fee540af11e3e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr> Date: Thu, 20 Jan 2022 17:50:57 +0100 Subject: [PATCH] [kernel] Cil: optimizes the constant folding visitor. Only visits functions and variables definitions. --- src/kernel_services/ast_queries/cil.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/kernel_services/ast_queries/cil.ml b/src/kernel_services/ast_queries/cil.ml index db32e083853..3533691b55f 100644 --- a/src/kernel_services/ast_queries/cil.ml +++ b/src/kernel_services/ast_queries/cil.ml @@ -5263,6 +5263,14 @@ class constFoldVisitorClass (machdep: bool) : cilVisitor = object (* Do it bottom up *) ChangeDoChildrenPost (e, constFold machdep) + (* Optimization: only visits function and variable definitions. *) + method! vglob = function + | GFun _ | GVar _ -> DoChildren + | _ -> SkipChildren + + method! vtype _ = SkipChildren + method! vspec _ = SkipChildren + method! vcode_annot _ = SkipChildren end let constFoldVisitor (machdep: bool) = new constFoldVisitorClass machdep -- GitLab