Debian Codegraph @

lib/mlrisc-lib/MLRISC/IR/mlrisc-ir.sig

raw
1 (*
2 * MLRISC IR
3 *
4 * This is for performing whole program analysis.
5 * All optimizations are based on this representation.
6 * It provides a few useful views: dominator tree, control dependence graph,
7 * loop nesting (interval) structure etc. Also there is a mechanism to
8 * incrementally attach additional views to the IR. The SSA infrastructure
9 * is implemented in such a manner.
10 *
11 * -- Allen
12 *)
13
14 signature MLRISC_IR =
15 sig
16
17 structure I : INSTRUCTIONS
18 structure CFG : CONTROL_FLOW_GRAPH
19 structure Dom : DOMINATOR_TREE
20 structure CDG : CONTROL_DEPENDENCE_GRAPH
21 structure Loop : LOOP_STRUCTURE
22 structure Util : CFG_UTIL
23 sharing Util.CFG = CFG
24 sharing CFG.I = I
25 sharing Loop.Dom = CDG.Dom = Dom
26
27 type cfg = CFG.cfg
28 type IR = CFG.cfg (* The IR looks just like a CFG! *)
29 type dom = (CFG.block,CFG.edge_info,CFG.info) Dom.dominator_tree
30 type pdom = (CFG.block,CFG.edge_info,CFG.info) Dom.postdominator_tree
31 type cdg = (CFG.block,CFG.edge_info,CFG.info) CDG.cdg
32 type loop = (CFG.block,CFG.edge_info,CFG.info) Loop.loop_structure
33
34 (*
35 * Extract various views from an IR.
36 * These are computed by need.
37 *)
38 val dom : IR -> dom
39 val pdom : IR -> pdom
40 val doms : IR -> dom * pdom
41 val cdg : IR -> cdg
42 val loop : IR -> loop
43
44 (*
45 * Signal that the IR has been changed
46 *)
47 val changed : IR -> unit
48
49 (*
50 * View as a picture
51 *)
52 val view : string -> IR -> unit (* view some facet of the IR *)
53 val views : string list -> IR -> unit (* view a set of facets *)
54 val viewSubgraph : IR -> cfg -> unit (* view a subgraph of the IR *)
55
56 (*
57 * This function allows the client to design a new view and extend
58 * the functionality of the IR
59 *)
60 val memo : string -> (IR -> 'facet) -> IR -> 'facet
61 val addLayout : string -> (IR -> GraphLayout.layout) -> unit
62
63 end
64