Debian Codegraph @

lib/mlrisc-lib/MLRISC/scheduling/globalDDGViewer.sml

raw
1 (*
2 * View a scheduler DDG constructed for basic block scheduling
3 *
4 * -- Allen
5 *)
6 functor GlobalSchedulerDDGViewer
7 (structure GraphViewer : GRAPH_VIEWER
8 structure IR : MLRISC_IR
9 structure DDG : SCHEDULER_DDG
10 structure FormatInsn : FORMAT_INSTRUCTION
11 sharing IR.I = FormatInsn.I = DDG.I
12 ) : GLOBAL_SCHEDULER_DDG_VIEWER =
13 struct
14
15 structure IR = IR
16 structure DDG = DDG
17 structure I = DDG.I
18 structure L = GraphLayout
19
20 val edgeColor = L.COLOR "red"
21
22 val i2s = Int.toString
23
24
25 fun view IR ddg =
26 let val regmap = IR.CFG.regmap IR
27 val toString = FormatInsn.toString [] (I.C.lookup regmap)
28 in GraphViewer.view
29 (GraphLayout.makeLayout
30 {graph = fn _ => [],
31 node = fn (_,DDG.NODE{instr,b,...}) =>
32 [L.LABEL("["^i2s b^"] "^toString instr)],
33 edge = fn (_,_,e) => [L.LABEL(DDG.edgeToString e), edgeColor]
34 }
35 ddg
36 )
37 end
38
39 end