Module Lexical_successors


module Lexical_successors: sig .. end
Compute a graph which provide the lexical successor of each statement s, ie. the statement which is the next one if 's' is replaced by Nop. Notice that if 's' is an If, Loop, ... the considered statement is the whole block.

Example : (1) x = 3; (2) if (c) (3) y = 3; (4) goto L; else (5) z = 8; (6) while (c--) (7) x++; (8) L : return x;

(1) -> (2) -> (6) -> (8) (3) -> (4) -> (6) (5) -> (6) (7) -> (6)


val add_link : Cil_types.stmt Inthash.t ->
prev:Cil_types.kinstr -> next:Cil_types.kinstr -> unit
Add a link prev -> next in the graph. Do nothing if prev or next is Kglobal.
val add_links : Cil_types.stmt Inthash.t -> Cil_types.kinstr list -> Cil_types.kinstr -> unit
Add links from each prev in prev_list to next.
val process_stmt : Cil_types.stmt Inthash.t ->
prev_list:Cil_types.kinstr list ->
stmt:Cil_types.stmt -> Cil_types.kinstr list
Add links from prev_list to stmt, (ie. 'stmt' is the lexical succesor of every statements in prev_list) and build the links inside stmt (when it contains blocks)
Returns a list of the last statements in stmt to continue processing with the statement that follows.
val process_tail : Cil_types.stmt Inthash.t ->
Cil_types.kinstr list -> Cil_types.stmt list -> Cil_types.kinstr list
Process each statement in tail (statement list) knowing that the first element of 'tail' is the successor of every statement in prev_list.
Returns a list of the last statements in tail or prev_list if tail=[].
val process_block : Cil_types.stmt Inthash.t -> Cil_types.block -> Cil_types.kinstr list
Process each statement in blk with no previous statement to begin with
type t = Cil_types.stmt Inthash.t 
Type of the graph
val compute : Kernel_function.t -> Cil_types.stmt Inthash.t
Compute the lexical successor graph for function kf
val find : 'a Inthash.t -> Cil_types.stmt -> 'a
Raises Not_found if 'stmt' has no successor in 'graph'.
Returns the lexical successor of stmt in graph.