Module Js_of_ocaml_compiler.Structure

type graph
type t
val is_backward : t -> Code.Addr.t -> Code.Addr.t -> bool
val is_forward : t -> Code.Addr.t -> Code.Addr.t -> bool

The control flow graph of a function, without the edges build_graph adds to limit the scope of loops and exception handlers

val dominator_tree : t -> graph
val immediate_dominators : t -> Code.Addr.t Js_of_ocaml_compiler.Code.Addr.Hashtbl.t

The immediate dominator of each block, except the entry block

val dominance_frontier : t -> Code.Addr.t Js_of_ocaml_compiler.Code.Addr.Hashtbl.t -> graph

dominance_frontier g idom computes the dominance frontier of each block, given the immediate dominators idom of graph g

val is_merge_node : t -> Code.Addr.t -> bool
val is_loop_header : t -> Code.Addr.t -> bool
val sort_in_post_order : t -> Code.Addr.t list -> Code.Addr.t list
val blocks_in_reverse_post_order : t -> Code.Addr.t list

norm p normalizes a program p to accommodate Structure.build_graph logic. In practice, it ensures that all loops have a predecessor block and allows to exit loops early.