Module IR__Exp
The Smallfoot Intermediate Language: Expressions
NOTE: For doing substitutionson expressions, there are some functions in Sil.
type closure={name : IR.Procname.t;captured_vars : (t * IR.Pvar.t * IR.Typ.t * IR.CapturedVar.capture_mode) list;}and sizeof_data={typ : IR.Typ.t;nbytes : int option;dynamic_length : t option;subtype : IR.Subtype.t;}This records information about a
sizeof(typ)expression.nbytesrepresents the result of the evaluation ofsizeof(typ)if it is statically known.If
typis of the formTarray elt (Some static_length), thendynamic_lengthis the number of elements of typeeltin the array. Thedynamic_length, tracked by symbolic execution, may differ from thestatic_lengthobtained from the type definition, e.g. when an array is over-allocated.If
typis a struct type, thedynamic_lengthis that of the final extensible array, if any.
and t=|Var of IR.Ident.tPure variable: it is not an lvalue
|UnOp of IR.Unop.t * t * IR.Typ.t optionUnary operator with type of the result if known
|BinOp of IR.Binop.t * t * tBinary operator
|Exn of tException
|Closure of closureAnonymous function
|Const of IR.Const.tConstants
|Cast of IR.Typ.t * tType cast
|Lvar of IR.Pvar.tThe address of a program variable
|Lfield of t * IR.Fieldname.t * IR.Typ.tA field offset, the type is the surrounding struct type
|Lindex of t * tAn array index offset:
exp1[exp2]|Sizeof of sizeof_dataProgram expressions.
val compare_closure : closure -> closure -> intval compare_sizeof_data : sizeof_data -> sizeof_data -> intval compare : t -> t -> int
module Set : IStdlib.IStd.Caml.Set.S with type Set.elt = tSet of expressions.
module Map : IStdlib.IStd.Caml.Map.S with type Map.key = tMap with expression keys.
module Hash : IStdlib.IStd.Caml.Hashtbl.S with type Hash.key = tHashtable with expression keys.
val is_null_literal : t -> boolval is_this : t -> boolreturn true if
expis the special this/self expression
Utility Functions for Expressions
val texp_to_typ : IR.Typ.t option -> t -> IR.Typ.tTurn an expression representing a type into the type it represents If not a sizeof, return the default type if given, otherwise raise an exception
val get_undefined : bool -> tGet an expression "undefined", the boolean indicates whether the undefined value goest into the footprint
val pointer_arith : t -> boolChecks whether an expression denotes a location using pointer arithmetic. Currently, catches array - indexing expressions such as a
ionly.
val has_local_addr : t -> boolreturns true if the expression operates on address of local variable
val zero : tInteger constant 0
val null : tNull constant
val one : tInteger constant 1
val minus_one : tInteger constant -1
val int : IR.IntLit.t -> tCreate integer constant
val float : float -> tCreate float constant
val bool : bool -> tCreate integer constant corresponding to the boolean value
val free_vars : t -> IR.Ident.t IStdlib.IStd.Sequence.tall the idents appearing in the expression
val gen_free_vars : t -> (unit, IR.Ident.t) IStdlib.IStd.Sequence.Generator.tval ident_mem : t -> IR.Ident.t -> booltrue if the identifier appears in the expression
val program_vars : t -> IR.Pvar.t IStdlib.IStd.Sequence.tall the program variables appearing in the expression
val fold_captured : f:('a -> t -> 'a) -> t -> 'a -> 'aFold over the expressions captured by this expression.
val pp_diff : ?print_types:bool -> IStdlib.Pp.env -> F.formatter -> t -> unitval pp : F.formatter -> t -> unitval pp_closure : F.formatter -> closure -> unitval to_string : t -> stringval d_exp : t -> unitdump an expression.
val pp_texp : IStdlib.Pp.env -> F.formatter -> t -> unitPretty print a type.
val pp_texp_full : IStdlib.Pp.env -> F.formatter -> t -> unitPretty print a type with all the details.
val d_texp_full : t -> unitDump a type expression with all the details.
val d_list : t list -> unitDump a list of expressions.