Module type Wp.Sigs.CodeSemantics

module type CodeSemantics = sig .. end

Compiler for C expressions


module M: Wp.Sigs.Model 

The underlying memory model

type loc = M.loc 
type value = loc Wp.Sigs.value 
type result = loc Wp.Sigs.result 
type sigma = M.Sigma.t 
val pp_value : Stdlib.Format.formatter -> value -> unit
val cval : value -> Wp.Lang.F.term

Evaluate an abstract value. May fail because of M.pointer_val.

val cloc : value -> loc

Interpret a value as a location. May fail because of M.pointer_loc.

val cast : Cil_types.typ ->
Cil_types.typ -> value -> value

Applies a pointer cast or a conversion.

cast tr te ve transforms a value ve with type te into a value with type tr.

val equal_typ : Cil_types.typ ->
value -> value -> Wp.Lang.F.pred

Computes the value of (a==b) provided both a and b are values with the given type.

val not_equal_typ : Cil_types.typ ->
value -> value -> Wp.Lang.F.pred

Computes the value of (a==b) provided both a and b are values with the given type.

val equal_obj : Wp.Ctypes.c_object ->
value -> value -> Wp.Lang.F.pred

Same as equal_typ with an object type.

val not_equal_obj : Wp.Ctypes.c_object ->
value -> value -> Wp.Lang.F.pred

Same as not_equal_typ with an object type.

val exp : sigma -> Cil_types.exp -> value

Evaluate the expression on the given memory state.

val cond : sigma -> Cil_types.exp -> Wp.Lang.F.pred

Evaluate the conditional expression on the given memory state.

val lval : sigma -> Cil_types.lval -> loc

Evaluate the left-value on the given memory state.

val call : sigma -> Cil_types.exp -> loc

Address of a function pointer. Handles AddrOf, StartOf and Lval as usual.

val instance_of : loc -> Cil_types.kernel_function -> Wp.Lang.F.pred

Check whether a function pointer is (an instance of) some kernel function. Currently, the meaning of "being an instance of" is simply equality.

val loc_of_exp : sigma -> Cil_types.exp -> loc

Compile an expression as a location. May (also) fail because of M.pointer_val.

val val_of_exp : sigma -> Cil_types.exp -> Wp.Lang.F.term

Compile an expression as a term. May (also) fail because of M.pointer_loc.

val result : sigma ->
Cil_types.typ -> result -> Wp.Lang.F.term

Value of an abstract result container.

val return : sigma ->
Cil_types.typ -> Cil_types.exp -> Wp.Lang.F.term

Return an expression with a given type. Short cut for compiling the expression, cast into the desired type, and finally converted to a term.

val is_zero : sigma ->
Wp.Ctypes.c_object -> loc -> Wp.Lang.F.pred

Express that the object (of specified type) at the given location is filled with zeroes.

val is_exp_range : sigma ->
loc ->
Wp.Ctypes.c_object ->
Wp.Lang.F.term ->
Wp.Lang.F.term -> value option -> Wp.Lang.F.pred

Express that all objects in a range of locations have a given value.

More precisely, is_exp_range sigma loc ty a b v express that value at ( ty* )loc + k equals v, forall a <= k <= b. Value v=None stands for zero.

val unchanged : M.sigma -> M.sigma -> Cil_types.varinfo -> Wp.Lang.F.pred

Express that a given variable has the same value in two memory states.

type warned_hyp = Wp.Warning.Set.t * (Wp.Lang.F.pred * Wp.Lang.F.pred) 
val init : sigma:M.sigma ->
Cil_types.varinfo ->
Cil_types.init option -> warned_hyp list

Express that some variable has some initial value at the given memory state. The first predicate states the value, the second, the initialization status.

Note: we DO NOT merge values and initialization status hypotheses as the factorization performed by Qed can make predicates too hard to simplify later.

Remark: None initializer are interpreted as zeroes. This is consistent with the init option associated with global variables in CIL, for which the default initializer are zeroes. This function is called for global initializers and local initializers (Cil.Local_init). It is not called for local variables without initializers as they do not have a Cil.init option.