Commit f3ca3696 authored by Julien Signoles's avatar Julien Signoles
Browse files

optimize Gmp.init_t a bit

parent facfd007
...@@ -77,19 +77,30 @@ module Q = Make(struct end) ...@@ -77,19 +77,30 @@ module Q = Make(struct end)
let init_t () = let init_t () =
Options.feedback ~level:2 "initializing GMP types."; Options.feedback ~level:2 "initializing GMP types.";
let set_mp_t = object let set_mp_t = object (self)
inherit Cil.nopCilVisitor inherit Cil.nopCilVisitor
(* exit after having initialized both Z.t and Q.t *)
val mutable visited = false
method private set f info =
f info;
if visited then
raise Exit
else begin
visited <- true;
Cil.SkipChildren
end
method !vglob = function method !vglob = function
| GType({ torig_name = s } as info, _) when s = "__e_acsl_mpz_t" -> | GType({ torig_name = s } as info, _) when s = "__e_acsl_mpz_t" ->
Z.set_t info; self#set Z.set_t info
Cil.SkipChildren
| GType({ torig_name = s } as info, _) when s = "__e_acsl_mpq_t" -> | GType({ torig_name = s } as info, _) when s = "__e_acsl_mpq_t" ->
Q.set_t info; self#set Q.set_t info
Cil.SkipChildren
| _ -> | _ ->
Cil.SkipChildren Cil.SkipChildren
end in end in
Cil.visitCilFileSameGlobals set_mp_t (Ast.get ()) try Cil.visitCilFileSameGlobals set_mp_t (Ast.get ()) with Exit -> ()
(**************************************************************************) (**************************************************************************)
(************************* Calls to builtins ******************************) (************************* Calls to builtins ******************************)
......
...@@ -309,7 +309,7 @@ let rec mk_nested_loops ~loc mk_innermost_block kf env lscope_vars = ...@@ -309,7 +309,7 @@ let rec mk_nested_loops ~loc mk_innermost_block kf env lscope_vars =
let stmts, env = let stmts, env =
mk_nested_loops ~loc mk_innermost_block kf env lscope_vars' mk_nested_loops ~loc mk_innermost_block kf env lscope_vars'
in in
(* remove logic binding now that the block is constructed *) (* remove the logic binding now that the block is constructed *)
Env.Logic_binding.remove env lv; Env.Logic_binding.remove env lv;
(* return *) (* return *)
let_stmt :: stmts, env let_stmt :: stmts, env
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment