| 1 |
(* |
| 2 |
* This signature abstracts out the capability of the flowgraph |
| 3 |
* used in the SSA infrastruture. This way makes it easier to |
| 4 |
* substitute another CFG implementation in the future. |
| 5 |
* |
| 6 |
* -- Allen ([email protected]) |
| 7 |
*) |
| 8 |
signature SSA_FLOWGRAPH = |
| 9 |
sig |
| 10 |
|
| 11 |
structure I : INSTRUCTIONS |
| 12 |
structure W : FREQ |
| 13 |
|
| 14 |
type info (* graph info *) |
| 15 |
type block (* basic block type *) |
| 16 |
type edge_info (* edge information *) |
| 17 |
type cfg = (block, edge_info, info) Graph.graph (* the cfg *) |
| 18 |
|
| 19 |
(* |
| 20 |
* Operations on the cfg |
| 21 |
*) |
| 22 |
val regmap : cfg -> I.C.regmap |
| 23 |
val annotations : cfg -> Annotations.annotations ref |
| 24 |
|
| 25 |
(* |
| 26 |
* Operations on basic blocks |
| 27 |
*) |
| 28 |
val headerText : block -> string |
| 29 |
val insns : block -> I.instruction list ref |
| 30 |
val freq : block -> W.freq ref |
| 31 |
val liveOut : block -> I.C.cellset |
| 32 |
|
| 33 |
(* |
| 34 |
* Operations on edges |
| 35 |
*) |
| 36 |
val setBranch : cfg * Graph.node_id * bool -> I.instruction |
| 37 |
val branchOf : edge_info -> bool option |
| 38 |
|
| 39 |
(* |
| 40 |
* Viewing |
| 41 |
*) |
| 42 |
val viewStyle : cfg -> (block, edge_info, info) GraphLayout.style |
| 43 |
|
| 44 |
end |
| 45 |
|
| 46 |
signature SSA_FLOWGRAPH_LIVENESS = |
| 47 |
sig |
| 48 |
|
| 49 |
structure CFG : SSA_FLOWGRAPH |
| 50 |
structure I : INSTRUCTIONS |
| 51 |
sharing CFG.I = I |
| 52 |
|
| 53 |
val liveness : |
| 54 |
{ cfg : CFG.cfg, |
| 55 |
liveOut : CFG.block Graph.node -> I.C.cell list, |
| 56 |
defUse : CFG.block Graph.node -> I.C.cell list * I.C.cell list |
| 57 |
} -> unit |
| 58 |
|
| 59 |
val getLiveness : CFG.cfg -> Graph.node_id -> |
| 60 |
{livein: I.C.cell list, liveout: I.C.cell list} |
| 61 |
|
| 62 |
end |