Debian Codegraph @

lib/mlrisc-lib/MLRISC/scheduling/schedulerDDG.sig

raw
1 (*
2 * This interface describes a DDG for acyclic global scheduling
3 * (for non-predicated architectures.)
4 * Hyperblock scheduling uses another data structure.
5 *
6 * -- Allen
7 *)
8 signature SCHEDULER_DDG =
9 sig
10
11 structure I : INSTRUCTIONS
12 structure C : CELLS
13 structure SchedProps : SCHEDULING_PROPERTIES
14 sharing SchedProps.I = I
15 sharing I.C = C
16
17 (* Dependence type *)
18 datatype dependence =
19 FLOW | OUTPUT | ANTI (* register based dependence *)
20 | MEM_FLOW | MEM_OUTPUT | MEM_ANTI (* memory based dependence *)
21 | CTRL | CTRL_ANTI (* control dependence *)
22 | LIVEIN | LIVEOUT
23
24 type latency = SchedProps.latency
25
26 datatype edge = EDGE of {l : latency, (* latency *)
27 r : C.cell, (* register *)
28 d : dependence (* dependence type *)
29 }
30
31 datatype node = NODE of {instr: I.instruction, b:int,
32 defs:(C.cell * latency) list, uses:C.cell list}
33
34 type ('node,'edge) info
35
36 (* The actual ddg is parameterized with respect to the node and edge type.
37 * For local scheduling 'node = instruction and 'edge = latency
38 * For global scheduling 'node = node and 'edge = edge
39 *)
40 type ('node,'edge) ddg = ('node,'edge,('node,'edge) info) Graph.graph
41 type block = int
42 type blockMap = block Array.array (* mapping from block id -> block *)
43 type liveInMap = node Graph.node IntHashTable.hash_table
44 type liveOutMap = node Graph.node IntHashTable.hash_table
45
46 type ('node,'edge) internalInfo =
47 {succ : 'edge Graph.edge list Array.array,
48 pred : 'edge Graph.edge list Array.array,
49 nodes : 'node option Array.array
50 }
51
52 type globalInfo =
53 {liveInMap : liveInMap,
54 liveOutMap : liveOutMap,
55 blockMap : blockMap
56 }
57
58 (* Create an empty DDG with a maximum number of nodes.
59 * At the same time return its internal adjlist representation.
60 * Just in we want to make the scheduler work fast.
61 *)
62 val newDDG : int -> ('node,'edge) ddg
63 val internalInfo : ('node,'edge) ddg -> ('node,'edge) internalInfo
64 val globalInfo : ('node,'edge) ddg -> globalInfo option ref
65
66 (* pretty print an edge (useful for graphical display) *)
67 val edgeToString : edge -> string
68
69 (* liveness annotation *)
70 val LIVENESS : {liveIn:C.cell list, liveOut:C.cell list} Annotations.property
71
72 end