package frama-c
Install
dune-project
Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
MMaxime Jacquemin
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
TTristan Le Gall
-
JJean-Christophe Léchenet
-
MMatthieu Lemerre
-
DDara Ly
-
DDavid Maison
-
CClaude Marché
-
AAndré Maroneze
-
TThibault Martin
-
FFonenantsoa Maurica
-
MMelody Méaulle
-
BBenjamin Monate
-
YYannick Moy
-
AAnne Pacalet
-
VValentin Perrelle
-
GGuillaume Petiot
-
DDario Pinto
-
VVirgile Prevosto
-
AArmand Puccetti
-
FFélix Ridoux
-
VVirgile Robles
-
MMuriel Roger
-
JJulien Signoles
-
NNicolas Stouls
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
sha256=25885f89daa478aeafdd1e4205452c7a30695d4b3b3ee8fc98b4a9c5f83f79c2
doc/frama-c-wp.core/Wp/StmtSemantics/Make/argument-1-Compiler/L/index.html
Module Compiler.L
module M = MUnderlying memory model
type loc = M.loctype nonrec value = M.loc Sigs.valuetype nonrec logic = M.loc Sigs.logictype nonrec region = M.loc Sigs.regiontype nonrec result = M.loc Sigs.resulttype sigma = M.Sigma.tFrames
Frames are compilation environment for ACSL. A frame typically manages the current function, formal paramters, the memory environments at different labels and the \result and \exit_status values.
The frame also holds the gamma environment responsible for accumulating typing constraints, and the pool for generating fresh logic variables.
Notice that a frame is not responsible for holding the environment at label Here, since this is managed by a specific compilation environment, see env below.
val pp_frame : Format.formatter -> frame -> unitval get_frame : unit -> frameGet the current frame, or raise a fatal error if none.
val in_frame : frame -> ('a -> 'b) -> 'a -> 'bExecute the given closure with the specified current frame. The Lang.gamma and Lang.pool contexts are also set accordingly.
val mem_at_frame : frame -> Clabels.c_label -> sigmaGet the memory environment at the given label. A fresh environment is created lazily if required. The label must not be Here.
val set_at_frame : frame -> Clabels.c_label -> sigma -> unitUpdate a frame with a specific environment for the given label.
val has_at_frame : frame -> Clabels.c_label -> boolChek if a frame already has a specific envioronement for the given label.
val mem_frame : Clabels.c_label -> sigmaSame as mem_at_frame but for the current frame.
val mk_frame :
?kf:Frama_c_kernel.Cil_types.kernel_function ->
?result:result ->
?status:Lang.F.var ->
?formals:value Frama_c_kernel.Cil_datatype.Varinfo.Map.t ->
?labels:sigma Clabels.LabelMap.t ->
?descr:string ->
unit ->
frameFull featured constructor for frames, with fresh pool and gamma.
val local : descr:string -> frameMake a local frame reusing the current pool and gamma.
val frame : Frama_c_kernel.Cil_types.kernel_function -> frameMake a fresh frame with the given function.
val call :
?result:M.loc ->
Frama_c_kernel.Cil_types.kernel_function ->
value list ->
callCreate call data from the callee point of view, deriving data (gamma and pools) from the current frame. If result is specified, the called function will stored its result at the provided location in the current frame (the callee).
Derive a frame from the call data suitable for compiling the called function contracts in the provided pre-state.
val call_post : sigma -> call -> sigma Sigs.sequence -> frameDerive a frame from the call data suitable for compiling the called function contracts in the provided pre-state and post-state.
val return : unit -> Frama_c_kernel.Cil_types.typResult type of the current function in the current frame.
val result : unit -> resultResult location of the current function in the current frame.
val status : unit -> Lang.F.varExit status for the current frame.
val guards : frame -> Lang.F.pred listReturns the current gamma environment from the current frame.
Compilation Environment
Compilation environment for terms and predicates. Manages the current memory state and the memory state at Here.
Remark: don't confuse the current memory state with the memory state at label Here. The current memory state is the one we have at hand when compiling a term or a predicate. Hence, inside \at(e,L) the current memory state when compiling e is the one at L.
val mk_env :
?here:sigma ->
?lvars:Frama_c_kernel.Cil_types.logic_var list ->
unit ->
envCreate a new environment.
Current and Here memory points are initialized to ~here, if provided.
The logic variables stand for formal parameters of ACSL logic function and ACSL predicates.
The current memory state. Must be propertly initialized with a specific move before.
Move the compilation environment to the specified Here memory state. This memory state becomes also the new current one.
val mem_at : env -> Clabels.c_label -> sigmaReturns the memory state at the requested label. Uses the local environment for Here and the current frame otherwize.
val env_at : env -> Clabels.c_label -> envReturns a new environment where the current memory state is moved to to the corresponding label. Suitable for compiling e inside \at(e,L) ACSL construct.
Compilers
val lval :
env ->
Frama_c_kernel.Cil_types.term_lval ->
Frama_c_kernel.Cil_types.typ * M.locCompile a term l-value into a (typed) abstract location
val term : env -> Frama_c_kernel.Cil_types.term -> Lang.F.termCompile a term expression.
val pred :
Sigs.polarity ->
env ->
Frama_c_kernel.Cil_types.predicate ->
Lang.F.predCompile a predicate. The polarity is used to generate a weaker or stronger predicate in case of unsupported feature from WP or the underlying memory model.
val call_pred :
env ->
Frama_c_kernel.Cil_types.logic_info ->
Frama_c_kernel.Cil_types.logic_label list ->
Lang.F.term list ->
Lang.F.predCompile a predicate call.
val region : env -> Frama_c_kernel.Cil_types.term -> regionCompile a term representing a set of memory locations into an abstract region.
val assigned_of_lval : env -> Frama_c_kernel.Cil_types.lval -> regionComputes the region assigned by a list of froms.
val assigned_of_froms : env -> Frama_c_kernel.Cil_types.from list -> regionComputes the region assigned by a list of froms.
val assigned_of_assigns :
env ->
Frama_c_kernel.Cil_types.assigns ->
region optionComputes the region assigned by an assigns clause. None means everyhting is assigned.
val val_of_term : env -> Frama_c_kernel.Cil_types.term -> Lang.F.termSame as term above but reject any set of locations.
val loc_of_term : env -> Frama_c_kernel.Cil_types.term -> locSame as term above but expects a single loc or a single pointer value.
val lemma : LogicUsage.logic_lemma -> Definitions.dlemmaCompile a lemma definition.
Regions
val vars : region -> Lang.F.Vars.tQed variables appearing in a region expression.
val occurs : Lang.F.var -> region -> boolMember of vars.
val check_assigns :
unfold:int ->
sigma ->
written:region ->
assignable:region ->
Lang.F.predCheck assigns inclusion. Compute a formula that checks whether written locations are either invalid (at the given memory location) or included in some assignable region. When ~unfold:n && n <> 0, compound memory locations are expanded field-by-field and arrays, cell-by-cell (by quantification). Up to n levels are unfolded, -1 means unlimited.