package libsail

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val ssa_name : int -> Jib.name -> Jib.name
val unssa_name : Jib.name -> Jib.name * int
type 'a array_graph

A mutable array based graph type, with nodes indexed by integers.

val make : initial_size:int -> unit -> 'a array_graph

Create an empty array_graph, specifying the initial size of the underlying array.

module IntSet = Util.IntSet
val get_cond : 'a array_graph -> int -> Jib.cval
val get_vertex : 'a array_graph -> int -> ('a * IntSet.t * IntSet.t) option
val iter_graph : ('a -> IntSet.t -> IntSet.t -> unit) -> 'a array_graph -> unit
val add_vertex : 'a -> 'a array_graph -> int

Add a vertex to a graph, returning the index of the inserted vertex. If the number of vertices exceeds the size of the underlying array, then it is dynamically resized.

val add_edge : int -> int -> 'a array_graph -> unit

Add an edge between two existing vertices. Raises Invalid_argument if either of the vertices do not exist.

exception Not_a_DAG of int
val topsort : 'a array_graph -> int list
type terminator =
  1. | T_undefined of Jib.ctyp
  2. | T_exit of string
  3. | T_end of Jib.name
  4. | T_goto of string
  5. | T_jump of int * string
  6. | T_label of string
  7. | T_none
type cf_node =
  1. | CF_label of string
  2. | CF_block of Jib.instr list * terminator
  3. | CF_guard of int
  4. | CF_start of Jib.ctyp Jib_util.NameMap.t
  5. | CF_end
val control_flow_graph : Jib.instr list -> int * int * ('a list * cf_node) array_graph
val immediate_dominators : ?post:bool -> 'a array_graph -> int -> int array

immediate_dominators graph root will calculate the immediate dominators for a control flow graph with a specified root node.

type ssa_elem =
  1. | Phi of Jib.name * Jib.ctyp * Jib.name list
  2. | Pi of Jib.cval list
module NameGraph : sig ... end
val phi_dependencies : (ssa_elem list * cf_node) array_graph -> NameGraph.graph * int Jib_util.NameMap.t
val ssa : ?globals:Jib_util.NameSet.t -> ?debug_prefix:string -> Jib.instr list -> int * int * (ssa_elem list * cf_node) array_graph

Convert a list of instructions into SSA form

val make_dot : out_channel -> (ssa_elem list * cf_node) array_graph -> unit

Output the control-flow graph in graphviz format for debugging. Can use 'dot -Tpng X.gv -o X.png' to generate a png image of the graph.

val make_dominators_dot : out_channel -> int array -> (ssa_elem list * cf_node) array_graph -> unit
OCaml

Innovation. Community. Security.