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

Annotation of /sml/trunk/src/MLRISC/sparc/emit/sparcAsm.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 796 - (view) (download)

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

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