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

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