| 1 |
(* |
| 2 |
* Abstract view a flowgraph required by the new register allocator. |
| 3 |
* In order to allow different representation to share the same |
| 4 |
* register allocator core, each representation should implement the |
| 5 |
* following interface to talk to the new RA. |
| 6 |
* |
| 7 |
* -- Allen |
| 8 |
*) |
| 9 |
|
| 10 |
signature RA_FLOWGRAPH = |
| 11 |
sig |
| 12 |
|
| 13 |
structure I : INSTRUCTIONS |
| 14 |
structure C : CELLS |
| 15 |
structure G : RA_GRAPH (* = RAGraph *) |
| 16 |
where type C.CellSet.cellset = RAGraph.C.CellSet.cellset |
| 17 |
and type 'a C.ColorTable.hash_table = 'a RAGraph.C.ColorTable.hash_table |
| 18 |
and type 'a C.HashTable.hash_table = 'a RAGraph.C.HashTable.hash_table |
| 19 |
and type C.SortedCells.sorted_cells = RAGraph.C.SortedCells.sorted_cells |
| 20 |
and type C.cell = RAGraph.C.cell |
| 21 |
and type C.cellColor = RAGraph.C.cellColor |
| 22 |
and type C.cellkind = RAGraph.C.cellkind |
| 23 |
and type C.cellkindDesc = RAGraph.C.cellkindDesc |
| 24 |
and type C.cellkindInfo = RAGraph.C.cellkindInfo |
| 25 |
and type 'a PPtHashTable.hash_table = 'a RAGraph.PPtHashTable.hash_table |
| 26 |
and type 'a SpillLocHashTable.hash_table = 'a RAGraph.SpillLocHashTable.hash_table |
| 27 |
and type interferenceGraph = RAGraph.interferenceGraph |
| 28 |
and type move = RAGraph.move |
| 29 |
and type moveKind = RAGraph.moveKind |
| 30 |
and type moveStatus = RAGraph.moveStatus |
| 31 |
and type node = RAGraph.node |
| 32 |
and type nodeStatus = RAGraph.nodeStatus |
| 33 |
and type spillLoc = RAGraph.spillLoc |
| 34 |
and type trailInfo = RAGraph.trailInfo |
| 35 |
structure Spill : RA_SPILL |
| 36 |
(* sharing Spill.I = I *) |
| 37 |
where type I.addressing_mode = I.addressing_mode |
| 38 |
and type I.ea = I.ea |
| 39 |
and type I.instr = I.instr |
| 40 |
and type I.instruction = I.instruction |
| 41 |
and type I.operand = I.operand |
| 42 |
(* sharing I.C = C *) |
| 43 |
|
| 44 |
type flowgraph |
| 45 |
|
| 46 |
val mode : G.mode |
| 47 |
|
| 48 |
(* Dump the flograph to a stream *) |
| 49 |
val dumpFlowgraph : string * flowgraph * TextIO.outstream -> unit |
| 50 |
|
| 51 |
(* Dump the flograph to a stream *) |
| 52 |
val annotations : flowgraph -> Annotations.annotations ref |
| 53 |
|
| 54 |
(* |
| 55 |
* Interface for communicating with the new register allocator. |
| 56 |
* It is expected that the services will cache enough information |
| 57 |
* during build so that the rebuild and spill phases can be execute |
| 58 |
* quickly. |
| 59 |
*) |
| 60 |
val services : flowgraph -> |
| 61 |
{ build : G.interferenceGraph * CellsBasis.cellkind-> |
| 62 |
G.move list, (* build the graph *) |
| 63 |
spill : {copyInstr : Spill.copyInstr, |
| 64 |
spill : Spill.spill, |
| 65 |
spillSrc : Spill.spillSrc, |
| 66 |
spillCopyTmp : Spill.spillCopyTmp, |
| 67 |
reload : Spill.reload, |
| 68 |
reloadDst : Spill.reloadDst, |
| 69 |
renameSrc : Spill.renameSrc, |
| 70 |
graph : G.interferenceGraph, |
| 71 |
nodes : G.node list, |
| 72 |
cellkind : CellsBasis.cellkind |
| 73 |
} -> G.move list, |
| 74 |
(* spill/rebuild the graph *) |
| 75 |
programPoint : {block:int, instr:int} -> G.programPoint, |
| 76 |
blockNum : G.programPoint -> int, |
| 77 |
instrNum : G.programPoint -> int |
| 78 |
} |
| 79 |
|
| 80 |
end |