SCM Repository
Annotation of /sml/trunk/src/MLRISC/ra/ra-core.sig
Parent Directory
|
Revision Log
Revision 475 -
(view)
(download)
(as text)
Original Path: sml/branches/SMLNJ/src/MLRISC/ra/ra-core.sig
1 : | monnier | 469 | (* |
2 : | * Note: This is the core of the new register allocator, i.e. the portion | ||
3 : | * that manipulates only the interference graph and not the flowgraph. | ||
4 : | * | ||
5 : | * -- Allen | ||
6 : | *) | ||
7 : | monnier | 427 | |
8 : | signature RA_CORE = | ||
9 : | sig | ||
10 : | |||
11 : | monnier | 469 | structure G : RA_GRAPH |
12 : | monnier | 427 | |
13 : | monnier | 469 | type move_queue |
14 : | type freeze_queue | ||
15 : | |||
16 : | monnier | 427 | (* |
17 : | * Basic functions | ||
18 : | *) | ||
19 : | monnier | 469 | |
20 : | (* dump the interference graph to a stream *) | ||
21 : | val dumpGraph : G.interferenceGraph -> TextIO.outstream -> unit | ||
22 : | val show : G.interferenceGraph -> G.node -> string | ||
23 : | |||
24 : | (* add an edge to the interference graph *) | ||
25 : | monnier | 427 | val addEdge : G.interferenceGraph -> G.node * G.node -> unit |
26 : | |||
27 : | monnier | 469 | (* remove an edge from the interference graph *) |
28 : | val removeEdge : G.interferenceGraph -> G.node * G.node -> unit | ||
29 : | monnier | 427 | |
30 : | monnier | 469 | (* |
31 : | * Function to create new nodes | ||
32 : | *) | ||
33 : | val newNodes : G.interferenceGraph -> | ||
34 : | {cost:int,pt:G.programPoint,defs:int list,uses:int list} -> | ||
35 : | G.node list (* defs *) | ||
36 : | |||
37 : | (* | ||
38 : | * Update regmap after finishing register allocation or copy propagation | ||
39 : | *) | ||
40 : | val finishRA : G.interferenceGraph -> unit | ||
41 : | val finishCP : G.interferenceGraph -> unit | ||
42 : | |||
43 : | (* | ||
44 : | * Create an initial set of worklists from a new interference graph | ||
45 : | * and a list of moves | ||
46 : | *) | ||
47 : | val initWorkLists : G.interferenceGraph -> | ||
48 : | { moves : G.move list, | ||
49 : | deadCopyElim : bool | ||
50 : | } -> | ||
51 : | { simplifyWkl : G.node list, | ||
52 : | moveWkl : move_queue, | ||
53 : | freezeWkl : freeze_queue, | ||
54 : | spillWkl : G.node list (* high degreee nodes *) | ||
55 : | } | ||
56 : | |||
57 : | (* | ||
58 : | * Clear the interference graph but keep the nodes table intact | ||
59 : | *) | ||
60 : | val clearGraph : G.interferenceGraph -> unit | ||
61 : | |||
62 : | (* | ||
63 : | * Remove all adjacency lists from the nodes table | ||
64 : | *) | ||
65 : | val clearNodes : G.interferenceGraph -> unit | ||
66 : | |||
67 : | (* | ||
68 : | * Return a regmap function that reflects the current interference graph. | ||
69 : | * Spilled registers are given the special value ~1 | ||
70 : | *) | ||
71 : | val regmap : G.interferenceGraph -> (int -> int) | ||
72 : | val spillRegmap : G.interferenceGraph -> (int -> int) | ||
73 : | val spillLoc : G.interferenceGraph -> (int -> int) | ||
74 : | |||
75 : | monnier | 427 | (* |
76 : | monnier | 469 | * Simplify, Coalease and Freeze until the work list is done |
77 : | monnier | 427 | *) |
78 : | monnier | 469 | val iteratedCoalescing : |
79 : | G.interferenceGraph -> | ||
80 : | { simplifyWkl : G.node list, | ||
81 : | moveWkl : move_queue, | ||
82 : | freezeWkl : freeze_queue, | ||
83 : | stack : G.node list | ||
84 : | } -> | ||
85 : | { stack : G.node list | ||
86 : | } | ||
87 : | monnier | 427 | |
88 : | monnier | 469 | (* |
89 : | * potentially spill a node. | ||
90 : | *) | ||
91 : | val potentialSpillNode : | ||
92 : | G.interferenceGraph -> | ||
93 : | { node : G.node, | ||
94 : | stack : G.node list | ||
95 : | } -> | ||
96 : | { moveWkl : move_queue, | ||
97 : | freezeWkl : freeze_queue, | ||
98 : | stack : G.node list | ||
99 : | } | ||
100 : | monnier | 427 | |
101 : | monnier | 469 | (* |
102 : | * Color nodes on the stack, using Briggs' optimistic spilling. | ||
103 : | * Return a list of actual spills | ||
104 : | *) | ||
105 : | val select : | ||
106 : | G.interferenceGraph -> | ||
107 : | { biased : bool, (* use biased coloring too? *) | ||
108 : | stack : G.node list | ||
109 : | } -> | ||
110 : | { spills : G.node list (* actual spills *) | ||
111 : | } | ||
112 : | monnier | 427 | |
113 : | monnier | 469 | (* |
114 : | monnier | 475 | * Spill propagation/coalescing phase |
115 : | monnier | 469 | *) |
116 : | monnier | 475 | val spillPropagation : G.interferenceGraph -> G.node list -> G.node list |
117 : | monnier | 469 | |
118 : | (* | ||
119 : | monnier | 475 | * Spill coalescing phase |
120 : | monnier | 469 | *) |
121 : | monnier | 475 | val spillCoalescing : G.interferenceGraph -> G.node list -> unit |
122 : | monnier | 469 | |
123 : | monnier | 475 | (* |
124 : | * Spill coloring phase | ||
125 : | *) | ||
126 : | val spillColoring : G.interferenceGraph -> G.node list -> unit | ||
127 : | |||
128 : | monnier | 427 | end |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |