Cfg.AstExtends the simple Universal language with Control Flow Graphs.
module Loc : sig ... endmodule TagLoc : sig ... endmodule Range : sig ... endmodule Port : sig ... endmodule LocSet : sig ... endmodule LocMap : sig ... endmodule LocHash : sig ... endmodule TagLocSet : sig ... endmodule TagLocMap : sig ... endmodule TagLocHash : sig ... endmodule RangeSet : sig ... endmodule RangeMap : sig ... endmodule RangeHash : sig ... endmodule CFG_Param : sig ... endBuild CFG module.
module CFG : sig ... endtype graph = (unit, MopsaLib.stmt) CFG.graphEdges are labelled with a statement. Nodes have no information in the graph structure. Abstract invariant information will be kept in maps separately from the CFG. This way, CFG can be kept immutable.
type node = (unit, MopsaLib.stmt) CFG.nodetype edge = (unit, MopsaLib.stmt) CFG.edgetype node_id = TagLoc.ttype edge_id = Range.ttype port = MopsaLib.tokentype cfg = {cfg_graph : graph;mutable cfg_order : node Mopsa_utils.Containers.GraphSig.nested_list list;}val fresh_node_id : int LocHash.tFresh node with some source location information. NOTE: Do not mix mk_fresh_node_id and mk_node_id as it can break uniqueness.
val loc_anonymous : Loc.tval mk_anonymous_node_id : ?tag:string -> unit -> node_idFresh node without any source location information.
val pp_node_id : Format.formatter -> TagLoc.t -> unitval pp_node_as_id : Format.formatter -> ('a, 'b) CFG.node -> unitval mk_edge_id : ?tag:string -> MopsaLib.range -> edge_idval fresh_edge_id : int RangeHash.tval mk_fresh_edge_id : ?tag:string -> MopsaLib.range -> edge_idFresh range with possible some source range information. NOTE: Do not mix mk_fresh_edge_id and mk_edge_id as it can break uniqueness.
val mk_anonymous_edge_id : ?tag:string -> unit -> edge_idFresh range without any source range information.
val edge_range : edge_id -> MopsaLib.rangeval pp_edge_id : Format.formatter -> MopsaLib.range -> unitval pp_edge_as_id : Format.formatter -> ('a, 'b) CFG.edge -> unitval compare_edge_id : MopsaLib.range -> MopsaLib.range -> inttype MopsaLib.token += Associate a flow to each CFG node. We can store abstract information for the whole graph in a single abstract state, using node flows. We also associate a flow to cache the post-image of each CFG edge.
Flow for true and false branch of tests.
type MopsaLib.stmt_kind += | S_cfg of cfg| S_test of MopsaLib.exprtest nodes, with a true and a false branch
*)| S_skipempty node
*)val mk_skip : Mopsa_utils.Core.Location.range -> MopsaLib.stmtval mk_test : MopsaLib.expr -> Mopsa_utils.Core.Location.range -> MopsaLib.stmtval mk_cfg : cfg -> Mopsa_utils.Core.Location.range -> MopsaLib.stmt