WTO: use a partial ProcCfg

Reviewed By: jberdine

Differential Revision: D10376574

fbshipit-source-id: 09e0f0ca5
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent dd2b9675d6
commit 0d4c06efc5

@ -260,7 +260,9 @@ end
module MakeWithWTO module MakeWithWTO
(WTO : WeakTopologicalOrder.S) (WTO : WeakTopologicalOrder.S)
(TransferFunctions : TransferFunctions.SIL with module CFG = WTO.CFG) = (TransferFunctions : TransferFunctions.SIL
with type CFG.t = WTO.CFG.t
and type CFG.Node.t = WTO.CFG.Node.t) =
struct struct
include AbstractInterpreterCommon (TransferFunctions) include AbstractInterpreterCommon (TransferFunctions)

@ -34,15 +34,33 @@ module Partition = struct
let pp ~pp_node = pp ~prefix:"" ~pp_node let pp ~pp_node = pp ~prefix:"" ~pp_node
end end
module type PreProcCfg = sig
module Node : sig
type t
type id
val id : t -> id
module IdMap : PrettyPrintable.PPMap with type key = id
end
type t
val fold_succs : t -> (Node.t, Node.t, 'accum) Container.fold
val start_node : t -> Node.t
end
module type S = sig module type S = sig
module CFG : ProcCfg.S module CFG : PreProcCfg
val make : CFG.t -> CFG.Node.t Partition.t val make : CFG.t -> CFG.Node.t Partition.t
end end
module type Make = functor (CFG : ProcCfg.S) -> S with module CFG = CFG module type Make = functor (CFG : PreProcCfg) -> S with module CFG = CFG
module Bourdoncle_SCC (CFG : ProcCfg.S) = struct module Bourdoncle_SCC (CFG : PreProcCfg) = struct
module CFG = CFG module CFG = CFG
(** (**

@ -29,6 +29,24 @@ module Partition : sig
val pp : pp_node:(F.formatter -> 'node -> unit) -> F.formatter -> 'node t -> unit val pp : pp_node:(F.formatter -> 'node -> unit) -> F.formatter -> 'node t -> unit
end end
module type PreProcCfg = sig
module Node : sig
type t
type id
val id : t -> id
module IdMap : PrettyPrintable.PPMap with type key = id
end
type t
val fold_succs : t -> (Node.t, Node.t, 'accum) Container.fold
val start_node : t -> Node.t
end
(** (**
A weak topological ordering (WTO) of a directed graph is a hierarchical ordering of its vertices A weak topological ordering (WTO) of a directed graph is a hierarchical ordering of its vertices
such that for every edge u -> v, such that for every edge u -> v,
@ -41,12 +59,12 @@ end
*) *)
module type S = sig module type S = sig
module CFG : ProcCfg.S module CFG : PreProcCfg
val make : CFG.t -> CFG.Node.t Partition.t val make : CFG.t -> CFG.Node.t Partition.t
end end
module type Make = functor (CFG : ProcCfg.S) -> S with module CFG = CFG module type Make = functor (CFG : PreProcCfg) -> S with module CFG = CFG
(** (**
Implementation of Bourdoncle's "Hierarchical decomposition of a directed graph into strongly Implementation of Bourdoncle's "Hierarchical decomposition of a directed graph into strongly

Loading…
Cancel
Save