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

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