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

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