Module Dominators

module Dominators: sig .. end
Compute dominators using data flow analysis.
Author(s): George Necula


complete rewrite in order not to rely on data flow analysis (bad time-complexity). Now based on "A Simple, Fast Dominance Algorithm" by K. D. Cooper et al
val computeIDom : Cil_types.fundec -> Cil_types.stmt option Datatype.Int.Hashtbl.t
Invoke on a code after filling in the CFG info and it computes the immediate dominator information. We map each statement to its immediate dominator (None for the start statement, and for the unreachable statements).
val getIdom : Cil_types.stmt option Datatype.Int.Hashtbl.t ->
Cil_types.stmt -> Cil_types.stmt option
This is like Datatype.Int.Hashtbl.find but gives an error if the information is Not_found
val dominates : Cil_types.stmt option Datatype.Int.Hashtbl.t ->
Cil_types.stmt -> Cil_types.stmt -> bool
Check whether one statement dominates another.
val findNaturalLoops : Cil_types.fundec ->
Cil_types.stmt option Datatype.Int.Hashtbl.t ->
(Cil_types.stmt * Cil_types.stmt list) list
Compute the start of the natural loops. This assumes that the "idom" field has been computed. For each start, keep a list of origin of a back edge. The loop consists of the loop start and all predecessors of the origins of back edges, up to and including the loop start