| 1 |
(* |
| 2 |
* This module provides various generic MLTREE transformations. |
| 3 |
* Basically, we want to support various non built-in datatype widths. |
| 4 |
* This module handles the translation. |
| 5 |
* |
| 6 |
* -- Allen |
| 7 |
*) |
| 8 |
signature MLTREEGEN = |
| 9 |
sig |
| 10 |
|
| 11 |
structure T : MLTREE |
| 12 |
structure Size : MLTREE_SIZE (* where T = T *) |
| 13 |
where type T.Basis.cond = T.Basis.cond |
| 14 |
and type T.Basis.div_rounding_mode = T.Basis.div_rounding_mode |
| 15 |
and type T.Basis.ext = T.Basis.ext |
| 16 |
and type T.Basis.fcond = T.Basis.fcond |
| 17 |
and type T.Basis.rounding_mode = T.Basis.rounding_mode |
| 18 |
and type T.Constant.const = T.Constant.const |
| 19 |
and type ('s,'r,'f,'c) T.Extension.ccx = ('s,'r,'f,'c) T.Extension.ccx |
| 20 |
and type ('s,'r,'f,'c) T.Extension.fx = ('s,'r,'f,'c) T.Extension.fx |
| 21 |
and type ('s,'r,'f,'c) T.Extension.rx = ('s,'r,'f,'c) T.Extension.rx |
| 22 |
and type ('s,'r,'f,'c) T.Extension.sx = ('s,'r,'f,'c) T.Extension.sx |
| 23 |
and type T.I.div_rounding_mode = T.I.div_rounding_mode |
| 24 |
and type T.Region.region = T.Region.region |
| 25 |
and type T.ccexp = T.ccexp |
| 26 |
and type T.fexp = T.fexp |
| 27 |
(* and type T.labexp = T.labexp *) |
| 28 |
and type T.mlrisc = T.mlrisc |
| 29 |
and type T.oper = T.oper |
| 30 |
and type T.rep = T.rep |
| 31 |
and type T.rexp = T.rexp |
| 32 |
and type T.stm = T.stm |
| 33 |
|
| 34 |
val condOf : T.ccexp -> T.Basis.cond |
| 35 |
val fcondOf : T.ccexp -> T.Basis.fcond |
| 36 |
|
| 37 |
(* |
| 38 |
* Perform simplification |
| 39 |
*) |
| 40 |
val compileRexp : T.rexp -> T.rexp |
| 41 |
val compileFexp : T.fexp -> T.fexp |
| 42 |
val compileStm : T.stm -> T.stm list |
| 43 |
|
| 44 |
(* |
| 45 |
* Simulate conditional expression. |
| 46 |
*) |
| 47 |
val compileCond : |
| 48 |
{exp : T.ty * T.ccexp * T.rexp * T.rexp, |
| 49 |
an : Annotations.annotations, |
| 50 |
rd : CellsBasis.cell |
| 51 |
} -> T.stm list |
| 52 |
|
| 53 |
val compileFcond : |
| 54 |
{exp : T.fty * T.ccexp * T.fexp * T.fexp, |
| 55 |
an : Annotations.annotations, |
| 56 |
fd : CellsBasis.cell |
| 57 |
} -> T.stm list |
| 58 |
|
| 59 |
|
| 60 |
end |