| 1 |
(* |
| 2 |
* This module is responsible for generating new instructions from |
| 3 |
* MLTREE and inserting them into the SSA graph. This is useful for |
| 4 |
* patching in new instructions as the SSA graph is being transformed. |
| 5 |
* |
| 6 |
* Special MLRISC Magic(tm) for invoking the instruction selection |
| 7 |
* module and ssa-ifying the output code are all hidden here. |
| 8 |
* |
| 9 |
* -- Allen ([email protected]) |
| 10 |
* |
| 11 |
*) |
| 12 |
signature SSA_INSTRGEN = |
| 13 |
sig |
| 14 |
|
| 15 |
structure SSA : SSA |
| 16 |
structure RTL : MLTREE_RTL |
| 17 |
structure MLTreeComp : MLTREECOMP |
| 18 |
sharing SSA.MLTreeComp = MLTreeComp |
| 19 |
sharing SSA.RTL = RTL |
| 20 |
|
| 21 |
exception Illegal |
| 22 |
|
| 23 |
(* Convert internal RTL into a mltree term *) |
| 24 |
val translate : SSA.ssa -> |
| 25 |
{rtl:RTL.rtl, defs:SSA.value list, uses:SSA.value list} -> |
| 26 |
MLTreeComp.T.stm |
| 27 |
(* Convert an mltree term into a list of instructions *) |
| 28 |
val instrGen : SSA.ssa -> MLTreeComp.T.stm -> SSA.I.instruction list |
| 29 |
|
| 30 |
(* Insert instructions into the SSA graph *) |
| 31 |
|
| 32 |
(* Replace the instruction at id *) |
| 33 |
val replace : SSA.ssa -> {id:SSA.ssa_id, mltree:MLTreeComp.T.stm} -> bool |
| 34 |
|
| 35 |
end |