module Llvmcfg:sig
..end
This module allows to extract and manipulate a graph representing an llvm function with nodes representing the basicblocks.
The graph is persistent so that it's possible to transform the representation to perform analysis without modifying Llvm's IR.
type
vertex_ = private {
|
id : |
|
block : |
|
phi : |
|
instr : |
include Graph.Sig.P
val vertex : block:Llvm.llbasicblock ->
phi:Llvm.llvalue list -> instr:Llvm.llvalue list -> V.t
val of_llfunction : Llvm.llvalue -> (Llvm.llbasicblock -> vertex) * t
Returns a couple (f, g)
where g
is the graph and f
associate
an llvm basic bloc to a node in the graph.
val basicblocks_to_vertices : t -> Llvm.llbasicblock list -> vertex list
module Dot:sig
..end
exception Not_reducible of t
val break_graph : ?start:vertex -> t -> Llvm.llbasicblock list * t
Each broken node is separated in two parts:
A graph must be reducible for the algorithm to apply (which should be the case for all llvm's graphs) and the function will raise Llvmcfg.Not_reducible
otherwise.
val break_by_list : t -> vertex list -> t
Llvmcfg.break_graph
, but allows the user to provide the list of node to be broken.Invalid_argument
if one of the node is not in the graph.