Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/branches/idlbasis-devel/src/MLRISC/ppc/emit/ppcMC.sml
ViewVC logotype

Annotation of /sml/branches/idlbasis-devel/src/MLRISC/ppc/emit/ppcMC.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1232 - (view) (download)

1 : monnier 411 (*
2 : leunga 744 * WARNING: This file was automatically generated by MDLGen (v3.0)
3 :     * from the machine description file "ppc/ppc.mdl".
4 :     * DO NOT EDIT this file directly
5 : monnier 245 *)
6 :    
7 :    
8 : monnier 411 functor PPCMCEmitter(structure Instr : PPCINSTR
9 : blume 1002 structure MLTreeEval : MLTREE_EVAL where T = Instr.T
10 :     structure Stream : INSTRUCTION_STREAM
11 : monnier 411 structure CodeString : CODE_STRING
12 :     ) : INSTRUCTION_EMITTER =
13 : monnier 245 struct
14 : monnier 411 structure I = Instr
15 :     structure C = I.C
16 :     structure Constant = I.Constant
17 : leunga 775 structure T = I.T
18 : blume 1002 structure S = Stream
19 : monnier 411 structure P = S.P
20 :     structure W = Word32
21 :    
22 : george 545 (* PPC is big endian *)
23 : monnier 411
24 :     fun error msg = MLRiscErrorMsg.error("PPCMC",msg)
25 : monnier 429 fun makeStream _ =
26 : monnier 411 let infix && || << >> ~>>
27 :     val op << = W.<<
28 :     val op >> = W.>>
29 :     val op ~>> = W.~>>
30 :     val op || = W.orb
31 :     val op && = W.andb
32 :     val itow = W.fromInt
33 :     fun emit_bool false = 0w0 : W.word
34 :     | emit_bool true = 0w1 : W.word
35 :     val emit_int = itow
36 :     fun emit_word w = w
37 :     fun emit_label l = itow(Label.addrOf l)
38 : blume 1002 fun emit_labexp le = itow(MLTreeEval.valueOf le)
39 : monnier 411 fun emit_const c = itow(Constant.valueOf c)
40 :     val loc = ref 0
41 :    
42 :     (* emit a byte *)
43 :     fun eByte b =
44 :     let val i = !loc in loc := i + 1; CodeString.update(i,b) end
45 :    
46 :     (* emit the low order byte of a word *)
47 :     (* note: fromLargeWord strips the high order bits! *)
48 :     fun eByteW w =
49 :     let val i = !loc
50 :     in loc := i + 1; CodeString.update(i,Word8.fromLargeWord w) end
51 :    
52 :     fun doNothing _ = ()
53 : blume 1002 fun fail _ = raise Fail "MCEmitter"
54 : blume 859 fun getAnnotations () = error "getAnnotations"
55 : monnier 411
56 :     fun pseudoOp pOp = P.emitValue{pOp=pOp, loc= !loc,emit=eByte}
57 :    
58 :     fun init n = (CodeString.init n; loc := 0)
59 :    
60 :    
61 : leunga 744 fun eWord32 w =
62 :     let val b8 = w
63 :     val w = w >> 0wx8
64 :     val b16 = w
65 :     val w = w >> 0wx8
66 :     val b24 = w
67 :     val w = w >> 0wx8
68 :     val b32 = w
69 : monnier 411 in
70 : george 545 ( eByteW b32;
71 : leunga 744 eByteW b24;
72 :     eByteW b16;
73 :     eByteW b8 )
74 : monnier 411 end
75 : blume 1002 fun emit_GP r = itow (CellsBasis.physicalRegisterNum r)
76 :     and emit_FP r = itow (CellsBasis.physicalRegisterNum r)
77 :     and emit_CC r = itow (CellsBasis.physicalRegisterNum r)
78 :     and emit_SPR r = itow (CellsBasis.physicalRegisterNum r)
79 :     and emit_MEM r = itow (CellsBasis.physicalRegisterNum r)
80 :     and emit_CTRL r = itow (CellsBasis.physicalRegisterNum r)
81 :     and emit_CELLSET r = itow (CellsBasis.physicalRegisterNum r)
82 : george 545 fun emit_operand (I.RegOp GP) = emit_GP GP
83 :     | emit_operand (I.ImmedOp int) = itow int
84 : blume 1002 | emit_operand (I.LabelOp labexp) = itow (MLTreeEval.valueOf labexp)
85 : george 545 and emit_fcmp (I.FCMPO) = (0wx20 : Word32.word)
86 :     | emit_fcmp (I.FCMPU) = (0wx0 : Word32.word)
87 :     and emit_unary (I.NEG) = (0wx68 : Word32.word)
88 : monnier 429 | emit_unary (I.EXTSB) = (0wx3ba : Word32.word)
89 :     | emit_unary (I.EXTSH) = (0wx39a : Word32.word)
90 :     | emit_unary (I.EXTSW) = (0wx3da : Word32.word)
91 :     | emit_unary (I.CNTLZW) = (0wx1a : Word32.word)
92 :     | emit_unary (I.CNTLZD) = (0wx3a : Word32.word)
93 :     and emit_funary (I.FMR) = (0wx3f, 0wx48)
94 :     | emit_funary (I.FNEG) = (0wx3f, 0wx28)
95 :     | emit_funary (I.FABS) = (0wx3f, 0wx108)
96 :     | emit_funary (I.FNABS) = (0wx3f, 0wx88)
97 :     | emit_funary (I.FSQRT) = (0wx3f, 0wx16)
98 :     | emit_funary (I.FSQRTS) = (0wx3b, 0wx16)
99 :     | emit_funary (I.FRSP) = (0wx3f, 0wxc)
100 :     | emit_funary (I.FCTIW) = (0wx3f, 0wxe)
101 :     | emit_funary (I.FCTIWZ) = (0wx3f, 0wxf)
102 :     | emit_funary (I.FCTID) = (0wx3f, 0wx32e)
103 :     | emit_funary (I.FCTIDZ) = (0wx3f, 0wx32f)
104 :     | emit_funary (I.FCFID) = (0wx3f, 0wx34e)
105 : george 545 and emit_farith (I.FADD) = (0wx3f, 0wx15)
106 :     | emit_farith (I.FSUB) = (0wx3f, 0wx14)
107 :     | emit_farith (I.FMUL) = (0wx3f, 0wx19)
108 :     | emit_farith (I.FDIV) = (0wx3f, 0wx12)
109 :     | emit_farith (I.FADDS) = (0wx3b, 0wx15)
110 :     | emit_farith (I.FSUBS) = (0wx3b, 0wx14)
111 :     | emit_farith (I.FMULS) = (0wx3b, 0wx19)
112 :     | emit_farith (I.FDIVS) = (0wx3b, 0wx12)
113 :     and emit_farith3 (I.FMADD) = (0wx3f, 0wx1d)
114 :     | emit_farith3 (I.FMADDS) = (0wx3b, 0wx1d)
115 :     | emit_farith3 (I.FMSUB) = (0wx3f, 0wx1c)
116 :     | emit_farith3 (I.FMSUBS) = (0wx3b, 0wx1c)
117 :     | emit_farith3 (I.FNMADD) = (0wx3f, 0wx1f)
118 :     | emit_farith3 (I.FNMADDS) = (0wx3b, 0wx1f)
119 :     | emit_farith3 (I.FNMSUB) = (0wx3f, 0wx1e)
120 :     | emit_farith3 (I.FNMSUBS) = (0wx3b, 0wx1e)
121 :     | emit_farith3 (I.FSEL) = (0wx3f, 0wx17)
122 : monnier 429 and emit_bo (I.TRUE) = (0wxc : Word32.word)
123 : monnier 411 | emit_bo (I.FALSE) = (0wx4 : Word32.word)
124 :     | emit_bo (I.ALWAYS) = (0wx14 : Word32.word)
125 :     | emit_bo (I.COUNTER{eqZero, cond}) =
126 : leunga 744 (case cond of
127 :     NONE => (if eqZero
128 :     then 0wx12
129 :     else 0wx10)
130 :     | SOME cc =>
131 :     (case (eqZero, cc) of
132 :     (false, false) => 0wx0
133 :     | (false, true) => 0wx8
134 :     | (true, false) => 0wx2
135 :     | (true, true) => 0wxa
136 :     )
137 : monnier 411 )
138 :     and emit_arith (I.ADD) = (0wx10a : Word32.word)
139 :     | emit_arith (I.SUBF) = (0wx28 : Word32.word)
140 :     | emit_arith (I.MULLW) = (0wxeb : Word32.word)
141 :     | emit_arith (I.MULLD) = (0wxe9 : Word32.word)
142 :     | emit_arith (I.MULHW) = (0wx4b : Word32.word)
143 :     | emit_arith (I.MULHWU) = (0wxb : Word32.word)
144 :     | emit_arith (I.DIVW) = (0wx1eb : Word32.word)
145 :     | emit_arith (I.DIVD) = (0wx1e9 : Word32.word)
146 :     | emit_arith (I.DIVWU) = (0wx1cb : Word32.word)
147 :     | emit_arith (I.DIVDU) = (0wx1c9 : Word32.word)
148 :     | emit_arith (I.AND) = (0wx1c : Word32.word)
149 :     | emit_arith (I.OR) = (0wx1bc : Word32.word)
150 :     | emit_arith (I.XOR) = (0wx13c : Word32.word)
151 :     | emit_arith (I.NAND) = (0wx1dc : Word32.word)
152 :     | emit_arith (I.NOR) = (0wx7c : Word32.word)
153 :     | emit_arith (I.EQV) = (0wx11c : Word32.word)
154 :     | emit_arith (I.ANDC) = (0wx3c : Word32.word)
155 :     | emit_arith (I.ORC) = (0wx19c : Word32.word)
156 :     | emit_arith (I.SLW) = (0wx18 : Word32.word)
157 :     | emit_arith (I.SLD) = (0wx1b : Word32.word)
158 :     | emit_arith (I.SRW) = (0wx218 : Word32.word)
159 :     | emit_arith (I.SRD) = (0wx21b : Word32.word)
160 :     | emit_arith (I.SRAW) = (0wx318 : Word32.word)
161 :     | emit_arith (I.SRAD) = (0wx31a : Word32.word)
162 : monnier 429 and emit_arithi (I.ADDI) = (0wxe : Word32.word)
163 :     | emit_arithi (I.ADDIS) = (0wxf : Word32.word)
164 :     | emit_arithi (I.SUBFIC) = (0wx8 : Word32.word)
165 :     | emit_arithi (I.MULLI) = (0wx7 : Word32.word)
166 :     | emit_arithi (I.ANDI_Rc) = (0wx1c : Word32.word)
167 :     | emit_arithi (I.ANDIS_Rc) = (0wx1d : Word32.word)
168 :     | emit_arithi (I.ORI) = (0wx18 : Word32.word)
169 :     | emit_arithi (I.ORIS) = (0wx19 : Word32.word)
170 :     | emit_arithi (I.XORI) = (0wx1a : Word32.word)
171 :     | emit_arithi (I.XORIS) = (0wx1b : Word32.word)
172 : george 545 | emit_arithi (I.SRAWI) = error "SRAWI"
173 :     | emit_arithi (I.SRADI) = error "SRADI"
174 :     and emit_ccarith (I.CRAND) = (0wx101 : Word32.word)
175 :     | emit_ccarith (I.CROR) = (0wx1c1 : Word32.word)
176 :     | emit_ccarith (I.CRXOR) = (0wxc1 : Word32.word)
177 :     | emit_ccarith (I.CRNAND) = (0wxe1 : Word32.word)
178 :     | emit_ccarith (I.CRNOR) = (0wx21 : Word32.word)
179 :     | emit_ccarith (I.CREQV) = (0wx121 : Word32.word)
180 :     | emit_ccarith (I.CRANDC) = (0wx81 : Word32.word)
181 :     | emit_ccarith (I.CRORC) = (0wx1a1 : Word32.word)
182 : leunga 744 fun x_form {opcd, rt, ra, rb, xo, rc} =
183 :     let val rc = emit_bool rc
184 : george 545 in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xo << 0wx1) + rc)))))
185 : monnier 411 end
186 : leunga 744 and xl_form {opcd, bt, ba, bb, xo, lk} =
187 :     let val lk = emit_bool lk
188 : george 545 in eWord32 ((opcd << 0wx1a) + ((bt << 0wx15) + ((ba << 0wx10) + ((bb << 0wxb) + ((xo << 0wx1) + lk)))))
189 : monnier 411 end
190 : leunga 744 and m_form {opcd, rs, ra, rb, mb, me, rc} =
191 :     let val rc = emit_bool rc
192 : george 545 in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + rc))))))
193 : monnier 411 end
194 : leunga 744 and a_form {opcd, frt, fra, frb, frc, xo, rc} =
195 :     let val rc = emit_bool rc
196 : george 545 in eWord32 ((opcd << 0wx1a) + ((frt << 0wx15) + ((fra << 0wx10) + ((frb << 0wxb) + ((frc << 0wx6) + ((xo << 0wx1) + rc))))))
197 : monnier 411 end
198 : leunga 744 and loadx {rt, ra, rb, xop} =
199 :     let val rt = emit_GP rt
200 :     val ra = emit_GP ra
201 :     val rb = emit_GP rb
202 : george 545 in eWord32 ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))
203 : monnier 411 end
204 : leunga 744 and loadd {opcd, rt, ra, d} =
205 :     let val rt = emit_GP rt
206 :     val ra = emit_GP ra
207 :     val d = emit_operand d
208 : george 545 in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))
209 : monnier 411 end
210 : leunga 744 and loadde {opcd, rt, ra, de, xop} =
211 :     let val rt = emit_GP rt
212 :     val ra = emit_GP ra
213 :     val de = emit_operand de
214 : george 545 in eWord32 ((opcd << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))
215 : monnier 411 end
216 : george 545 and load {ld, rt, ra, d} =
217 : leunga 744 (case (d, ld) of
218 :     (I.RegOp rb, I.LBZ) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx57}
219 :     | (I.RegOp rb, I.LBZE) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx5f}
220 :     | (I.RegOp rb, I.LHZ) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx117}
221 :     | (I.RegOp rb, I.LHZE) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx11f}
222 :     | (I.RegOp rb, I.LHA) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx157}
223 :     | (I.RegOp rb, I.LHAE) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx15f}
224 :     | (I.RegOp rb, I.LWZ) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx17}
225 :     | (I.RegOp rb, I.LWZE) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx1f}
226 :     | (I.RegOp rb, I.LDE) => loadx {rt=rt, ra=ra, rb=rb, xop=0wx31f}
227 :     | (d, I.LBZ) => loadd {opcd=0wx22, rt=rt, ra=ra, d=d}
228 :     | (de, I.LBZE) => loadde {opcd=0wx3a, rt=rt, ra=ra, de=de, xop=0wx0}
229 :     | (d, I.LHZ) => loadd {opcd=0wx28, rt=rt, ra=ra, d=d}
230 :     | (de, I.LHZE) => loadde {opcd=0wx3a, rt=rt, ra=ra, de=de, xop=0wx2}
231 :     | (d, I.LHA) => loadd {opcd=0wx2a, rt=rt, ra=ra, d=d}
232 :     | (de, I.LHAE) => loadde {opcd=0wx3a, rt=rt, ra=ra, de=de, xop=0wx4}
233 :     | (d, I.LWZ) => loadd {opcd=0wx20, rt=rt, ra=ra, d=d}
234 :     | (de, I.LWZE) => loadde {opcd=0wx3a, rt=rt, ra=ra, de=de, xop=0wx6}
235 :     | (de, I.LDE) => loadde {opcd=0wx3e, rt=rt, ra=ra, de=de, xop=0wx0}
236 : monnier 411 )
237 : leunga 744 and floadx {ft, ra, rb, xop} =
238 :     let val ft = emit_FP ft
239 :     val ra = emit_GP ra
240 :     val rb = emit_GP rb
241 : george 545 in eWord32 ((ft << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))
242 : monnier 411 end
243 : leunga 744 and floadd {opcd, ft, ra, d} =
244 :     let val ft = emit_FP ft
245 :     val ra = emit_GP ra
246 :     val d = emit_operand d
247 : george 545 in eWord32 ((opcd << 0wx1a) + ((ft << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))
248 : monnier 429 end
249 : leunga 744 and floadde {opcd, ft, ra, de, xop} =
250 :     let val ft = emit_FP ft
251 :     val ra = emit_GP ra
252 :     val de = emit_operand de
253 : george 545 in eWord32 ((opcd << 0wx1a) + ((ft << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))
254 :     end
255 :     and fload {ld, ft, ra, d} =
256 : leunga 744 (case (d, ld) of
257 :     (I.RegOp rb, I.LFS) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx217}
258 :     | (I.RegOp rb, I.LFSE) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx21f}
259 :     | (I.RegOp rb, I.LFD) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx257}
260 :     | (I.RegOp rb, I.LFDE) => floadx {ft=ft, ra=ra, rb=rb, xop=0wx25f}
261 :     | (d, I.LFS) => floadd {ft=ft, ra=ra, d=d, opcd=0wx30}
262 :     | (de, I.LFSE) => floadde {ft=ft, ra=ra, de=de, opcd=0wx3e, xop=0wx4}
263 :     | (d, I.LFD) => floadd {ft=ft, ra=ra, d=d, opcd=0wx32}
264 :     | (de, I.LFDE) => floadde {ft=ft, ra=ra, de=de, opcd=0wx3e, xop=0wx6}
265 : george 545 )
266 : leunga 744 and storex {rs, ra, rb, xop} =
267 :     let val rs = emit_GP rs
268 :     val ra = emit_GP ra
269 :     val rb = emit_GP rb
270 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))
271 : monnier 411 end
272 : leunga 744 and stored {opcd, rs, ra, d} =
273 :     let val rs = emit_GP rs
274 :     val ra = emit_GP ra
275 :     val d = emit_operand d
276 : george 545 in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))
277 : monnier 411 end
278 : leunga 744 and storede {opcd, rs, ra, de, xop} =
279 :     let val rs = emit_GP rs
280 :     val ra = emit_GP ra
281 :     val de = emit_operand de
282 : george 545 in eWord32 ((opcd << 0wx1a) + ((rs << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))
283 : monnier 429 end
284 : george 545 and store {st, rs, ra, d} =
285 : leunga 744 (case (d, st) of
286 :     (I.RegOp rb, I.STB) => storex {rs=rs, ra=ra, rb=rb, xop=0wxd7}
287 :     | (I.RegOp rb, I.STBE) => storex {rs=rs, ra=ra, rb=rb, xop=0wxdf}
288 :     | (I.RegOp rb, I.STH) => storex {rs=rs, ra=ra, rb=rb, xop=0wx197}
289 :     | (I.RegOp rb, I.STHE) => storex {rs=rs, ra=ra, rb=rb, xop=0wx19f}
290 :     | (I.RegOp rb, I.STW) => storex {rs=rs, ra=ra, rb=rb, xop=0wx97}
291 :     | (I.RegOp rb, I.STWE) => storex {rs=rs, ra=ra, rb=rb, xop=0wx9f}
292 :     | (I.RegOp rb, I.STDE) => storex {rs=rs, ra=ra, rb=rb, xop=0wx39f}
293 :     | (d, I.STB) => stored {rs=rs, ra=ra, d=d, opcd=0wx26}
294 :     | (de, I.STBE) => storede {rs=rs, ra=ra, de=de, opcd=0wx3a, xop=0wx8}
295 :     | (d, I.STH) => stored {rs=rs, ra=ra, d=d, opcd=0wx2c}
296 :     | (de, I.STHE) => storede {rs=rs, ra=ra, de=de, opcd=0wx3a, xop=0wxa}
297 :     | (d, I.STW) => stored {rs=rs, ra=ra, d=d, opcd=0wx24}
298 :     | (de, I.STWE) => storede {rs=rs, ra=ra, de=de, opcd=0wx3a, xop=0wxe}
299 :     | (de, I.STDE) => storede {rs=rs, ra=ra, de=de, opcd=0wx3e, xop=0wx8}
300 : george 545 )
301 : leunga 744 and fstorex {fs, ra, rb, xop} =
302 :     let val fs = emit_FP fs
303 :     val ra = emit_GP ra
304 :     val rb = emit_GP rb
305 : george 545 in eWord32 ((fs << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((xop << 0wx1) + 0wx7c000000))))
306 : monnier 411 end
307 : leunga 744 and fstored {opcd, fs, ra, d} =
308 :     let val fs = emit_FP fs
309 :     val ra = emit_GP ra
310 :     val d = emit_operand d
311 : george 545 in eWord32 ((opcd << 0wx1a) + ((fs << 0wx15) + ((ra << 0wx10) + (d && 0wxffff))))
312 : monnier 411 end
313 : leunga 744 and fstorede {opcd, fs, ra, de, xop} =
314 :     let val fs = emit_FP fs
315 :     val ra = emit_GP ra
316 :     val de = emit_operand de
317 : george 545 in eWord32 ((opcd << 0wx1a) + ((fs << 0wx15) + ((ra << 0wx10) + (((de && 0wxfff) << 0wx4) + xop))))
318 : monnier 411 end
319 : george 545 and fstore {st, fs, ra, d} =
320 : leunga 744 (case (d, st) of
321 :     (I.RegOp rb, I.STFS) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx297}
322 :     | (I.RegOp rb, I.STFSE) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx29f}
323 :     | (I.RegOp rb, I.STFD) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx2d7}
324 :     | (I.RegOp rb, I.STFDE) => fstorex {fs=fs, ra=ra, rb=rb, xop=0wx2f7}
325 :     | (d, I.STFS) => fstored {fs=fs, ra=ra, d=d, opcd=0wx34}
326 :     | (de, I.STFSE) => fstorede {fs=fs, ra=ra, de=de, opcd=0wx3e, xop=0wxc}
327 :     | (d, I.STFD) => fstored {fs=fs, ra=ra, d=d, opcd=0wx36}
328 :     | (de, I.STFDE) => fstorede {fs=fs, ra=ra, de=de, opcd=0wx3e, xop=0wxe}
329 : george 545 )
330 : leunga 744 and unary' {ra, rt, OE, oper, Rc} =
331 :     let val ra = emit_GP ra
332 :     val rt = emit_GP rt
333 :     val OE = emit_bool OE
334 :     val oper = emit_unary oper
335 :     val Rc = emit_bool Rc
336 : george 545 in eWord32 ((ra << 0wx15) + ((rt << 0wx10) + ((OE << 0wxa) + ((oper << 0wx1) + (Rc + 0wx7c000000)))))
337 : monnier 411 end
338 : george 545 and unary {ra, rt, oper, OE, Rc} =
339 : leunga 744 (case oper of
340 :     I.NEG => unary' {ra=rt, rt=ra, oper=oper, OE=OE, Rc=Rc}
341 :     | _ => unary' {ra=ra, rt=rt, oper=oper, OE=OE, Rc=Rc}
342 : monnier 411 )
343 : leunga 744 and arith' {rt, ra, rb, OE, oper, Rc} =
344 :     let val rt = emit_GP rt
345 :     val ra = emit_GP ra
346 :     val rb = emit_GP rb
347 :     val OE = emit_bool OE
348 :     val oper = emit_arith oper
349 :     val Rc = emit_bool Rc
350 : george 545 in eWord32 ((rt << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + ((OE << 0wxa) + ((oper << 0wx1) + (Rc + 0wx7c000000))))))
351 : monnier 411 end
352 : leunga 744 and arithi' {oper, rt, ra, im} =
353 :     let val oper = emit_arithi oper
354 :     val rt = emit_GP rt
355 :     val ra = emit_GP ra
356 :     val im = emit_operand im
357 : george 545 in eWord32 ((oper << 0wx1a) + ((rt << 0wx15) + ((ra << 0wx10) + (im && 0wxffff))))
358 : monnier 411 end
359 : leunga 744 and srawi {rs, ra, sh} =
360 :     let val rs = emit_GP rs
361 :     val ra = emit_GP ra
362 :     val sh = emit_operand sh
363 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + (((sh && 0wx1f) << 0wxb) + 0wx7c000670)))
364 : monnier 411 end
365 : leunga 744 and sradi' {rs, ra, sh, sh2} =
366 :     let val rs = emit_GP rs
367 :     val ra = emit_GP ra
368 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((sh2 << 0wx1) + 0wx7c000674))))
369 : monnier 245 end
370 : leunga 744 and sradi {rs, ra, sh} =
371 :     let val sh = emit_operand sh
372 : george 545 in sradi' {rs=rs, ra=ra, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1)}
373 : monnier 245 end
374 : george 545 and arith {oper, rt, ra, rb, OE, Rc} =
375 : leunga 744 (case oper of
376 :     (I.ADD | I.SUBF | I.MULLW | I.MULLD | I.MULHW | I.MULHWU | I.DIVW | I.DIVD | I.DIVWU | I.DIVDU) =>
377 :     arith' {oper=oper, rt=rt, ra=ra, rb=rb, OE=OE, Rc=Rc}
378 :     | _ => arith' {oper=oper, rt=ra, ra=rt, rb=rb, OE=OE, Rc=Rc}
379 : george 545 )
380 :     and arithi {oper, rt, ra, im} =
381 : leunga 744 (case oper of
382 :     (I.ADDI | I.ADDIS | I.SUBFIC | I.MULLI) => arithi' {oper=oper, rt=rt,
383 :     ra=ra, im=im}
384 :     | I.SRAWI => srawi {rs=ra, ra=rt, sh=im}
385 :     | I.SRADI => sradi {rs=ra, ra=rt, sh=im}
386 :     | _ => arithi' {oper=oper, rt=ra, ra=rt, im=im}
387 : george 545 )
388 : leunga 744 and Cmpl {bf, l, ra, rb} =
389 :     let val bf = emit_CC bf
390 :     val l = emit_bool l
391 :     val ra = emit_GP ra
392 :     val rb = emit_GP rb
393 : george 545 in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000040))))
394 : monnier 245 end
395 : leunga 744 and Cmpli {bf, l, ra, ui} =
396 :     let val bf = emit_CC bf
397 :     val l = emit_bool l
398 :     val ra = emit_GP ra
399 :     val ui = emit_operand ui
400 : george 545 in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((ui && 0wxffff) + 0wx28000000))))
401 : monnier 245 end
402 : leunga 744 and Cmp {bf, l, ra, rb} =
403 :     let val bf = emit_CC bf
404 :     val l = emit_bool l
405 :     val ra = emit_GP ra
406 :     val rb = emit_GP rb
407 : george 545 in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000000))))
408 : monnier 429 end
409 : leunga 744 and Cmpi {bf, l, ra, si} =
410 :     let val bf = emit_CC bf
411 :     val l = emit_bool l
412 :     val ra = emit_GP ra
413 :     val si = emit_operand si
414 : george 545 in eWord32 ((bf << 0wx17) + ((l << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wx2c000000))))
415 : monnier 245 end
416 : monnier 429 and compare {cmp, bf, l, ra, rb} =
417 : leunga 744 (case (cmp, rb) of
418 :     (I.CMP, I.RegOp rb) => Cmp {bf=bf, l=l, ra=ra, rb=rb}
419 :     | (I.CMPL, I.RegOp rb) => Cmpl {bf=bf, l=l, ra=ra, rb=rb}
420 :     | (I.CMP, si) => Cmpi {bf=bf, l=l, ra=ra, si=si}
421 :     | (I.CMPL, ui) => Cmpli {bf=bf, l=l, ra=ra, ui=ui}
422 : monnier 429 )
423 : leunga 744 and fcmp {bf, fa, fb, cmp} =
424 :     let val bf = emit_CC bf
425 :     val fa = emit_FP fa
426 :     val fb = emit_FP fb
427 :     val cmp = emit_fcmp cmp
428 : george 545 in eWord32 ((bf << 0wx17) + ((fa << 0wx10) + ((fb << 0wxb) + ((cmp << 0wx1) + 0wxfc000000))))
429 : monnier 429 end
430 : leunga 744 and funary {oper, ft, fb, Rc} =
431 :     let val oper = emit_funary oper
432 :     val ft = emit_FP ft
433 :     val fb = emit_FP fb
434 :     in
435 :     let
436 :     (*#line 423.12 "ppc/ppc.mdl"*)
437 :     val (opcd, xo) = oper
438 : blume 859 in
439 :     (case oper of
440 :     (0wx3f, 0wx16) => a_form {opcd=opcd, frt=ft, fra=0wx0, frb=fb,
441 :     frc=0wx0, xo=xo, rc=Rc}
442 :     | (0wx3b, 0wx16) => a_form {opcd=opcd, frt=ft, fra=0wx0, frb=fb,
443 :     frc=0wx0, xo=xo, rc=Rc}
444 :     | _ => x_form {opcd=opcd, rt=ft, ra=0wx0, rb=fb, xo=xo, rc=Rc}
445 :     )
446 : george 545 end
447 : monnier 245 end
448 : leunga 744 and farith {oper, ft, fa, fb, Rc} =
449 :     let val ft = emit_FP ft
450 :     val fa = emit_FP fa
451 :     val fb = emit_FP fb
452 :     in
453 :     let
454 : blume 859 (*#line 436.12 "ppc/ppc.mdl"*)
455 : leunga 744 val (opcd, xo) = emit_farith oper
456 : george 545 in
457 : leunga 744 (case oper of
458 :     (I.FMUL | I.FMULS) => a_form {opcd=opcd, frt=ft, fra=fa, frb=0wx0,
459 :     frc=fb, xo=xo, rc=Rc}
460 :     | _ => a_form {opcd=opcd, frt=ft, fra=fa, frb=fb, frc=0wx0, xo=xo,
461 :     rc=Rc}
462 : george 545 )
463 :     end
464 : monnier 429 end
465 : leunga 744 and farith3 {oper, ft, fa, fc, fb, Rc} =
466 :     let val oper = emit_farith3 oper
467 :     val ft = emit_FP ft
468 :     val fa = emit_FP fa
469 :     val fc = emit_FP fc
470 :     val fb = emit_FP fb
471 :     in
472 :     let
473 : blume 859 (*#line 445.12 "ppc/ppc.mdl"*)
474 : leunga 744 val (opcd, xo) = oper
475 : george 545 in a_form {opcd=opcd, frt=ft, fra=fa, frb=fb, frc=fc, xo=xo, rc=Rc}
476 :     end
477 : monnier 245 end
478 : leunga 744 and cr_bit {cc} =
479 :     let
480 : blume 859 (*#line 450.12 "ppc/ppc.mdl"*)
481 : leunga 744 val (cr, bit) = cc
482 : george 545 in ((emit_CC cr) << 0wx2) + (itow
483 : leunga 744 (case bit of
484 :     I.LT => 0
485 :     | I.GT => 1
486 :     | I.EQ => 2
487 :     | I.SO => 3
488 :     | I.FL => 0
489 :     | I.FG => 1
490 :     | I.FE => 2
491 :     | I.FU => 3
492 :     | I.FX => 0
493 :     | I.FEX => 1
494 :     | I.VX => 2
495 :     | I.OX => 3
496 : george 545 ))
497 : monnier 429 end
498 : leunga 744 and ccarith {oper, bt, ba, bb} =
499 :     let val oper = emit_ccarith oper
500 :     in xl_form {opcd=0wx13, bt=cr_bit {cc=bt}, ba=cr_bit {cc=ba}, bb=cr_bit {cc=bb},
501 :     xo=oper, lk=false}
502 : monnier 429 end
503 : leunga 744 and twr {to, ra, rb} =
504 :     let val to = emit_int to
505 :     val ra = emit_GP ra
506 :     val rb = emit_GP rb
507 : george 545 in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000008)))
508 : monnier 411 end
509 : leunga 744 and twi {to, ra, si} =
510 :     let val to = emit_int to
511 :     val ra = emit_GP ra
512 :     val si = emit_operand si
513 : george 545 in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wxc000000)))
514 : monnier 411 end
515 : george 545 and tw {to, ra, si} =
516 : leunga 744 (case si of
517 :     I.RegOp rb => twr {to=to, ra=ra, rb=rb}
518 :     | _ => twi {to=to, ra=ra, si=si}
519 : george 545 )
520 : leunga 744 and tdr {to, ra, rb} =
521 :     let val to = emit_int to
522 :     val ra = emit_GP ra
523 :     val rb = emit_GP rb
524 : george 545 in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((rb << 0wxb) + 0wx7c000088)))
525 : monnier 411 end
526 : leunga 744 and tdi {to, ra, si} =
527 :     let val to = emit_int to
528 :     val ra = emit_GP ra
529 :     val si = emit_operand si
530 : george 545 in eWord32 ((to << 0wx15) + ((ra << 0wx10) + ((si && 0wxffff) + 0wx8000000)))
531 : monnier 411 end
532 : george 545 and td {to, ra, si} =
533 : leunga 744 (case si of
534 :     I.RegOp rb => tdr {to=to, ra=ra, rb=rb}
535 :     | _ => tdi {to=to, ra=ra, si=si}
536 : monnier 429 )
537 : leunga 744 and mcrf {bf, bfa} =
538 :     let val bf = emit_CC bf
539 :     val bfa = emit_CC bfa
540 : george 545 in eWord32 ((bf << 0wx17) + ((bfa << 0wx12) + 0wx4c000000))
541 :     end
542 : leunga 744 and mtspr' {rs, spr} =
543 :     let val rs = emit_GP rs
544 : george 545 in eWord32 ((rs << 0wx15) + ((spr << 0wxb) + 0wx7c0003a6))
545 :     end
546 : leunga 744 and mtspr {rs, spr} =
547 :     let val spr = emit_SPR spr
548 : george 545 in mtspr' {rs=rs, spr=((spr && 0wx1f) << 0wx5) + ((spr << 0wx5) && 0wx1f)}
549 : monnier 411 end
550 : leunga 744 and mfspr' {rt, spr} =
551 :     let val rt = emit_GP rt
552 : george 545 in eWord32 ((rt << 0wx15) + ((spr << 0wxb) + 0wx7c0002a6))
553 : monnier 411 end
554 : leunga 744 and mfspr {rt, spr} =
555 :     let val spr = emit_SPR spr
556 : george 545 in mfspr' {rt=rt, spr=((spr && 0wx1f) << 0wx5) + ((spr << 0wx5) && 0wx1f)}
557 : monnier 411 end
558 : leunga 744 and b {li, aa, lk} =
559 :     let val aa = emit_bool aa
560 :     val lk = emit_bool lk
561 : george 545 in eWord32 (((li && 0wxffffff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx48000000)))
562 : monnier 411 end
563 : leunga 744 and be {li, aa, lk} =
564 :     let val aa = emit_bool aa
565 :     val lk = emit_bool lk
566 : george 545 in eWord32 (((li && 0wxffffff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx58000000)))
567 : monnier 411 end
568 : leunga 744 and bc {bo, bi, bd, aa, lk} =
569 :     let val bo = emit_bo bo
570 :     val aa = emit_bool aa
571 :     val lk = emit_bool lk
572 : george 545 in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (((bd && 0wx3fff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx40000000)))))
573 : monnier 411 end
574 : leunga 744 and bce {bo, bi, bd, aa, lk} =
575 :     let val bo = emit_bo bo
576 :     val aa = emit_bool aa
577 :     val lk = emit_bool lk
578 : george 545 in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (((bd && 0wx3fff) << 0wx2) + ((aa << 0wx1) + (lk + 0wx40000000)))))
579 : monnier 411 end
580 : leunga 744 and bclr {bo, bi, lk} =
581 :     let val bo = emit_bo bo
582 :     val lk = emit_bool lk
583 : george 545 in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000020)))
584 : monnier 411 end
585 : leunga 744 and bclre {bo, bi, lk} =
586 :     let val bo = emit_bo bo
587 :     val lk = emit_bool lk
588 : george 545 in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000022)))
589 :     end
590 : leunga 744 and bcctr {bo, bi, lk} =
591 :     let val bo = emit_bo bo
592 :     val lk = emit_bool lk
593 : george 545 in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000420)))
594 : monnier 411 end
595 : leunga 744 and bcctre {bo, bi, lk} =
596 :     let val bo = emit_bo bo
597 :     val lk = emit_bool lk
598 : george 545 in eWord32 ((bo << 0wx15) + ((bi << 0wx10) + (lk + 0wx4c000422)))
599 : monnier 411 end
600 : leunga 744 and rlwnm {rs, ra, sh, mb, me} =
601 :     let val rs = emit_GP rs
602 :     val ra = emit_GP ra
603 :     val sh = emit_GP sh
604 :     val mb = emit_int mb
605 :     val me = emit_int me
606 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx5c000000)))))
607 :     end
608 : leunga 744 and rlwinm {rs, ra, sh, mb, me} =
609 :     let val rs = emit_GP rs
610 :     val ra = emit_GP ra
611 :     val mb = emit_int mb
612 :     val me = emit_int me
613 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx54000000)))))
614 :     end
615 : leunga 744 and rldcl {rs, ra, sh, mb} =
616 :     let val rs = emit_GP rs
617 :     val ra = emit_GP ra
618 :     val sh = emit_GP sh
619 :     val mb = emit_int mb
620 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + 0wx78000010))))
621 : monnier 411 end
622 : leunga 744 and rldicl {rs, ra, sh, mb, sh2} =
623 :     let val rs = emit_GP rs
624 :     val ra = emit_GP ra
625 :     val mb = emit_int mb
626 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000000)))))
627 : monnier 429 end
628 : leunga 744 and rldcr {rs, ra, sh, mb} =
629 :     let val rs = emit_GP rs
630 :     val ra = emit_GP ra
631 :     val sh = emit_GP sh
632 :     val mb = emit_int mb
633 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + 0wx78000012))))
634 : monnier 429 end
635 : leunga 744 and rldicr {rs, ra, sh, mb, sh2} =
636 :     let val rs = emit_GP rs
637 :     val ra = emit_GP ra
638 :     val mb = emit_int mb
639 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000004)))))
640 : monnier 411 end
641 : leunga 744 and rldic {rs, ra, sh, mb, sh2} =
642 :     let val rs = emit_GP rs
643 :     val ra = emit_GP ra
644 :     val mb = emit_int mb
645 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx78000008)))))
646 : monnier 429 end
647 : leunga 744 and rlwimi {rs, ra, sh, mb, me} =
648 :     let val rs = emit_GP rs
649 :     val ra = emit_GP ra
650 :     val mb = emit_int mb
651 :     val me = emit_int me
652 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((me << 0wx1) + 0wx50000000)))))
653 : monnier 429 end
654 : leunga 744 and rldimi {rs, ra, sh, mb, sh2} =
655 :     let val rs = emit_GP rs
656 :     val ra = emit_GP ra
657 :     val mb = emit_int mb
658 : george 545 in eWord32 ((rs << 0wx15) + ((ra << 0wx10) + ((sh << 0wxb) + ((mb << 0wx6) + ((sh2 << 0wx1) + 0wx7800000c)))))
659 : monnier 429 end
660 : george 545 and rotate {oper, ra, rs, sh, mb, me} =
661 : leunga 744 (case (oper, me) of
662 :     (I.RLWNM, SOME me) => rlwnm {ra=ra, rs=rs, sh=sh, mb=mb, me=me}
663 :     | (I.RLDCL, _) => rldcl {ra=ra, rs=rs, sh=sh, mb=mb}
664 :     | (I.RLDCR, _) => rldcr {ra=ra, rs=rs, sh=sh, mb=mb}
665 : monnier 411 )
666 : leunga 744 and rotatei {oper, ra, rs, sh, mb, me} =
667 :     let val sh = emit_operand sh
668 : george 545 in
669 : leunga 744 (case (oper, me) of
670 :     (I.RLWINM, SOME me) => rlwinm {ra=ra, rs=rs, sh=sh, mb=mb, me=me}
671 :     | (I.RLWIMI, SOME me) => rlwimi {ra=ra, rs=rs, sh=sh, mb=mb, me=me}
672 :     | (I.RLDICL, _) => rldicl {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1),
673 :     mb=mb}
674 :     | (I.RLDICR, _) => rldicr {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1),
675 :     mb=mb}
676 :     | (I.RLDIC, _) => rldic {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1),
677 :     mb=mb}
678 :     | (I.RLDIMI, _) => rldimi {ra=ra, rs=rs, sh=(sh && 0wx1f), sh2=((sh << 0wx5) && 0wx1),
679 :     mb=mb}
680 : george 545 )
681 :     end
682 : monnier 411
683 : blume 859 (*#line 540.7 "ppc/ppc.mdl"*)
684 : blume 1002 fun relative (I.LabelOp lexp) = (itow ((MLTreeEval.valueOf lexp) - ( ! loc))) ~>> 0wx2
685 : george 545 | relative _ = error "relative"
686 : leunga 744 fun emitter instr =
687 :     let
688 : george 545 fun emitInstr (I.L{ld, rt, ra, d, mem}) = load {ld=ld, rt=rt, ra=ra, d=d}
689 :     | emitInstr (I.LF{ld, ft, ra, d, mem}) = fload {ld=ld, ft=ft, ra=ra, d=d}
690 :     | emitInstr (I.ST{st, rs, ra, d, mem}) = store {st=st, rs=rs, ra=ra, d=d}
691 : leunga 744 | emitInstr (I.STF{st, fs, ra, d, mem}) = fstore {st=st, fs=fs, ra=ra,
692 :     d=d}
693 :     | emitInstr (I.UNARY{oper, rt, ra, Rc, OE}) = unary {oper=oper, rt=rt,
694 :     ra=ra, OE=OE, Rc=Rc}
695 :     | emitInstr (I.ARITH{oper, rt, ra, rb, Rc, OE}) = arith {oper=oper, rt=rt,
696 :     ra=ra, rb=rb, OE=OE, Rc=Rc}
697 :     | emitInstr (I.ARITHI{oper, rt, ra, im}) = arithi {oper=oper, rt=rt, ra=ra,
698 :     im=im}
699 :     | emitInstr (I.ROTATE{oper, ra, rs, sh, mb, me}) = rotate {oper=oper,
700 :     ra=ra, rs=rs, sh=sh, mb=mb, me=me}
701 :     | emitInstr (I.ROTATEI{oper, ra, rs, sh, mb, me}) = rotatei {oper=oper,
702 :     ra=ra, rs=rs, sh=sh, mb=mb, me=me}
703 :     | emitInstr (I.COMPARE{cmp, l, bf, ra, rb}) = compare {cmp=cmp, bf=bf,
704 :     l=l, ra=ra, rb=rb}
705 :     | emitInstr (I.FCOMPARE{cmp, bf, fa, fb}) = fcmp {cmp=cmp, bf=bf, fa=fa,
706 :     fb=fb}
707 :     | emitInstr (I.FUNARY{oper, ft, fb, Rc}) = funary {oper=oper, ft=ft, fb=fb,
708 :     Rc=Rc}
709 :     | emitInstr (I.FARITH{oper, ft, fa, fb, Rc}) = farith {oper=oper, ft=ft,
710 :     fa=fa, fb=fb, Rc=Rc}
711 :     | emitInstr (I.FARITH3{oper, ft, fa, fb, fc, Rc}) = farith3 {oper=oper,
712 :     ft=ft, fa=fa, fb=fb, fc=fc, Rc=Rc}
713 :     | emitInstr (I.CCARITH{oper, bt, ba, bb}) = ccarith {oper=oper, bt=bt,
714 :     ba=ba, bb=bb}
715 : george 545 | emitInstr (I.MCRF{bf, bfa}) = mcrf {bf=bf, bfa=bfa}
716 :     | emitInstr (I.MTSPR{rs, spr}) = mtspr {rs=rs, spr=spr}
717 :     | emitInstr (I.MFSPR{rt, spr}) = mfspr {rt=rt, spr=spr}
718 :     | emitInstr (I.TW{to, ra, si}) = tw {to=to, ra=ra, si=si}
719 :     | emitInstr (I.TD{to, ra, si}) = td {to=to, ra=ra, si=si}
720 : leunga 744 | emitInstr (I.BC{bo, bf, bit, addr, LK, fall}) = bc {bo=bo, bi=cr_bit {cc=(bf,
721 :     bit)}, bd=relative addr, aa=false, lk=LK}
722 :     | emitInstr (I.BCLR{bo, bf, bit, LK, labels}) = bclr {bo=bo, bi=cr_bit {cc=(bf,
723 :     bit)}, lk=LK}
724 : george 545 | emitInstr (I.B{addr, LK}) = b {li=relative addr, aa=false, lk=LK}
725 : blume 859 | emitInstr (I.CALL{def, use, cutsTo, mem}) = bclr {bo=I.ALWAYS, bi=0wx0,
726 :     lk=true}
727 : leunga 624 | emitInstr (I.SOURCE{}) = ()
728 :     | emitInstr (I.SINK{}) = ()
729 :     | emitInstr (I.PHI{}) = ()
730 : monnier 411 in
731 : leunga 744 emitInstr instr
732 : monnier 411 end
733 :    
734 : blume 1232 fun emitInstruction(I.ANNOTATION{i, ...}) = emitInstruction(i)
735 :     | emitInstruction(I.INSTR(i)) = emitter(i)
736 :     | emitInstruction(I.LIVE _) = ()
737 :     | emitInstruction(I.KILL _) = ()
738 :     | emitInstruction _ = error "emitInstruction"
739 :    
740 : monnier 429 in S.STREAM{beginCluster=init,
741 : monnier 411 pseudoOp=pseudoOp,
742 : blume 1232 emit=emitInstruction,
743 : blume 1002 endCluster=fail,
744 : monnier 411 defineLabel=doNothing,
745 :     entryLabel=doNothing,
746 :     comment=doNothing,
747 :     exitBlock=doNothing,
748 : blume 859 annotation=doNothing,
749 :     getAnnotations=getAnnotations
750 : monnier 411 }
751 :     end
752 :     end
753 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0