Frama-C API - Region
Interface for the Region plug-in
Each function is assigned a region map. Areas in the map represents l-values or, more generally, class of nodes. Regions are classes equivalences of nodes that represents a collection of addresses (at some program point).
Regions can be subdivided into sub-regions. Hence, given two regions, either one is included into the other, or they are separated. Hence, given two l-values, if their associated regions are separated, then they can not be aliased.
Nodes are elementary elements of a region map. Variables maps to nodes, and one can move to one node to another by struct or union field or array element. Two disting nodes might belong to the same region. However, it is possible to normalize nodes and obtain a unique identifier for all nodes in a region.
Memory Maps and Nodes
val map : Frama_c_kernel.Cil_types.kernel_function -> mapval id : node -> intUnique id of normalized node. This can be considered the unique identifier of the region equivalence class.
val pretty : Stdlib.Format.formatter -> node -> unitRegion Properties
All functions in this section provide normalized nodes and shall never raise exception.
val size : node -> intval cvars : node -> Frama_c_kernel.Cil_types.varinfo listval labels : node -> string listval reads : node -> Frama_c_kernel.Cil_types.typ listval writes : node -> Frama_c_kernel.Cil_types.typ listval shifts : node -> Frama_c_kernel.Cil_types.typ listval typed : node -> Frama_c_kernel.Cil_types.typ optionFull-sized cells with unique type access
Alias Analysis
separated a b checks if region a and region b are disjoint. Disjoints regions a and b have the following properties:
ais not a sub-region ofb;bis not a sub-region ofa;- two l-values respectively localized in
aandbcan never be aliased.
val singleton : node -> boolsingleton a returns true when node a is guaranteed to have only one single address in its equivalence class.
val lval : map -> Frama_c_kernel.Cil_types.lval -> nodelval m lv is region where the address of l lives in. The returned region is normalized.
val exp : map -> Frama_c_kernel.Cil_types.exp -> node optionexp m e is the domain of values that can computed by expression e. The domain is Some r is e has a pointer type and any pointer computed by e lives in region r. The domain is None if e has a non-pointer scalar or compound type.
Low-level Navigation through Memory Maps
For optimized access, all the functions in this section return unnormalized nodes and may raise Not_found for not localized routes.
val cvar : map -> Frama_c_kernel.Cil_types.varinfo -> nodeUnormalized.
val field : node -> Frama_c_kernel.Cil_types.fieldinfo -> nodeUnormalized.
val index : node -> Frama_c_kernel.Cil_types.typ -> nodeUnormalized.
