Module Build

module Build: sig .. end
Build graphs (PDG) for the function (see module Build.BuildPdg) to represente the dependencies between instructions in order to use it for slicing purposes.

A function is processed using a forward dataflow analysis (see module Dataflow which is instanciated with the module Build.Computer below).


val dkey : Pdg_parameters.category
val debug : ('a, Format.formatter, unit) Pervasives.format -> 'a
val debug2 : ('a, Format.formatter, unit) Pervasives.format -> 'a
exception Err_Bot of string
module BoolNodeSet: Set.Make(Datatype.Pair(Datatype.Bool)(PdgTypes.Node))
set of nodes of the graph
val pretty_node : ?key:bool -> Format.formatter -> PdgTypes.Node.t -> unit
val is_variadic : Kernel_function.t -> bool
val add_dpd_in_g : PdgTypes.G.t ->
PdgTypes.Node.t ->
PdgTypes.Dpd.td -> Locations.Zone.t option -> PdgTypes.Node.t -> unit
add a dependency with the given label between the two nodes. Pre : the nodes have to be already in pdg.
module BuildPdg: sig .. end
Module to build the PDG.
val get_lval_infos : Cil_types.lval ->
Cil_types.stmt ->
Locations.Zone.t * bool * Locations.Zone.t * Cil_datatype.Varinfo.Set.t
gives needed informations about lval : = location + exact + dependencies + declarations
val process_asgn : BuildPdg.t ->
PdgTypes.data_state ->
Cil_types.stmt ->
Cil_types.lval -> Cil_types.exp -> PdgTypes.data_state option
process assignment
lval = exp;
Use the state at ki (before assign) and returns the new state (after assign).
val process_args : BuildPdg.t ->
PdgTypes.data_state ->
Cil_types.stmt -> Cil_types.exp list -> BuildPdg.arg_nodes
Add a PDG node and its dependencies for each explicit call argument.
val call_ouputs : BuildPdg.t ->
PdgTypes.data_state ->
PdgTypes.data_state ->
Cil_types.stmt ->
Cil_types.lval option ->
Function_Froms.froms -> Locations.Zone.t -> PdgTypes.data_state
Add nodes for the call outputs, and add the dependencies according to from_table. To avoid mixing inputs and outputs, in_state is the input state and new_state the state to modify. Process call outputs (including returned value)
val process_call : BuildPdg.t ->
PdgTypes.data_state ->
Cil_types.stmt ->
Cil_types.lval option ->
Cil_types.exp -> Cil_types.exp list -> PdgTypes.data_state option
process call :
lvaloption = funcexp (argl);
Use the state at ki (before the call) and returns the new state (after the call).
val process_condition : CtrlDpds.t ->
BuildPdg.t ->
PdgTypes.data_state -> Cil_types.stmt -> Cil_types.exp -> unit
Add a node in the PDG for the conditional statement, and register the statements that are control-dependent on it.
val process_jump_stmt : BuildPdg.t -> CtrlDpds.t -> Cil_types.stmt -> unit
let's add a node for e jump statement (goto, break, continue) and find the statements which are depending on it. Returns are not handled here, but in Build.process_return.
val process_loop_stmt : BuildPdg.t -> CtrlDpds.t -> Cil_types.stmt -> unit
Loop are processed like gotos because CIL transforms them into
while(true) body;
which is equivalent to
L : body ; goto L;
There is a small difference because we have to detect the case where the goto L; would be unreachable (no real loop). This is important because it might lead to infinite loop (see bst#787)
val process_return : 'a ->
BuildPdg.t ->
PdgTypes.data_state -> Cil_types.stmt -> Cil_types.exp option -> unit
return ret_exp; is equivalent to out0 = ret_exp; goto END; while a simple return; is only a goto END;. Here, we assume that the Oneret analysis was used, ie. that it is the only return of the function and that it is the last statement. So, the goto is not useful, and the final state is stored to be used later on to compute the outputs.
module Computer: 
functor (Param : sig
val current_pdg : BuildPdg.t
val ctrl_dpds_infos : CtrlDpds.t
end) -> sig .. end
Computer is a ForwardsTransfer to use Datatflow.Forwards
val ctrl_no_preds : Cil_types.stmt list -> Cil_types.stmt list
Find the statements that are not reachable in CFG (no predecessors) to add them as starting point of the dataflow analysis because we need to process unreachable control statetemetns in order to have correct control dependancies.
val compute_pdg_for_f : Kernel_function.t -> PdgTypes.Pdg.t
Compute and return the PDG for the given function
val degenerated : bool -> Kernel_function.t -> PdgTypes.Pdg.t
val compute_pdg : Kernel_function.t -> PdgTypes.Pdg.t