| 1 |
(* block-placement.sml |
| 2 |
* |
| 3 |
* COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies |
| 4 |
*) |
| 5 |
|
| 6 |
functor BlockPlacement |
| 7 |
(structure CFG : CONTROL_FLOW_GRAPH |
| 8 |
structure Props : INSN_PROPERTIES (* where I = CFG.I *) |
| 9 |
where type I.addressing_mode = CFG.I.addressing_mode |
| 10 |
and type I.ea = CFG.I.ea |
| 11 |
and type I.instr = CFG.I.instr |
| 12 |
and type I.instruction = CFG.I.instruction |
| 13 |
and type I.operand = CFG.I.operand |
| 14 |
) : BLOCK_PLACEMENT = |
| 15 |
|
| 16 |
struct |
| 17 |
structure CFG = CFG |
| 18 |
|
| 19 |
structure DefaultPlacement = DefaultBlockPlacement(CFG) |
| 20 |
|
| 21 |
structure WeightedPlacement = |
| 22 |
WeightedBlockPlacementFn |
| 23 |
(structure CFG = CFG |
| 24 |
structure InsnProps = Props) |
| 25 |
|
| 26 |
val placementFlag = MLRiscControl.mkFlag |
| 27 |
("weighted-block-placement", |
| 28 |
"whether MLRISC does weighted block placement") |
| 29 |
|
| 30 |
fun blockPlacement(cfg as Graph.GRAPH G) = |
| 31 |
if !placementFlag |
| 32 |
then WeightedPlacement.blockPlacement cfg |
| 33 |
else DefaultPlacement.blockPlacement cfg |
| 34 |
|
| 35 |
end |