| 1 |
(* mltreeComp.sig --- translate mltrees to a flowgraph of target machine code. |
| 2 |
* |
| 3 |
* COPYRIGHT (c) 1995 AT&T Bell Laboratories. |
| 4 |
*) |
| 5 |
|
| 6 |
(* |
| 7 |
* This signature describes how MLTree extensions are compiled. |
| 8 |
*) |
| 9 |
signature MLTREE_EXTENSION_COMP = |
| 10 |
sig |
| 11 |
structure T : MLTREE |
| 12 |
structure TS : MLTREE_STREAM (* 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 |
structure I : INSTRUCTIONS |
| 34 |
structure CFG : CONTROL_FLOW_GRAPH (* where I = I and P = TS.S.P *) |
| 35 |
where type I.addressing_mode = I.addressing_mode |
| 36 |
and type I.ea = I.ea |
| 37 |
and type I.instr = I.instr |
| 38 |
and type I.instruction = I.instruction |
| 39 |
and type I.operand = I.operand |
| 40 |
where type P.Client.pseudo_op = TS.S.P.Client.pseudo_op |
| 41 |
and type P.T.Basis.cond = TS.S.P.T.Basis.cond |
| 42 |
and type P.T.Basis.div_rounding_mode = TS.S.P.T.Basis.div_rounding_mode |
| 43 |
and type P.T.Basis.ext = TS.S.P.T.Basis.ext |
| 44 |
and type P.T.Basis.fcond = TS.S.P.T.Basis.fcond |
| 45 |
and type P.T.Basis.rounding_mode = TS.S.P.T.Basis.rounding_mode |
| 46 |
and type P.T.Constant.const = TS.S.P.T.Constant.const |
| 47 |
and type ('s,'r,'f,'c) P.T.Extension.ccx = ('s,'r,'f,'c) TS.S.P.T.Extension.ccx |
| 48 |
and type ('s,'r,'f,'c) P.T.Extension.fx = ('s,'r,'f,'c) TS.S.P.T.Extension.fx |
| 49 |
and type ('s,'r,'f,'c) P.T.Extension.rx = ('s,'r,'f,'c) TS.S.P.T.Extension.rx |
| 50 |
and type ('s,'r,'f,'c) P.T.Extension.sx = ('s,'r,'f,'c) TS.S.P.T.Extension.sx |
| 51 |
and type P.T.I.div_rounding_mode = TS.S.P.T.I.div_rounding_mode |
| 52 |
and type P.T.Region.region = TS.S.P.T.Region.region |
| 53 |
and type P.T.ccexp = TS.S.P.T.ccexp |
| 54 |
and type P.T.fexp = TS.S.P.T.fexp |
| 55 |
(* and type P.T.labexp = TS.S.P.T.labexp *) |
| 56 |
and type P.T.mlrisc = TS.S.P.T.mlrisc |
| 57 |
and type P.T.oper = TS.S.P.T.oper |
| 58 |
and type P.T.rep = TS.S.P.T.rep |
| 59 |
and type P.T.rexp = TS.S.P.T.rexp |
| 60 |
and type P.T.stm = TS.S.P.T.stm |
| 61 |
|
| 62 |
(* |
| 63 |
* The reducer is given to the client during the compilation of |
| 64 |
* the user extensions. |
| 65 |
*) |
| 66 |
type reducer = |
| 67 |
(I.instruction,I.C.cellset,I.operand,I.addressing_mode,CFG.cfg) TS.reducer |
| 68 |
|
| 69 |
val compileSext : reducer -> {stm:T.sext, an:T.an list} -> unit |
| 70 |
val compileRext : reducer -> {e:T.ty * T.rext, rd:CellsBasis.cell, an:T.an list} -> unit |
| 71 |
val compileFext : reducer -> {e:T.ty * T.fext, fd:CellsBasis.cell, an:T.an list} -> unit |
| 72 |
val compileCCext : reducer -> {e:T.ty * T.ccext, ccd:CellsBasis.cell, an:T.an list} -> unit |
| 73 |
end |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
signature MLTREECOMP = |
| 79 |
sig |
| 80 |
structure TS : MLTREE_STREAM |
| 81 |
structure I : INSTRUCTIONS |
| 82 |
structure CFG : CONTROL_FLOW_GRAPH (* where I = I and P = TS.S.P *) |
| 83 |
where type I.addressing_mode = I.addressing_mode |
| 84 |
and type I.ea = I.ea |
| 85 |
and type I.instr = I.instr |
| 86 |
and type I.instruction = I.instruction |
| 87 |
and type I.operand = I.operand |
| 88 |
where type P.Client.pseudo_op = TS.S.P.Client.pseudo_op |
| 89 |
and type P.T.Basis.cond = TS.S.P.T.Basis.cond |
| 90 |
and type P.T.Basis.div_rounding_mode = TS.S.P.T.Basis.div_rounding_mode |
| 91 |
and type P.T.Basis.ext = TS.S.P.T.Basis.ext |
| 92 |
and type P.T.Basis.fcond = TS.S.P.T.Basis.fcond |
| 93 |
and type P.T.Basis.rounding_mode = TS.S.P.T.Basis.rounding_mode |
| 94 |
and type P.T.Constant.const = TS.S.P.T.Constant.const |
| 95 |
and type ('s,'r,'f,'c) P.T.Extension.ccx = ('s,'r,'f,'c) TS.S.P.T.Extension.ccx |
| 96 |
and type ('s,'r,'f,'c) P.T.Extension.fx = ('s,'r,'f,'c) TS.S.P.T.Extension.fx |
| 97 |
and type ('s,'r,'f,'c) P.T.Extension.rx = ('s,'r,'f,'c) TS.S.P.T.Extension.rx |
| 98 |
and type ('s,'r,'f,'c) P.T.Extension.sx = ('s,'r,'f,'c) TS.S.P.T.Extension.sx |
| 99 |
and type P.T.I.div_rounding_mode = TS.S.P.T.I.div_rounding_mode |
| 100 |
and type P.T.Region.region = TS.S.P.T.Region.region |
| 101 |
and type P.T.ccexp = TS.S.P.T.ccexp |
| 102 |
and type P.T.fexp = TS.S.P.T.fexp |
| 103 |
(* and type P.T.labexp = TS.S.P.T.labexp *) |
| 104 |
and type P.T.mlrisc = TS.S.P.T.mlrisc |
| 105 |
and type P.T.oper = TS.S.P.T.oper |
| 106 |
and type P.T.rep = TS.S.P.T.rep |
| 107 |
and type P.T.rexp = TS.S.P.T.rexp |
| 108 |
and type P.T.stm = TS.S.P.T.stm |
| 109 |
structure Gen : MLTREEGEN (* where T = TS.T *) |
| 110 |
where type T.Basis.cond = TS.T.Basis.cond |
| 111 |
and type T.Basis.div_rounding_mode = TS.T.Basis.div_rounding_mode |
| 112 |
and type T.Basis.ext = TS.T.Basis.ext |
| 113 |
and type T.Basis.fcond = TS.T.Basis.fcond |
| 114 |
and type T.Basis.rounding_mode = TS.T.Basis.rounding_mode |
| 115 |
and type T.Constant.const = TS.T.Constant.const |
| 116 |
and type ('s,'r,'f,'c) T.Extension.ccx = ('s,'r,'f,'c) TS.T.Extension.ccx |
| 117 |
and type ('s,'r,'f,'c) T.Extension.fx = ('s,'r,'f,'c) TS.T.Extension.fx |
| 118 |
and type ('s,'r,'f,'c) T.Extension.rx = ('s,'r,'f,'c) TS.T.Extension.rx |
| 119 |
and type ('s,'r,'f,'c) T.Extension.sx = ('s,'r,'f,'c) TS.T.Extension.sx |
| 120 |
and type T.I.div_rounding_mode = TS.T.I.div_rounding_mode |
| 121 |
and type T.Region.region = TS.T.Region.region |
| 122 |
and type T.ccexp = TS.T.ccexp |
| 123 |
and type T.fexp = TS.T.fexp |
| 124 |
(* and type T.labexp = TS.T.labexp *) |
| 125 |
and type T.mlrisc = TS.T.mlrisc |
| 126 |
and type T.oper = TS.T.oper |
| 127 |
and type T.rep = TS.T.rep |
| 128 |
and type T.rexp = TS.T.rexp |
| 129 |
and type T.stm = TS.T.stm |
| 130 |
|
| 131 |
type instrStream = (I.instruction, I.C.cellset, CFG.cfg) TS.stream |
| 132 |
type mltreeStream = (TS.T.stm, TS.T.mlrisc list, CFG.cfg) TS.stream |
| 133 |
|
| 134 |
(* |
| 135 |
* The instruction selection phase converts an instruction stream |
| 136 |
* into a mltree stream. Please see the file "instructions/stream.sig" |
| 137 |
* for description of the stream interface. |
| 138 |
* |
| 139 |
* Note: the mltree stream does NOT support direct instruction emission. |
| 140 |
* Fo equivalent functionality, you can use the emit method |
| 141 |
* of the instruction stream instead. |
| 142 |
*) |
| 143 |
val selectInstructions : instrStream -> mltreeStream |
| 144 |
end |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|