c57b71b6aa
- Added Boolean module (enum types to boolean vectors) - Added Hept_clocking analysis, called before Boolean - Added z3z target from minils (sigali format) - Bug corrections in Normalize, Normalize_mem Conflicts: compiler/heptagon/analysis/typing.ml compiler/heptagon/heptagon.ml compiler/heptagon/parsing/hept_parser.mly compiler/heptagon/parsing/hept_parsetree.ml compiler/heptagon/parsing/hept_scoping.ml compiler/main/hept2mls.ml compiler/main/heptc.ml compiler/main/mls2seq.ml compiler/minils/minils.ml compiler/minils/transformations/normalize_mem.ml test/check
53 lines
1.3 KiB
OCaml
53 lines
1.3 KiB
OCaml
open Graph
|
|
open Interference_graph
|
|
|
|
(** Printing *)
|
|
|
|
module DotG = struct
|
|
include G
|
|
|
|
let name = ref ""
|
|
|
|
let color_to_graphviz_color i =
|
|
(* (i * 8364263947 + 855784368) *)
|
|
(i * 2 + 1)
|
|
|
|
(*Functions for printing the graph *)
|
|
let default_vertex_attributes _ = []
|
|
let default_edge_attributes _ = []
|
|
let get_subgraph _ = None
|
|
|
|
let graph_attributes _ =
|
|
[`Label !name]
|
|
|
|
let vertex_name v =
|
|
let rec ivar_name iv =
|
|
match iv with
|
|
| Ivar id -> Idents.name id
|
|
| Ifield(ivar, f) -> (ivar_name ivar)^"_"^(Names.shortname f)
|
|
in
|
|
Misc.sanitize_string (ivar_name (List.hd !(V.label v)))
|
|
|
|
let vertex_attributes v =
|
|
let s = String.concat ", " (List.map (fun iv -> ivar_to_string iv) !(V.label v)) in
|
|
[`Label s; `Color (color_to_graphviz_color (Mark.get v))]
|
|
|
|
let edge_attributes e =
|
|
let style =
|
|
match E.label e with
|
|
| Iinterference -> `Solid
|
|
| Iaffinity -> `Dashed
|
|
| Isame_value -> `Dotted
|
|
in
|
|
[`Style style; `Dir `None]
|
|
end
|
|
|
|
module DotPrint = Graphviz.Dot(DotG)
|
|
|
|
let print_graph label filename g =
|
|
Global_printer.print_type Format.str_formatter g.g_type;
|
|
let ty_str = Format.flush_str_formatter () in
|
|
DotG.name := label^" : "^ty_str;
|
|
let oc = open_out (filename ^ ".dot") in
|
|
DotPrint.output_graph oc g.g_graph;
|
|
close_out oc
|