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/SMLNJ/src/MLRISC/sparc/emit/sparcAsm.sml
ViewVC logotype

Annotation of /sml/branches/SMLNJ/src/MLRISC/sparc/emit/sparcAsm.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 469 - (view) (download)

1 : monnier 411 (*
2 :     * This file was automatically generated by MDGen
3 :     * from the machine description file "sparc/sparc.md".
4 :     *)
5 :    
6 :    
7 :     functor SparcAsmEmitter(structure Instr : SPARCINSTR
8 :     structure Stream : INSTRUCTION_STREAM
9 :     structure Shuffle : SPARCSHUFFLE
10 :     where I = Instr
11 :    
12 :     (*#line 251.1 "sparc/sparc.md"*)
13 :     val V9 : bool
14 :     ) : INSTRUCTION_EMITTER =
15 : monnier 247 struct
16 : monnier 411 structure I = Instr
17 :     structure C = I.C
18 :     structure S = Stream
19 :     structure P = S.P
20 :     structure LE = LabelExp
21 : monnier 247 structure Constant = I.Constant
22 : monnier 411
23 :     fun error msg = MLRiscErrorMsg.error("SparcAsm",msg)
24 :    
25 : monnier 429 fun makeStream formatAnnotations =
26 : monnier 411 let val stream = !AsmStream.asmOutStream
27 : monnier 429 fun emit' s = TextIO.output(stream,s)
28 :     val newline = ref true
29 :     val tabs = ref 0
30 :     fun tabbing 0 = ()
31 :     | tabbing n = (emit' "\t"; tabbing(n-1))
32 :     fun emit s = (tabbing(!tabs); tabs := 0; newline := false; emit' s)
33 :     fun nl() = (tabs := 0; if !newline then () else (newline := true; emit' "\n"))
34 : monnier 411 fun comma() = emit ","
35 : monnier 429 fun tab() = tabs := !tabs + 1
36 :     fun ms n = let val s = Int.toString n
37 :     in if n<0 then "-"^String.substring(s,1,size s-1)
38 :     else s
39 :     end
40 : monnier 411 fun emit_label lab = emit(Label.nameOf lab)
41 :     fun emit_labexp le = emit(LabelExp.toString le)
42 :     fun emit_const c = emit(Constant.toString c)
43 :     fun emit_int i = emit(ms i)
44 :     fun paren f = (emit "("; f(); emit ")")
45 :     fun defineLabel lab = emit(Label.nameOf lab^":\n")
46 :     fun entryLabel lab = defineLabel lab
47 :     fun comment msg = emit("\t/* " ^ msg ^ " */")
48 :     fun annotation a = (comment(Annotations.toString a); nl())
49 :     fun emit_region mem = comment(I.Region.toString mem)
50 :     fun pseudoOp pOp = emit(P.toString pOp)
51 :     fun init size = (comment("Code Size = " ^ ms size); nl())
52 :     fun doNothing _ = ()
53 : monnier 429 val emitRegInfo = AsmFormatUtil.reginfo(emit,formatAnnotations)
54 : monnier 411 fun emitter regmap =
55 :     let
56 : monnier 247
57 : monnier 429 fun emit_PSR r =
58 :     ((emit (C.showPSR (regmap r)));
59 :     (emitRegInfo r))
60 :     and emit_CC r =
61 :     ((emit (C.showCC (regmap r)));
62 :     (emitRegInfo r))
63 :     and emit_Y r =
64 :     ((emit (C.showY (regmap r)));
65 :     (emitRegInfo r))
66 :     and emit_FP r =
67 :     ((emit (C.showFP (regmap r)));
68 :     (emitRegInfo r))
69 :     and emit_GP r =
70 :     ((emit (C.showGP (regmap r)));
71 :     (emitRegInfo r))
72 :     and emit_FSR r =
73 :     ((emit (C.showFSR (regmap r)));
74 :     (emitRegInfo r))
75 : monnier 247
76 : monnier 429 fun asm_farith1 (I.FiTOs) = "fitos"
77 : monnier 411 | asm_farith1 (I.FiTOd) = "fitod"
78 :     | asm_farith1 (I.FiTOq) = "fitoq"
79 :     | asm_farith1 (I.FsTOi) = "fstoi"
80 :     | asm_farith1 (I.FdTOi) = "fdtoi"
81 :     | asm_farith1 (I.FqTOi) = "fqtoi"
82 :     | asm_farith1 (I.FsTOd) = "fstod"
83 :     | asm_farith1 (I.FsTOq) = "fstoq"
84 :     | asm_farith1 (I.FdTOs) = "fdtos"
85 :     | asm_farith1 (I.FdTOq) = "fdtoq"
86 :     | asm_farith1 (I.FqTOs) = "fqtos"
87 :     | asm_farith1 (I.FqTOd) = "fqtod"
88 :     | asm_farith1 (I.FMOVs) = "fmovs"
89 :     | asm_farith1 (I.FNEGs) = "fnegs"
90 :     | asm_farith1 (I.FABSs) = "fabss"
91 :     | asm_farith1 (I.FMOVd) = "fmovd"
92 :     | asm_farith1 (I.FNEGd) = "fnegd"
93 :     | asm_farith1 (I.FABSd) = "fabsd"
94 :     | asm_farith1 (I.FMOVq) = "fmovq"
95 :     | asm_farith1 (I.FNEGq) = "fnegq"
96 :     | asm_farith1 (I.FABSq) = "fabsq"
97 :     | asm_farith1 (I.FSQRTs) = "fsqrts"
98 :     | asm_farith1 (I.FSQRTd) = "fsqrtd"
99 :     | asm_farith1 (I.FSQRTq) = "fsqrtq"
100 :     and emit_farith1 x = (emit (asm_farith1 x))
101 : monnier 429 and asm_store (I.STB) = "stb"
102 :     | asm_store (I.STH) = "sth"
103 :     | asm_store (I.ST) = "st"
104 :     | asm_store (I.STX) = "stx"
105 :     | asm_store (I.STD) = "std"
106 :     and emit_store x = (emit (asm_store x))
107 :     and emit_operand (I.REG GP) = (emit_GP GP)
108 :     | emit_operand (I.IMMED int) = (emit_int int)
109 :     | emit_operand (I.LAB labexp) = (emit_labexp labexp)
110 :     | emit_operand (I.LO labexp) =
111 :     ((emit "%lo(");
112 :     (emit_labexp labexp);
113 :     (emit ")"))
114 :     | emit_operand (I.HI labexp) =
115 :     ((emit "%hi(");
116 :     (emit_labexp labexp);
117 :     (emit ")"))
118 :     | emit_operand (I.CONST const) = (emit_const const)
119 :     and asm_fload (I.LDF) = "ldf"
120 :     | asm_fload (I.LDDF) = "lddf"
121 :     | asm_fload (I.LDQF) = "ldqf"
122 :     | asm_fload (I.LDFSR) = "ldfsr"
123 :     | asm_fload (I.LDXFSR) = "ldxfsr"
124 :     and emit_fload x = (emit (asm_fload x))
125 :     and asm_fstore (I.STF) = "stf"
126 :     | asm_fstore (I.STDF) = "stdf"
127 :     | asm_fstore (I.STFSR) = "stfsr"
128 :     and emit_fstore x = (emit (asm_fstore x))
129 :     and asm_prediction (I.PT) = "pt"
130 :     | asm_prediction (I.PN) = "pn"
131 :     and emit_prediction x = (emit (asm_prediction x))
132 :     and asm_fsize (I.S) = "s"
133 :     | asm_fsize (I.D) = "d"
134 :     | asm_fsize (I.Q) = "q"
135 :     and emit_fsize x = (emit (asm_fsize x))
136 : monnier 411 and asm_shift (I.SLL) = "sll"
137 :     | asm_shift (I.SRL) = "srl"
138 :     | asm_shift (I.SRA) = "sra"
139 :     | asm_shift (I.SLLX) = "sllx"
140 :     | asm_shift (I.SRLX) = "srlx"
141 :     | asm_shift (I.SRAX) = "srax"
142 :     and emit_shift x = (emit (asm_shift x))
143 : monnier 429 and asm_branch (I.BN) = "n"
144 :     | asm_branch (I.BE) = "e"
145 :     | asm_branch (I.BLE) = "le"
146 :     | asm_branch (I.BL) = "l"
147 :     | asm_branch (I.BLEU) = "leu"
148 :     | asm_branch (I.BCS) = "cs"
149 :     | asm_branch (I.BNEG) = "neg"
150 :     | asm_branch (I.BVS) = "vs"
151 :     | asm_branch (I.BA) = ""
152 :     | asm_branch (I.BNE) = "ne"
153 :     | asm_branch (I.BG) = "g"
154 :     | asm_branch (I.BGE) = "ge"
155 :     | asm_branch (I.BGU) = "gu"
156 :     | asm_branch (I.BCC) = "cc"
157 :     | asm_branch (I.BPOS) = "pos"
158 :     | asm_branch (I.BVC) = "vs"
159 :     and emit_branch x = (emit (asm_branch x))
160 : monnier 411 and asm_arith (I.AND) = "and"
161 :     | asm_arith (I.ANDCC) = "andcc"
162 :     | asm_arith (I.ANDN) = "andn"
163 :     | asm_arith (I.ANDNCC) = "andncc"
164 :     | asm_arith (I.OR) = "or"
165 :     | asm_arith (I.ORCC) = "orcc"
166 :     | asm_arith (I.ORN) = "orn"
167 :     | asm_arith (I.ORNCC) = "orncc"
168 :     | asm_arith (I.XOR) = "xor"
169 :     | asm_arith (I.XORCC) = "xorcc"
170 :     | asm_arith (I.XNOR) = "xnor"
171 :     | asm_arith (I.XNORCC) = "xnorcc"
172 :     | asm_arith (I.ADD) = "add"
173 :     | asm_arith (I.ADDCC) = "addcc"
174 :     | asm_arith (I.TADD) = "tadd"
175 :     | asm_arith (I.TADDCC) = "taddcc"
176 :     | asm_arith (I.TADDTV) = "taddtv"
177 :     | asm_arith (I.TADDTVCC) = "taddtvcc"
178 :     | asm_arith (I.SUB) = "sub"
179 :     | asm_arith (I.SUBCC) = "subcc"
180 :     | asm_arith (I.TSUB) = "tsub"
181 :     | asm_arith (I.TSUBCC) = "tsubcc"
182 :     | asm_arith (I.TSUBTV) = "tsubtv"
183 :     | asm_arith (I.TSUBTVCC) = "tsubtvcc"
184 :     | asm_arith (I.UMUL) = "umul"
185 :     | asm_arith (I.UMULCC) = "umulcc"
186 :     | asm_arith (I.SMUL) = "smul"
187 :     | asm_arith (I.SMULCC) = "smulcc"
188 :     | asm_arith (I.UDIV) = "udiv"
189 :     | asm_arith (I.UDIVCC) = "udivcc"
190 :     | asm_arith (I.SDIV) = "sdiv"
191 :     | asm_arith (I.SDIVCC) = "sdivcc"
192 :     | asm_arith (I.MULX) = "mulx"
193 :     | asm_arith (I.SDIVX) = "sdivx"
194 :     | asm_arith (I.UDIVX) = "udivx"
195 :     and emit_arith x = (emit (asm_arith x))
196 :     and asm_fcmp (I.FCMPs) = "fcmps"
197 :     | asm_fcmp (I.FCMPd) = "fcmpd"
198 :     | asm_fcmp (I.FCMPq) = "fcmpq"
199 :     | asm_fcmp (I.FCMPEs) = "fcmpes"
200 :     | asm_fcmp (I.FCMPEd) = "fcmped"
201 :     | asm_fcmp (I.FCMPEq) = "fcmpeq"
202 :     and emit_fcmp x = (emit (asm_fcmp x))
203 : monnier 429 and asm_rcond (I.RZ) = "rz"
204 :     | asm_rcond (I.RLEZ) = "rlez"
205 :     | asm_rcond (I.RLZ) = "rlz"
206 :     | asm_rcond (I.RNZ) = "rnz"
207 :     | asm_rcond (I.RGZ) = "rgz"
208 :     | asm_rcond (I.RGEZ) = "rgez"
209 :     and emit_rcond x = (emit (asm_rcond x))
210 : monnier 411 and asm_fbranch (I.FBN) = "fbn"
211 :     | asm_fbranch (I.FBNE) = "fbne"
212 :     | asm_fbranch (I.FBLG) = "fblg"
213 :     | asm_fbranch (I.FBUL) = "fbul"
214 :     | asm_fbranch (I.FBL) = "fbl"
215 :     | asm_fbranch (I.FBUG) = "fbug"
216 :     | asm_fbranch (I.FBG) = "fbg"
217 :     | asm_fbranch (I.FBU) = "fbu"
218 :     | asm_fbranch (I.FBA) = "fb"
219 :     | asm_fbranch (I.FBE) = "fbe"
220 :     | asm_fbranch (I.FBUE) = "fbue"
221 :     | asm_fbranch (I.FBGE) = "fbge"
222 :     | asm_fbranch (I.FBUGE) = "fbuge"
223 :     | asm_fbranch (I.FBLE) = "fble"
224 :     | asm_fbranch (I.FBULE) = "fbule"
225 :     | asm_fbranch (I.FBO) = "fbo"
226 :     and emit_fbranch x = (emit (asm_fbranch x))
227 : monnier 429 and asm_load (I.LDSB) = "ldsb"
228 :     | asm_load (I.LDSH) = "ldsh"
229 :     | asm_load (I.LDUB) = "ldub"
230 :     | asm_load (I.LDUH) = "lduh"
231 :     | asm_load (I.LD) = "ld"
232 :     | asm_load (I.LDX) = "ldx"
233 :     | asm_load (I.LDD) = "ldd"
234 :     and emit_load x = (emit (asm_load x))
235 :     and asm_farith2 (I.FADDs) = "fadds"
236 :     | asm_farith2 (I.FADDd) = "faddd"
237 :     | asm_farith2 (I.FADDq) = "faddq"
238 :     | asm_farith2 (I.FSUBs) = "fsubs"
239 :     | asm_farith2 (I.FSUBd) = "fsubd"
240 :     | asm_farith2 (I.FSUBq) = "fsubq"
241 :     | asm_farith2 (I.FMULs) = "fmuls"
242 :     | asm_farith2 (I.FMULd) = "fmuld"
243 :     | asm_farith2 (I.FMULq) = "fmulq"
244 :     | asm_farith2 (I.FsMULd) = "fsmuld"
245 :     | asm_farith2 (I.FdMULq) = "fdmulq"
246 :     | asm_farith2 (I.FDIVs) = "fdivs"
247 :     | asm_farith2 (I.FDIVd) = "fdivd"
248 :     | asm_farith2 (I.FDIVq) = "fdivq"
249 :     and emit_farith2 x = (emit (asm_farith2 x))
250 : monnier 247
251 : monnier 411 fun emit_leaf false = ()
252 :     | emit_leaf true = (emit "l")
253 : monnier 247
254 : monnier 411 fun emit_nop false = ()
255 :     | emit_nop true = (emit "\n\tnop")
256 : monnier 247
257 : monnier 411 fun emit_a false = ()
258 :     | emit_a true = (emit ",a")
259 : monnier 247
260 : monnier 411 fun emit_cc false = ()
261 :     | emit_cc true = (emit "cc")
262 : monnier 247
263 : monnier 411 fun emitInstr instr =
264 :     ((tab ());
265 :    
266 :     (
267 :     case instr of
268 :     I.LOAD{l, d, r, i, mem} =>
269 :     ((emit_load l);
270 :     (emit "\t[");
271 :     (emit_GP r);
272 :     (emit "+");
273 :     (emit_operand i);
274 :     (emit "], ");
275 :     (emit_GP d);
276 :     (emit_region mem))
277 :     | I.STORE{s, d, r, i, mem} =>
278 :     ((emit_store s);
279 :     (emit "\t");
280 :     (emit_GP d);
281 :     (emit ", [");
282 :     (emit_GP r);
283 :     (emit "+");
284 :     (emit_operand i);
285 :     (emit "]");
286 :     (emit_region mem))
287 :     | I.FLOAD{l, r, i, d, mem} =>
288 :     ((emit_fload l);
289 :     (emit "\t[");
290 :     (emit_GP r);
291 :     (emit "+");
292 :     (emit_operand i);
293 :     (emit "], ");
294 :     (emit_FP d);
295 :     (emit_region mem))
296 :     | I.FSTORE{s, d, r, i, mem} =>
297 :     ((emit_fstore s);
298 :     (emit "\t[");
299 :     (emit_GP r);
300 :     (emit "+");
301 :     (emit_operand i);
302 :     (emit "], ");
303 :     (emit_FP d);
304 :     (emit_region mem))
305 :     | I.SETHI{i, d} =>
306 :     ((emit "sethi\t%hi(0x");
307 :     (emit (Word32.toString (Word32.<< ((Word32.fromInt i), 0wxa))));
308 :     (emit "), ");
309 :     (emit_GP d))
310 :     | I.ARITH{a, r, i, d} =>
311 :     ((emit_arith a);
312 :     (emit "\t");
313 :     (emit_GP r);
314 :     (emit ", ");
315 :     (emit_operand i);
316 :     (emit ", ");
317 :     (emit_GP d))
318 :     | I.SHIFT{s, r, i, d} =>
319 :     ((emit_shift s);
320 :     (emit "\t");
321 :     (emit_GP r);
322 :     (emit ", ");
323 :     (emit_operand i);
324 :     (emit ", ");
325 :     (emit_GP d))
326 :     | I.MOVicc{b, i, d} =>
327 :     ((emit "mov");
328 :     (emit_branch b);
329 :     (emit "\t");
330 :     (emit_operand i);
331 :     (emit ", ");
332 :     (emit_GP d))
333 :     | I.MOVfcc{b, i, d} =>
334 :     ((emit "mov");
335 :     (emit_fbranch b);
336 :     (emit "\t");
337 :     (emit_operand i);
338 :     (emit ", ");
339 :     (emit_GP d))
340 :     | I.MOVR{rcond, r, i, d} =>
341 :     ((emit "movr");
342 :     (emit_rcond rcond);
343 :     (emit "\t");
344 :     (emit_GP r);
345 :     (emit ", ");
346 :     (emit_operand i);
347 :     (emit ", ");
348 :     (emit_GP d))
349 :     | I.FMOVicc{sz, b, r, d} =>
350 :     ((emit "fmov");
351 :     (emit_fsize sz);
352 :     (emit_branch b);
353 :     (emit "\t");
354 :     (emit_FP r);
355 :     (emit ", ");
356 :     (emit_FP d))
357 :     | I.FMOVfcc{sz, b, r, d} =>
358 :     ((emit "fmov");
359 :     (emit_fsize sz);
360 :     (emit_fbranch b);
361 :     (emit "\t");
362 :     (emit_FP r);
363 :     (emit ", ");
364 :     (emit_FP d))
365 :     | I.Bicc{b, a, label, nop} =>
366 :     ((emit "b");
367 :     (emit_branch b);
368 :     (emit_a a);
369 :     (emit "\t");
370 :     (emit_label label);
371 :     (emit_nop nop))
372 :     | I.FBfcc{b, a, label, nop} =>
373 :     ((emit_fbranch b);
374 :     (emit_a a);
375 :     (emit "\t");
376 :     (emit_label label);
377 :     (emit_nop nop))
378 :     | I.BR{rcond, p, r, a, label, nop} =>
379 :     ((emit "b");
380 :     (emit_rcond rcond);
381 :     (emit_a a);
382 :     (emit_prediction p);
383 :     (emit "\t");
384 :     (emit_GP r);
385 :     (emit ", ");
386 :     (emit_label label);
387 :     (emit_nop nop))
388 :     | I.BP{b, p, cc, a, label, nop} =>
389 :     ((emit "bp");
390 :     (emit_branch b);
391 :     (emit_a a);
392 :     (emit_prediction p);
393 :     (emit "\t%");
394 :     (emit (if (cc = I.ICC)
395 :     then "i"
396 :     else "x"));
397 :     (emit "cc, ");
398 :     (emit_label label);
399 :     (emit_nop nop))
400 :     | I.JMP{r, i, labs, nop} =>
401 :     ((emit "jmp\t[");
402 :     (emit_GP r);
403 :     (emit "+");
404 :     (emit_operand i);
405 :     (emit "]");
406 :     (emit_nop nop))
407 :     | I.JMPL{r, i, d, defs, uses, nop, mem} =>
408 :     ((emit "jmpl\t[");
409 :     (emit_GP r);
410 :     (emit "+");
411 :     (emit_operand i);
412 :     (emit "], ");
413 :     (emit_GP d);
414 :     (emit_region mem);
415 :     (emit_nop nop))
416 :     | I.CALL{defs, uses, label, nop, mem} =>
417 :     ((emit "call\t");
418 :     (emit_label label);
419 :     (emit_region mem);
420 :     (emit_nop nop))
421 :     | I.Ticc{t, cc, r, i} =>
422 :     ((emit "t");
423 :     (emit_branch t);
424 :     (emit "\t");
425 :     (if (cc = I.ICC)
426 :     then ()
427 :     else (emit "%xcc, "));
428 :     (emit_GP r);
429 :     (emit ", ");
430 :     (emit_operand i))
431 :     | I.FPop1{a, r, d} => let
432 : monnier 247
433 : monnier 411 (*#line 508.1 "sparc/sparc.md"*)
434 : monnier 247
435 : monnier 411 fun f (a, r, d) =
436 :     ((emit a);
437 :     (emit "\t");
438 :     (emit_FP r);
439 :     (emit ", ");
440 :     (emit_FP d))
441 : monnier 247
442 : monnier 411 (*#line 510.1 "sparc/sparc.md"*)
443 : monnier 247
444 : monnier 411 fun g (a, r, d) = let
445 : monnier 247
446 : monnier 411 (*#line 511.1 "sparc/sparc.md"*)
447 :     val r = (regmap r)
448 :     and d = (regmap d)
449 :     in (f (a, r, d));
450 :     (emit "\n\t");
451 :     (f ("fmovs", (r + 1), (d + 1)))
452 :     end
453 : monnier 247
454 :    
455 : monnier 411 (*#line 515.1 "sparc/sparc.md"*)
456 :    
457 :     fun h (a, r, d) = let
458 :    
459 :     (*#line 516.1 "sparc/sparc.md"*)
460 :     val r = (regmap r)
461 :     and d = (regmap d)
462 :     in (f (a, r, d));
463 :     (emit "\n\t");
464 :     (f ("fmovs", (r + 1), (d + 1)));
465 :     (emit "\n\t");
466 :     (f ("fmovs", (r + 2), (d + 2)));
467 :     (emit "\n\t");
468 :     (f ("fmovs", (r + 3), (d + 3)))
469 :     end
470 :    
471 :     in (if V9
472 :     then (f ((asm_farith1 a), r, d))
473 :     else
474 :     (
475 :     case a of
476 :     I.FMOVd => (g ("fmovs", r, d))
477 :     | I.FNEGd => (g ("fnegs", r, d))
478 :     | I.FABSd => (g ("fabss", r, d))
479 :     | I.FMOVq => (h ("fmovs", r, d))
480 :     | I.FNEGq => (h ("fnegs", r, d))
481 :     | I.FABSq => (h ("fabss", r, d))
482 :     | _ => (f ((asm_farith1 a), r, d))
483 :     ))
484 :     end
485 :    
486 :     | I.FPop2{a, r1, r2, d} =>
487 :     ((emit_farith2 a);
488 :     (emit "\t");
489 :     (emit_FP r1);
490 :     (emit ", ");
491 :     (emit_FP r2);
492 :     (emit ", ");
493 :     (emit_FP d))
494 :     | I.FCMP{cmp, r1, r2, nop} =>
495 :     ((emit_fcmp cmp);
496 :     (emit "\t");
497 :     (emit_FP r1);
498 :     (emit ", ");
499 :     (emit_FP r2);
500 :     (emit_nop nop))
501 :     | I.COPY{dst, src, impl, tmp} => (emitInstrs (Shuffle.shuffle {regmap=regmap, tmp=tmp, src=src, dst=dst}))
502 :     | I.FCOPY{dst, src, impl, tmp} => (emitInstrs (Shuffle.shufflefp {regmap=regmap, tmp=tmp, src=src, dst=dst}))
503 :     | I.SAVE{r, i, d} =>
504 :     ((emit "save\t");
505 :     (emit_GP r);
506 :     (emit ", ");
507 :     (emit_operand i);
508 :     (emit ", ");
509 :     (emit_GP d))
510 :     | I.RESTORE{r, i, d} =>
511 :     ((emit "restore\t");
512 :     (emit_GP r);
513 :     (emit ", ");
514 :     (emit_operand i);
515 :     (emit ", ");
516 :     (emit_GP d))
517 :     | I.RDY{d} =>
518 :     ((emit "rd\t%y, ");
519 :     (emit_GP d))
520 :     | I.WRY{r, i} =>
521 :     ((emit "wr\t");
522 :     (emit_GP r);
523 :     (emit ", ");
524 :     (emit_operand i);
525 :     (emit ", %y"))
526 :     | I.RET{leaf, nop} =>
527 :     ((emit "ret");
528 :     (emit_leaf leaf);
529 :     (emit_nop nop))
530 :     | I.ANNOTATION{i, a} =>
531 :     ((emitInstr i);
532 :     (comment (Annotations.toString a)))
533 :     | I.GROUP annotation => (comment (Annotations.toString annotation))
534 :     );
535 :     (nl ()))
536 :     and emitInstrs [] = ()
537 :     | emitInstrs (i::is) =
538 :     (emitInstr i; app (fn i => (tab(); emitInstr i)) is)
539 :     in emitInstr end
540 :    
541 : monnier 429 in S.STREAM{beginCluster=init,
542 : monnier 411 pseudoOp=pseudoOp,
543 :     emit=emitter,
544 : monnier 429 endCluster=doNothing,
545 : monnier 411 defineLabel=defineLabel,
546 :     entryLabel=entryLabel,
547 :     comment=comment,
548 :     exitBlock=doNothing,
549 : monnier 429 annotation=annotation,
550 :     phi=doNothing,
551 :     alias=doNothing
552 : monnier 411 }
553 : monnier 247 end
554 : monnier 411 end
555 :    

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