Commit 8197fa33 authored by Julien Signoles's avatar Julien Signoles
Browse files

Merge branch 'feature/basile/constructor-breakup' into 'master'

[eacsl] Breakup `Constructor` into smaller files

See merge request frama-c/frama-c!2799
parents 362083a7 79b2f0b8
......@@ -344,10 +344,3 @@ ML_LINT_KO+=src/plugins/variadic/standard.ml
ML_LINT_KO+=src/plugins/variadic/translate.ml
ML_LINT_KO+=src/plugins/variadic/va_build.ml
ML_LINT_KO+=src/plugins/variadic/va_types.mli
ML_LINT_KO+=src/plugins/e-acsl/src/analyses/mmodel_analysis.ml
ML_LINT_KO+=src/plugins/e-acsl/src/analyses/rte.ml
ML_LINT_KO+=src/plugins/e-acsl/src/code_generator/at_with_lscope.ml
ML_LINT_KO+=src/plugins/e-acsl/src/code_generator/at_with_lscope.mli
ML_LINT_KO+=src/plugins/e-acsl/src/code_generator/temporal.ml
ML_LINT_KO+=src/plugins/e-acsl/src/code_generator/temporal.mli
......@@ -64,7 +64,8 @@ SRC_ANALYSES:=$(addprefix src/analyses/, $(SRC_ANALYSES))
# code generator
SRC_CODE_GENERATOR:= \
constructor \
smart_exp \
smart_stmt \
gmp \
label \
env \
......
......@@ -26,8 +26,8 @@ Plugin E-ACSL <next-release>
############################
-* E-ACSL [2020-08-28] Fix crash that may occur when translating
properties that have been proved valid by another plug-in
(frama-c/e-acsl#106).
properties that have been proved valid by another plug-in
(frama-c/e-acsl#106).
-! E-ACSL [2020-08-28] Remove option -e-acsl-prepare-ast.
-! E-ACSL [2020-08-28] Remove option -e-acsl-check.
- E-ACSL [2020-08-07] Add support for logical array comparison
......
......@@ -52,8 +52,6 @@ src/analyses/typing.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/analyses/typing.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/at_with_lscope.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/at_with_lscope.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/constructor.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/constructor.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/env.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/env.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/global_observer.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
......@@ -80,6 +78,10 @@ src/code_generator/quantif.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/quantif.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/rational.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/rational.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/smart_exp.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/smart_exp.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/smart_stmt.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/smart_stmt.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/temporal.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/temporal.mli: CEA_LGPL_OR_PROPRIETARY.E_ACSL
src/code_generator/translate.ml: CEA_LGPL_OR_PROPRIETARY.E_ACSL
......
......@@ -27,7 +27,7 @@
let warn_rte warn exn =
if warn then
Options.warning "@[@[cannot run RTE:@ %s.@]@ \
Ignoring potential runtime errors in annotations."
Ignoring potential runtime errors in annotations."
(Printexc.to_string exn)
(* ************************************************************************** *)
......@@ -45,8 +45,8 @@ let stmt ?(warn=true) =
(let module L = Datatype.List(Code_annotation) in L.ty))
with Failure _ | Dynamic.Unbound_value _ | Dynamic.Incompatible_type _ as exn
->
warn_rte warn exn;
fun _ _ -> []
warn_rte warn exn;
fun _ _ -> []
let exp ?(warn=true) =
try
......@@ -57,8 +57,8 @@ let exp ?(warn=true) =
(let module L = Datatype.List(Code_annotation) in L.ty))
with Failure _ | Dynamic.Unbound_value _ | Dynamic.Incompatible_type _ as exn
->
warn_rte warn exn;
fun _ _ _ -> []
warn_rte warn exn;
fun _ _ _ -> []
(*
Local Variables:
......
......@@ -39,8 +39,8 @@ let term_to_exp_ref
(*****************************************************************************)
(* Remove all the bindings for [kf]. [Cil_datatype.Kf.Hashtbl] does not
provide the [remove_all] function. Thus we need to keep calling [remove]
until all entries are removed. *)
provide the [remove_all] function. Thus we need to keep calling [remove]
until all entries are removed. *)
let rec remove_all tbl kf =
if Cil_datatype.Kf.Hashtbl.mem tbl kf then begin
Cil_datatype.Kf.Hashtbl.remove tbl kf;
......@@ -66,10 +66,10 @@ end
(**************************************************************************)
(* Builds the terms [t_size] and [t_shifted] from each
[Lvs_quantif(tmin, lv, tmax)] from [lscope]
where [t_size = tmax - tmin + (-1|0|1)] depending on whether the
[Lvs_quantif(tmin, lv, tmax)] from [lscope]
where [t_size = tmax - tmin + (-1|0|1)] depending on whether the
inequalities are strict or large
and [t_shifted = lv - tmin + (-1|0)] (so that we start indexing at 0) *)
and [t_shifted = lv - tmin + (-1|0)] (so that we start indexing at 0) *)
let rec sizes_and_shifts_from_quantifs ~loc kf lscope sizes_and_shifts =
match lscope with
| [] ->
......@@ -97,29 +97,29 @@ let rec sizes_and_shifts_from_quantifs ~loc kf lscope sizes_and_shifts =
in
let iv = Interval.(extract_ival (infer t_size)) in
(* The EXACT amount of memory that is needed can be known at runtime. This
is because the tightest bounds for the variables can be known at runtime.
Example: In the following predicate
is because the tightest bounds for the variables can be known at runtime.
Example: In the following predicate
[\exists integer u; 9 <= u <= 13 &&
\forall integer v; -5 < v <= (u <= 11 ? u + 6 : u - 9) ==>
\at(u + v > 0, K)]
the upper bound [M] for [v] depends on [u].
In chronological order, [M] equals to 15, 16, 17, 3 and 4.
Thus the tightest upper bound for [v] is [max(M)=17].
HOWEVER, computing that exact information requires extra nested loops,
prior to the [malloc] stmts, that will try all the possible values of the
variables involved in the bounds.
Instead of sacrificing time over memory (by performing these extra
computations), we consider that sacrificing memory over time is more
beneficial. In particular, though we may allocate more memory than
needed, the number of reads/writes into it is the same in both cases.
Conclusion: over-approximate [t_size] *)
HOWEVER, computing that exact information requires extra nested loops,
prior to the [malloc] stmts, that will try all the possible values of the
variables involved in the bounds.
Instead of sacrificing time over memory (by performing these extra
computations), we consider that sacrificing memory over time is more
beneficial. In particular, though we may allocate more memory than
needed, the number of reads/writes into it is the same in both cases.
Conclusion: over-approximate [t_size] *)
let t_size = match Ival.min_and_max iv with
| _, Some max ->
Logic_const.tint ~loc max
| _, None ->
Error.not_yet
"\\at on purely logic variables and with quantifier that uses \
too complex bound (E-ACSL cannot infer a finite upper bound to it)"
too complex bound (E-ACSL cannot infer a finite upper bound to it)"
in
(* Index *)
let t_lv = Logic_const.tvar ~loc lv in
......@@ -148,13 +148,13 @@ let rec sizes_and_shifts_from_quantifs ~loc kf lscope sizes_and_shifts =
let size_from_sizes_and_shifts ~loc = function
| [] ->
(* No quantified variable. But still need to allocate [1*sizeof(_)] amount
of memory to store purely logic variables that are NOT quantified
(example: from \let). *)
of memory to store purely logic variables that are NOT quantified
(example: from \let). *)
Cil.lone ~loc ()
| (size, _) :: sizes_and_shifts ->
List.fold_left
(fun t_size (t_s, _) ->
Logic_const.term ~loc (TBinOp(Mult, t_size, t_s)) Linteger)
Logic_const.term ~loc (TBinOp(Mult, t_size, t_s)) Linteger)
size
sizes_and_shifts
......@@ -171,35 +171,35 @@ let lval_at_index ~loc kf env (e_at, vi_at, t_index) =
lval_at_index, env
(* Associate to each possible tuple of quantifiers
a unique index from the set {n | 0 <= n < n_max}.
That index will serve to identify the memory location where the evaluation
of the term/predicate is stored for the given tuple of quantifier.
The following gives the smallest set of such indexes (hence we use the
smallest amount of memory in some respect):
To (t_shifted_n, t_shifted_n-1, ..., t_shifted_1)
where 0 <= t_shifted_i < beta_i
corresponds: \sum_{i=1}^n( t_shifted_i * \pi_{j=1}^{i-1}(beta_j) ) *)
a unique index from the set {n | 0 <= n < n_max}.
That index will serve to identify the memory location where the evaluation
of the term/predicate is stored for the given tuple of quantifier.
The following gives the smallest set of such indexes (hence we use the
smallest amount of memory in some respect):
To (t_shifted_n, t_shifted_n-1, ..., t_shifted_1)
where 0 <= t_shifted_i < beta_i
corresponds: \sum_{i=1}^n( t_shifted_i * \pi_{j=1}^{i-1}(beta_j) ) *)
let index_from_sizes_and_shifts ~loc sizes_and_shifts =
let product terms = List.fold_left
(fun product t ->
Logic_const.term ~loc (TBinOp(Mult, product, t)) Linteger)
(Cil.lone ~loc ())
terms
(fun product t ->
Logic_const.term ~loc (TBinOp(Mult, product, t)) Linteger)
(Cil.lone ~loc ())
terms
in
let sum, _ = List.fold_left
(fun (index, sizes) (t_size, t_shifted) ->
let pi_beta_j = product sizes in
let bi_mult_pi_beta_j =
Logic_const.term ~loc (TBinOp(Mult, t_shifted, pi_beta_j)) Linteger
in
let sum = Logic_const.term
~loc
(TBinOp(PlusA, bi_mult_pi_beta_j, index))
Linteger
in
sum, t_size :: sizes)
(Cil.lzero ~loc (), [])
sizes_and_shifts
(fun (index, sizes) (t_size, t_shifted) ->
let pi_beta_j = product sizes in
let bi_mult_pi_beta_j =
Logic_const.term ~loc (TBinOp(Mult, t_shifted, pi_beta_j)) Linteger
in
let sum = Logic_const.term
~loc
(TBinOp(PlusA, bi_mult_pi_beta_j, index))
Linteger
in
sum, t_size :: sizes)
(Cil.lzero ~loc (), [])
sizes_and_shifts
in
sum
......@@ -225,62 +225,63 @@ let to_exp ~loc kf env pot label =
in
(* Creating the pointer *)
let ty = match pot with
| Lscope.PoT_pred _ ->
Cil.intType
| Lscope.PoT_term t ->
begin match Typing.get_number_ty t with
| Typing.(C_integer _ | C_float _ | Nan) ->
Typing.get_typ t
| Typing.(Rational | Real) ->
Error.not_yet "\\at on purely logic variables and over real type"
| Typing.Gmpz ->
Error.not_yet "\\at on purely logic variables and over gmp type"
end
| Lscope.PoT_pred _ ->
Cil.intType
| Lscope.PoT_term t ->
begin match Typing.get_number_ty t with
| Typing.(C_integer _ | C_float _ | Nan) ->
Typing.get_typ t
| Typing.(Rational | Real) ->
Error.not_yet "\\at on purely logic variables and over real type"
| Typing.Gmpz ->
Error.not_yet "\\at on purely logic variables and over gmp type"
end
in
let ty_ptr = TPtr(ty, []) in
let vi_at, e_at, env = Env.new_var
~loc
~name:"at"
~scope:Varname.Function
env
kf
None
ty_ptr
(fun vi e ->
(* Handle [malloc] and [free] stmts *)
let lty_sizeof = Ctype Cil.(theMachine.typeOfSizeOf) in
let t_sizeof = Logic_const.term ~loc (TSizeOf ty) lty_sizeof in
let t_size = size_from_sizes_and_shifts ~loc sizes_and_shifts in
let t_size =
Logic_const.term ~loc (TBinOp(Mult, t_sizeof, t_size)) lty_sizeof
in
Typing.type_term ~use_gmp_opt:false t_size;
let malloc_stmt = match Typing.get_number_ty t_size with
| Typing.C_integer IInt ->
let e_size, _ = term_to_exp kf env t_size in
let e_size = Cil.constFold false e_size in
let malloc_stmt =
Constructor.mk_lib_call ~loc
~result:(Cil.var vi)
"malloc"
[ e_size ]
in
malloc_stmt
| Typing.(C_integer _ | C_float _ | Gmpz) ->
Error.not_yet
"\\at on purely logic variables that needs to allocate \
too much memory (bigger than int_max bytes)"
| Typing.(Rational | Real | Nan) ->
Error.not_yet "quantification over non-integer type"
in
let free_stmt = Constructor.mk_lib_call ~loc "free" [e] in
(* The list of stmts returned by the current closure are inserted
LOCALLY to the block where the new var is FIRST used, whatever scope
is indicated to [Env.new_var].
Thus we need to add [malloc] and [free] through dedicated functions. *)
Malloc.add kf malloc_stmt;
Free.add kf free_stmt;
[])
~loc
~name:"at"
~scope:Varname.Function
env
kf
None
ty_ptr
(fun vi e ->
(* Handle [malloc] and [free] stmts *)
let lty_sizeof = Ctype Cil.(theMachine.typeOfSizeOf) in
let t_sizeof = Logic_const.term ~loc (TSizeOf ty) lty_sizeof in
let t_size = size_from_sizes_and_shifts ~loc sizes_and_shifts in
let t_size =
Logic_const.term ~loc (TBinOp(Mult, t_sizeof, t_size)) lty_sizeof
in
Typing.type_term ~use_gmp_opt:false t_size;
let malloc_stmt = match Typing.get_number_ty t_size with
| Typing.C_integer IInt ->
let e_size, _ = term_to_exp kf env t_size in
let e_size = Cil.constFold false e_size in
let malloc_stmt =
Smart_stmt.lib_call ~loc
~result:(Cil.var vi)
"malloc"
[ e_size ]
in
malloc_stmt
| Typing.(C_integer _ | C_float _ | Gmpz) ->
Error.not_yet
"\\at on purely logic variables that needs to allocate \
too much memory (bigger than int_max bytes)"
| Typing.(Rational | Real | Nan) ->
Error.not_yet "quantification over non-integer type"
in
let free_stmt = Smart_stmt.lib_call ~loc "free" [e] in
(* The list of stmts returned by the current closure are inserted
LOCALLY to the block where the new var is FIRST used, whatever scope
is indicated to [Env.new_var].
Thus we need to add [malloc] and [free] through dedicated functions.
*)
Malloc.add kf malloc_stmt;
Free.add kf free_stmt;
[])
in
(* Index *)
let t_index = index_from_sizes_and_shifts ~loc sizes_and_shifts in
......@@ -295,34 +296,34 @@ let to_exp ~loc kf env pot label =
let e, env = named_predicate_to_exp kf env p in
let e = Cil.constFold false e in
let storing_stmt =
Constructor.mk_assigns ~loc ~result:lval e
Smart_stmt.assigns ~loc ~result:lval e
in
let block, env =
Env.pop_and_get env storing_stmt ~global_clear:false Env.After
in
(* We CANNOT return [block.bstmts] because it does NOT contain
variable declarations. *)
[ Constructor.mk_block_stmt block ], env
variable declarations. *)
[ Smart_stmt.block_stmt block ], env
| Lscope.PoT_term t ->
begin match Typing.get_number_ty t with
| Typing.(C_integer _ | C_float _ | Nan) ->
let env = Env.push env in
let lval, env = lval_at_index ~loc kf env (e_at, vi_at, t_index) in
let e, env = term_to_exp kf env t in
let e = Cil.constFold false e in
let storing_stmt =
Constructor.mk_assigns ~loc ~result:lval e
in
let block, env =
Env.pop_and_get env storing_stmt ~global_clear:false Env.After
in
(* We CANNOT return [block.bstmts] because it does NOT contain
variable declarations. *)
[ Constructor.mk_block_stmt block ], env
| Typing.(Rational | Real) ->
Error.not_yet "\\at on purely logic variables and over real type"
| Typing.Gmpz ->
Error.not_yet "\\at on purely logic variables and over gmp type"
| Typing.(C_integer _ | C_float _ | Nan) ->
let env = Env.push env in
let lval, env = lval_at_index ~loc kf env (e_at, vi_at, t_index) in
let e, env = term_to_exp kf env t in
let e = Cil.constFold false e in
let storing_stmt =
Smart_stmt.assigns ~loc ~result:lval e
in
let block, env =
Env.pop_and_get env storing_stmt ~global_clear:false Env.After
in
(* We CANNOT return [block.bstmts] because it does NOT contain
variable declarations. *)
[ Smart_stmt.block_stmt block ], env
| Typing.(Rational | Real) ->
Error.not_yet "\\at on purely logic variables and over real type"
| Typing.Gmpz ->
Error.not_yet "\\at on purely logic variables and over gmp type"
end
in
(* Storing loops *)
......@@ -333,16 +334,16 @@ let to_exp ~loc kf env pot label =
in
let storing_loops_block = Cil.mkBlock storing_loops_stmts in
let storing_loops_block, env = Env.pop_and_get
env
(Constructor.mk_block_stmt storing_loops_block)
~global_clear:false
Env.After
env
(Smart_stmt.block_stmt storing_loops_block)
~global_clear:false
Env.After
in
(* Put at label *)
let env = put_block_at_label env kf storing_loops_block label in
(* Returning *)
let lval_at_index, env = lval_at_index ~loc kf env (e_at, vi_at, t_index) in
let e = Constructor.mk_lval ~loc lval_at_index in
let e = Smart_exp.lval ~loc lval_at_index in
e, env
(*
......
......@@ -24,7 +24,7 @@ open Cil_types
open Cil_datatype
(* Convert \at on terms or predicates in which we can find purely
logic variable. *)
logic variable. *)
(**************************************************************************)
(*************************** Translation **********************************)
......@@ -39,8 +39,8 @@ val to_exp:
(*****************************************************************************)
(* The different possible evaluations of the [\at] under study are
stored in a memory location that needs to be alloted then freed.
This part is designed for that purpose. *)
stored in a memory location that needs to be alloted then freed.
This part is designed for that purpose. *)
module Malloc: sig
val find_all: kernel_function -> stmt list
......
......@@ -56,7 +56,7 @@ type local_env = {
type t = {
lscope: Lscope.t;
lscope_reset: bool;
annotation_kind: Constructor.annotation_kind;
annotation_kind: Smart_stmt.annotation_kind;
new_global_vars: (varinfo * localized_scope) list;
(* generated variables. The scope indicates the level where the variable
should be added. *)
......@@ -88,7 +88,7 @@ let empty_local_env =
let empty =
{ lscope = Lscope.empty;
lscope_reset = true;
annotation_kind = Constructor.Assertion;
annotation_kind = Smart_stmt.Assertion;
new_global_vars = [];
global_mp_tbl = empty_mp_tbl;
env_stack = [];
......@@ -257,7 +257,7 @@ let rtl_call_to_new_var ~loc ?scope ?name env kf t ty func_name args =
t
ty
(fun v _ ->
[ Constructor.mk_rtl_call ~loc ~result:(Cil.var v) func_name args ])
[ Smart_stmt.rtl_call ~loc ~result:(Cil.var v) func_name args ])
in
exp, env
......@@ -351,9 +351,9 @@ let add_stmt ?(post=false) ?before env kf stmt =
{ env with env_stack = local_env :: tl }
let extend_stmt_in_place env stmt ~label block =
let new_stmt = Constructor.mk_block_stmt block in
let new_stmt = Smart_stmt.block_stmt block in
let sk = stmt.skind in
stmt.skind <- Block (Cil.mkBlock [ new_stmt; Constructor.mk_stmt sk ]);
stmt.skind <- Block (Cil.mkBlock [ new_stmt; Smart_stmt.stmt sk ]);
let pre = match label with
| BuiltinLabel(Here | Post) -> true
| BuiltinLabel(Old | Pre | LoopEntry | LoopCurrent | Init)
......@@ -447,7 +447,7 @@ let pop_and_get ?(split=false) env stmt ~global_clear where =
add the given [stmt] afterwards. This way, we have the guarantee that
the final block does not contain any local, so may be transient. *)
if split then
let sblock = Constructor.mk_block_stmt b in
let sblock = Smart_stmt.block_stmt b in
Cil.transient_block (Cil.mkBlock [ sblock; stmt ])
else
b
......
......@@ -148,8 +148,8 @@ end
(** {2 Current annotation kind} *)
(* ************************************************************************** *)
val annotation_kind: t -> Constructor.annotation_kind
val set_annotation_kind: t -> Constructor.annotation_kind -> t
val annotation_kind: t -> Smart_stmt.annotation_kind
val set_annotation_kind: t -> Smart_stmt.annotation_kind -> t
(* ************************************************************************** *)
(** {2 Loop invariants} *)
......
......@@ -123,8 +123,8 @@ let mk_init_function () =
if Misc.is_fc_or_compiler_builtin vi then stmts
else
(* a global is both allocated and initialized *)
Constructor.mk_store_stmt vi
:: Constructor.mk_initialize ~loc:Location.unknown (Cil.var vi)
Smart_stmt.store_stmt vi
:: Smart_stmt.initialize ~loc:Location.unknown (Cil.var vi)
:: stmts)
tbl
stmts
......@@ -136,10 +136,10 @@ let mk_init_function () =
let loc = Location.unknown in
let e = Cil.new_exp ~loc:loc (Const (CStr s)) in
let str_size = Cil.new_exp loc (SizeOfStr s) in
Constructor.mk_assigns ~loc ~result:(Cil.var vi) e
:: Constructor.mk_store_stmt ~str_size vi
:: Constructor.mk_full_init_stmt vi
:: Constructor.mk_mark_readonly vi
Smart_stmt.assigns ~loc ~result:(Cil.var vi) e
:: Smart_stmt.store_stmt ~str_size vi
:: Smart_stmt.full_init_stmt vi
:: Smart_stmt.mark_readonly vi
:: stmts)
stmts
in
......@@ -150,7 +150,7 @@ let mk_init_function () =
let b, _env = Env.pop_and_get env stmt ~global_clear:true Env.Before in
b, stmts
in
let stmts = Constructor.mk_block_stmt b :: stmts in
let stmts = Smart_stmt.block_stmt b :: stmts in
(* prevent multiple calls to [__e_acsl_globals_init] *)
let loc = Location.unknown in
let vi_already_run =
......@@ -168,14 +168,14 @@ let mk_init_function () =
(Local_init (vi_already_run, init, loc))
in
let already_run =
Constructor.mk_assigns
Smart_stmt.assigns
~loc
~result:(Cil.var vi_already_run)
(Cil.one ~loc)
in
let stmts = already_run :: stmts in
let guard =
Constructor.mk_if
Smart_stmt.if_stmt
~loc
~cond:(Cil.evar vi_already_run)
(Cil.mkBlock [])
......@@ -195,7 +195,7 @@ let mk_delete_function () =
Varinfo.Hashtbl.fold_sorted
(fun vi _l acc ->
if Misc.is_fc_or_compiler_builtin vi then acc
else Constructor.mk_delete_stmt vi :: acc)
else Smart_stmt.delete_stmt vi :: acc)
tbl
[]
in
......
......@@ -33,7 +33,7 @@ let apply_on_var ~loc funname e =
else if Gmp_types.Q.is_t ty then "__gmpq_"
else assert false
in
Constructor.mk_lib_call ~loc (prefix ^ funname) [ e ]
Smart_stmt.lib_call ~loc (prefix ^ funname) [ e ]
let init ~loc e = apply_on_var "init" ~loc e
let clear ~loc e = apply_on_var "clear" ~loc e
......@@ -90,9 +90,9 @@ let generic_affect ~loc fname lv ev e =
let ty = Cil.typeOf ev in
if Gmp_types.Z.is_t ty || Gmp_types.Q.is_t ty then begin
let suf, args = get_set_suffix_and_arg ty e in
Constructor.mk_lib_call ~loc (fname ^ suf) (ev :: args)
Smart_stmt.lib_call ~loc (fname ^ suf) (ev :: args)
end else
Constructor.mk_assigns ~loc:e.eloc ~result:lv e
Smart_stmt.assigns ~loc:e.eloc ~result:lv e
let init_set ~loc lv ev e =
let fname =
......@@ -111,7 +111,7 @@ let init_set ~loc lv ev e =
| Lval elv ->
assert (Gmp_types.Z.is_t (Cil.typeOf ev));
let call =
Constructor.mk_lib_call ~loc
Smart_stmt.lib_call ~loc