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/trunk/src/MLRISC/ppc/emit/ppcMC.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/ppc/emit/ppcMC.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 469 - (view) (download)
Original Path: sml/branches/SMLNJ/src/MLRISC/ppc/emit/ppcMC.sml

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

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