Module SlicingInternals

module SlicingInternals: sig .. end

Internals types

Internals type definitions should be hidden to the outside world, but it is not really possible to have abstract types since Slicing has to use Db.Slicing functions...


About options


type level_option = 
| DontSlice (*
don't build slice for the function : ie. always call the source function.
*)
| DontSliceButComputeMarks (*
don't slice the called functions, but compute the marks for them
*)
| MinNbSlice (*
try to use existing slices, create at most one
*)
| MaxNbSlice (*
most precise slices (but merge slices with the same visibility, even if they don't have the same marks)
*)
associate a level to each function in order to control how it will be specialized. This is only a hint used when the tool has to make a choice, but it doesn't forbid to the user to do whatever he wants (like building slices for a DontSlice function).

About function slice


type mark = 
| Cav of PdgTypes.Dpd.t
| Spare
Kinds of elementary marks.
val compare_mark : mark -> mark -> int
type pdg_mark = {
   m1 : mark;
   m2 : mark;
}
Each PDG element has 2 marks to deal with interprocedural propagation
val pdg_mark_packed_descr : Structural_descr.pack
val compare_pdg_mark : pdg_mark -> pdg_mark -> int
type fct_info = {
   fi_kf : Cil_types.kernel_function;
   fi_def : Cil_types.fundec option;
   fi_project : project;
   mutable fi_top : pdg_mark option; (*
indicates if the function is maked top (=> src visible)
*)
   mutable fi_level_option : level_option; (*
level of specialisation for this function
*)
   mutable fi_init_marks : ff_marks option; (*
the marks that must be in every slices of that function
*)
   mutable fi_slices : fct_slice list; (*
the list of the slices already computed for this function.
*)
   mutable fi_next_ff_num : int; (*
the number to assign to the next slice.
*)
   mutable f_called_by : called_by; (*
calls in slices that call source fct
*)
}
Type for all the informations related to any function, even if we don't have its definition.
type called_by = (fct_slice * Cil_types.stmt) list 
type fct_slice = {
   ff_fct : fct_info;
   ff_id : int;
   mutable ff_marks : ff_marks;
   mutable ff_called_by : called_by;
}
type fct_id = 
| FctSrc of fct_info (*
source function
*)
| FctSliced of fct_slice (*
sliced function
*)
type called_fct = 
| CallSrc of fct_info option (*
call the source function (might be unknown if the call uses pointer)
*)
| CallSlice of fct_slice
type call_info = called_fct option 
type marks_index = (pdg_mark, call_info) PdgIndex.FctIndex.t 
type ff_marks = PdgTypes.Pdg.t * marks_index 
type project = {
   name : string;
   application : Project.t;
   functions : fct_info Cil_datatype.Varinfo.Hashtbl.t;
   mutable actions : criterion list;
}
type appli_criterion = 
| CaGlobalData of Locations.Zone.t (*
select all that is necessary to compute the given location.
*)
| CaCall of fct_info (*
select all that is necessary to call the given function. Its application generates requests to add persistent selection to all the function callers.
*)
| CaOther
type fct_base_criterion = pdg_mark PdgMarks.select 
type loc_point = Cil_types.stmt * Locations.Zone.t * bool 

List of pdg nodes to be selected (see SlicingInternals.fct_user_crit)
type node_or_dpds = 
| CwNode
| CwAddrDpds
| CwDataDpds
| CwCtrlDpds
type fct_user_crit = 
| CuSelect of pdg_mark PdgMarks.select
| CuTop of pdg_mark (*
the function has probably no PDG, but we nonetheless give a mark to propagate
*)
type fct_crit = 
| CcUserMark of fct_user_crit (*
add marks to a slice
*)
| CcChooseCall of Cil_types.stmt (*
have to choose what function to call here.
*)
| CcChangeCall of Cil_types.stmt * called_fct (*
call the called_fct for the given call Cil_types.stmt
*)
| CcMissingOutputs of Cil_types.stmt * pdg_mark PdgMarks.select * bool (*
this call is affected to a function that doesn't compute enough outputs : we will have to choose between adding outputs to that slice, or call another one. The boolean tells if the modifications would change the visibility of some outputs.
*)
| CcMissingInputs of Cil_types.stmt * pdg_mark PdgMarks.select * bool (*
the function calls a slice that has been modified : and doesn't compute not enough inputs. We will have to choose between adding marks to this function, and call another slice. The boolean tells if the modifications would change the visibility of some inputs.
*)
| CcPropagate of pdg_mark PdgMarks.select (*
simply propagate the given marks
*)
| CcExamineCalls of pdg_mark PdgMarks.info_called_outputs
type fct_criterion = {
   cf_fct : fct_id; (*
Identification of the RESULT of this filter. When it a a slice, it might be an existing slice that will be modified, or a new one will be created during application. When it is the source function, it means what the criterion has to be applied on each existing slice, and stored into the inititial marks of the function.
*)
   cf_info : fct_crit;
}
type criterion = 
| CrAppli of appli_criterion
| CrFct of fct_criterion

Internals values


val dummy_pdg_mark : pdg_mark

For the journalization of these internals types


val dummy_project : project
The whole project.
val dummy_fct_info : fct_info
val dummy_marks_index : (pdg_mark, call_info) PdgIndex.FctIndex.t
val dummy_ff_marks : PdgTypes.Pdg.t *
(pdg_mark, call_info) PdgIndex.FctIndex.t
val dummy_fct_slice : fct_slice
val dummy_fct_user_crit : fct_user_crit