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/x86/emit/x86Asm.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/x86/emit/x86Asm.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 583 - (view) (download)

1 : monnier 411 (*
2 : george 545 * This file was automatically generated by MDGen (v2.0)
3 : monnier 411 * from the machine description file "x86/x86.md".
4 : monnier 247 *)
5 :    
6 :    
7 : monnier 411 functor X86AsmEmitter(structure Instr : X86INSTR
8 :     structure Stream : INSTRUCTION_STREAM
9 :     structure Shuffle : X86SHUFFLE
10 :     where I = Instr
11 :    
12 : leunga 583 (*#line 195.7 "x86/x86.md"*)
13 : monnier 411 structure MemRegs : MEMORY_REGISTERS where I=Instr
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 : george 545 structure LabelExp = I.LabelExp
21 : monnier 411 structure Constant = I.Constant
22 :    
23 : monnier 498 val show_cellset = MLRiscControl.getFlag "asm-show-cellset"
24 : george 545 val show_region = MLRiscControl.getFlag "asm-show-region"
25 : monnier 498
26 : george 545 fun error msg = MLRiscErrorMsg.error("X86AsmEmitter",msg)
27 : monnier 411
28 : monnier 429 fun makeStream formatAnnotations =
29 : monnier 411 let val stream = !AsmStream.asmOutStream
30 : monnier 429 fun emit' s = TextIO.output(stream,s)
31 :     val newline = ref true
32 :     val tabs = ref 0
33 :     fun tabbing 0 = ()
34 :     | tabbing n = (emit' "\t"; tabbing(n-1))
35 :     fun emit s = (tabbing(!tabs); tabs := 0; newline := false; emit' s)
36 :     fun nl() = (tabs := 0; if !newline then () else (newline := true; emit' "\n"))
37 : monnier 411 fun comma() = emit ","
38 : monnier 429 fun tab() = tabs := !tabs + 1
39 :     fun ms n = let val s = Int.toString n
40 :     in if n<0 then "-"^String.substring(s,1,size s-1)
41 :     else s
42 :     end
43 : monnier 411 fun emit_label lab = emit(Label.nameOf lab)
44 :     fun emit_labexp le = emit(LabelExp.toString le)
45 :     fun emit_const c = emit(Constant.toString c)
46 :     fun emit_int i = emit(ms i)
47 :     fun paren f = (emit "("; f(); emit ")")
48 :     fun defineLabel lab = emit(Label.nameOf lab^":\n")
49 :     fun entryLabel lab = defineLabel lab
50 :     fun comment msg = emit("\t/* " ^ msg ^ " */")
51 :     fun annotation a = (comment(Annotations.toString a); nl())
52 : george 545 fun doNothing _ = ()
53 : monnier 411 fun emit_region mem = comment(I.Region.toString mem)
54 : george 545 val emit_region =
55 :     if !show_region then emit_region else doNothing
56 : monnier 411 fun pseudoOp pOp = emit(P.toString pOp)
57 :     fun init size = (comment("Code Size = " ^ ms size); nl())
58 :     fun emitter regmap =
59 :     let
60 : george 545 val emitRegInfo = AsmFormatUtil.reginfo
61 :     (emit,regmap,formatAnnotations)
62 :     fun emit_GP r =
63 :     ( emit (C.showGP (regmap r));
64 :     emitRegInfo r )
65 : monnier 429 and emit_FP r =
66 : george 545 ( emit (C.showFP (regmap r));
67 :     emitRegInfo r )
68 :     and emit_CC r =
69 :     ( emit (C.showCC (regmap r));
70 :     emitRegInfo r )
71 :     and emit_MEM r =
72 :     ( emit (C.showMEM (regmap r));
73 :     emitRegInfo r )
74 :     and emit_CTRL r =
75 :     ( emit (C.showCTRL (regmap r));
76 :     emitRegInfo r )
77 : monnier 498
78 :     fun emit_cellset(title,cellset) =
79 :     (nl(); comment(title^C.cellsetToString' regmap cellset))
80 : george 545 val emit_cellset =
81 :     if !show_cellset then emit_cellset else doNothing
82 : monnier 498 fun emit_defs cellset = emit_cellset("defs: ",cellset)
83 :     fun emit_uses cellset = emit_cellset("uses: ",cellset)
84 : george 545 fun asm_cond (I.EQ) = "e"
85 :     | asm_cond (I.NE) = "ne"
86 :     | asm_cond (I.LT) = "l"
87 :     | asm_cond (I.LE) = "le"
88 :     | asm_cond (I.GT) = "g"
89 :     | asm_cond (I.GE) = "ge"
90 :     | asm_cond (I.B) = "b"
91 :     | asm_cond (I.BE) = "be"
92 :     | asm_cond (I.A) = "a"
93 :     | asm_cond (I.AE) = "ae"
94 :     | asm_cond (I.C) = "c"
95 :     | asm_cond (I.NC) = "nc"
96 :     | asm_cond (I.P) = "p"
97 :     | asm_cond (I.NP) = "np"
98 :     | asm_cond (I.O) = "o"
99 :     | asm_cond (I.NO) = "no"
100 :     and emit_cond x = emit (asm_cond x)
101 :     and asm_binaryOp (I.ADDL) = "addl"
102 :     | asm_binaryOp (I.SUBL) = "subl"
103 :     | asm_binaryOp (I.ANDL) = "andl"
104 :     | asm_binaryOp (I.ORL) = "orl"
105 :     | asm_binaryOp (I.XORL) = "xorl"
106 :     | asm_binaryOp (I.SHLL) = "shll"
107 :     | asm_binaryOp (I.SARL) = "sarl"
108 :     | asm_binaryOp (I.SHRL) = "shrl"
109 :     | asm_binaryOp (I.ADCL) = "adcl"
110 :     | asm_binaryOp (I.SBBL) = "sbbl"
111 :     | asm_binaryOp (I.ADDW) = "addw"
112 :     | asm_binaryOp (I.SUBW) = "subw"
113 :     | asm_binaryOp (I.ANDW) = "andw"
114 :     | asm_binaryOp (I.ORW) = "orw"
115 :     | asm_binaryOp (I.XORW) = "xorw"
116 :     | asm_binaryOp (I.SHLW) = "shlw"
117 :     | asm_binaryOp (I.SARW) = "sarw"
118 :     | asm_binaryOp (I.SHRW) = "shrw"
119 :     | asm_binaryOp (I.ADDB) = "addb"
120 :     | asm_binaryOp (I.SUBB) = "subb"
121 :     | asm_binaryOp (I.ANDB) = "andb"
122 :     | asm_binaryOp (I.ORB) = "orb"
123 :     | asm_binaryOp (I.XORB) = "xorb"
124 :     | asm_binaryOp (I.SHLB) = "shlb"
125 :     | asm_binaryOp (I.SARB) = "sarb"
126 :     | asm_binaryOp (I.SHRB) = "shrb"
127 :     and emit_binaryOp x = emit (asm_binaryOp x)
128 :     and asm_multDivOp (I.UMUL) = "umul"
129 :     | asm_multDivOp (I.IDIV) = "idiv"
130 :     | asm_multDivOp (I.UDIV) = "udiv"
131 :     and emit_multDivOp x = emit (asm_multDivOp x)
132 :     and asm_unaryOp (I.DECL) = "decl"
133 :     | asm_unaryOp (I.INCL) = "incl"
134 :     | asm_unaryOp (I.NEGL) = "negl"
135 :     | asm_unaryOp (I.NOTL) = "notl"
136 :     | asm_unaryOp (I.NOTW) = "notw"
137 :     | asm_unaryOp (I.NOTB) = "notb"
138 :     and emit_unaryOp x = emit (asm_unaryOp x)
139 :     and asm_move (I.MOVL) = "movl"
140 :     | asm_move (I.MOVB) = "movb"
141 :     | asm_move (I.MOVW) = "movw"
142 :     | asm_move (I.MOVSWL) = "movswl"
143 :     | asm_move (I.MOVZWL) = "movzwl"
144 :     | asm_move (I.MOVSBL) = "movsbl"
145 :     | asm_move (I.MOVZBL) = "movzbl"
146 :     and emit_move x = emit (asm_move x)
147 : monnier 429 and asm_fbinOp (I.FADDP) = "faddp"
148 : george 555 | asm_fbinOp (I.FADDS) = "fadds"
149 : monnier 411 | asm_fbinOp (I.FMULP) = "fmulp"
150 : george 555 | asm_fbinOp (I.FMULS) = "fmuls"
151 : leunga 565 | asm_fbinOp (I.FCOMS) = "fcoms"
152 :     | asm_fbinOp (I.FCOMPS) = "fcomps"
153 : monnier 411 | asm_fbinOp (I.FSUBP) = "fsubp"
154 : george 555 | asm_fbinOp (I.FSUBS) = "fsubs"
155 : monnier 411 | asm_fbinOp (I.FSUBRP) = "fsubrp"
156 : george 555 | asm_fbinOp (I.FSUBRS) = "fsubrs"
157 : monnier 411 | asm_fbinOp (I.FDIVP) = "fdivp"
158 : george 555 | asm_fbinOp (I.FDIVS) = "fdivs"
159 : monnier 411 | asm_fbinOp (I.FDIVRP) = "fdivrp"
160 : george 555 | asm_fbinOp (I.FDIVRS) = "fdivrs"
161 :     | asm_fbinOp (I.FADDL) = "faddl"
162 :     | asm_fbinOp (I.FMULL) = "fmull"
163 : leunga 565 | asm_fbinOp (I.FCOML) = "fcoml"
164 :     | asm_fbinOp (I.FCOMPL) = "fcompl"
165 : george 555 | asm_fbinOp (I.FSUBL) = "fsubl"
166 :     | asm_fbinOp (I.FSUBRL) = "fsubrl"
167 :     | asm_fbinOp (I.FDIVL) = "fdivl"
168 :     | asm_fbinOp (I.FDIVRL) = "fdivrl"
169 : george 545 and emit_fbinOp x = emit (asm_fbinOp x)
170 : leunga 565 and asm_fibinOp (I.FIADDS) = "fiadds"
171 :     | asm_fibinOp (I.FIMULS) = "fimuls"
172 :     | asm_fibinOp (I.FICOMS) = "ficoms"
173 :     | asm_fibinOp (I.FICOMPS) = "ficomps"
174 :     | asm_fibinOp (I.FISUBS) = "fisubs"
175 :     | asm_fibinOp (I.FISUBRS) = "fisubrs"
176 :     | asm_fibinOp (I.FIDIVS) = "fidivs"
177 :     | asm_fibinOp (I.FIDIVRS) = "fidivrs"
178 :     | asm_fibinOp (I.FIADDL) = "fiaddl"
179 :     | asm_fibinOp (I.FIMULL) = "fimull"
180 :     | asm_fibinOp (I.FICOML) = "ficoml"
181 :     | asm_fibinOp (I.FICOMPL) = "ficompl"
182 :     | asm_fibinOp (I.FISUBL) = "fisubl"
183 :     | asm_fibinOp (I.FISUBRL) = "fisubrl"
184 :     | asm_fibinOp (I.FIDIVL) = "fidivl"
185 :     | asm_fibinOp (I.FIDIVRL) = "fidivrl"
186 :     and emit_fibinOp x = emit (asm_fibinOp x)
187 : monnier 429 and asm_funOp (I.FABS) = "fabs"
188 :     | asm_funOp (I.FCHS) = "fchs"
189 : george 545 | asm_funOp (I.FSIN) = "fsin"
190 :     | asm_funOp (I.FCOS) = "fcos"
191 :     | asm_funOp (I.FTAN) = "ftan"
192 :     | asm_funOp (I.FSCALE) = "fscale"
193 :     | asm_funOp (I.FRNDINT) = "frndint"
194 :     | asm_funOp (I.FSQRT) = "fsqrt"
195 :     | asm_funOp (I.FTST) = "ftst"
196 :     | asm_funOp (I.FXAM) = "fxam"
197 :     | asm_funOp (I.FINCSTP) = "fincstp"
198 :     | asm_funOp (I.FDECSTP) = "fdecstp"
199 :     and emit_funOp x = emit (asm_funOp x)
200 :     and asm_fenvOp (I.FLDENV) = "fldenv"
201 :     | asm_fenvOp (I.FNLDENV) = "fnldenv"
202 :     | asm_fenvOp (I.FSTENV) = "fstenv"
203 :     | asm_fenvOp (I.FNSTENV) = "fnstenv"
204 :     and emit_fenvOp x = emit (asm_fenvOp x)
205 : monnier 247
206 : leunga 583 (*#line 197.6 "x86/x86.md"*)
207 : george 545 val memReg = MemRegs.memReg regmap
208 :    
209 : leunga 583 (*#line 198.6 "x86/x86.md"*)
210 : monnier 429 fun emitInt32 i = let
211 : monnier 247
212 : leunga 583 (*#line 199.10 "x86/x86.md"*)
213 : george 545 val s = Int32.toString i
214 : monnier 429
215 : leunga 583 (*#line 200.10 "x86/x86.md"*)
216 : monnier 429 val s = (if (i >= 0)
217 : george 545 then s
218 :     else ("-" ^ (String.substring (s, 1, (size s) - 1))))
219 :     in emit s
220 : monnier 429 end
221 :    
222 :    
223 : leunga 583 (*#line 203.6 "x86/x86.md"*)
224 : george 545 fun emitScale 0 = emit "1"
225 :     | emitScale 1 = emit "2"
226 :     | emitScale 2 = emit "4"
227 :     | emitScale 3 = emit "8"
228 :     | emitScale _ = error "emitScale"
229 :     and eImmed (I.Immed i) = emitInt32 i
230 :     | eImmed (I.ImmedLabel lexp) = emit_labexp lexp
231 :     | eImmed _ = error "eImmed"
232 : monnier 411 and emit_operand opn =
233 :     (
234 :     case opn of
235 :     I.Immed i =>
236 : george 545 ( emit "$";
237 :     emitInt32 i )
238 : monnier 411 | I.ImmedLabel lexp =>
239 : george 545 ( emit "$";
240 :     emit_labexp lexp )
241 :     | I.LabelEA le => emit_labexp le
242 :     | I.Relative _ => error "emit_operand"
243 :     | I.Direct r => emit_GP r
244 :     | I.MemReg r => emit_operand (memReg opn)
245 : george 555 | I.ST f => emit_FP f
246 :     | I.FDirect f => emit_operand (memReg opn)
247 : monnier 411 | I.Displace{base, disp, mem, ...} =>
248 : george 545 ( emit_disp disp;
249 :     emit "(";
250 :     emit_GP base;
251 :     emit ")";
252 :     emit_region mem )
253 : leunga 576 | I.Indexed{base, index, scale, disp, mem, ...} =>
254 : george 545 ( emit_disp disp;
255 :     emit "(";
256 : leunga 576
257 :     (
258 :     case base of
259 :     NONE => ()
260 :     | SOME base => emit_GP base
261 :     );
262 : george 545 comma ();
263 :     emit_GP index;
264 :     comma ();
265 :     emitScale scale;
266 :     emit ")";
267 :     emit_region mem )
268 : monnier 411 )
269 : george 545 and emit_disp (I.Immed 0) = ()
270 :     | emit_disp (I.Immed i) = emitInt32 i
271 :     | emit_disp (I.ImmedLabel lexp) = emit_labexp lexp
272 :     | emit_disp _ = error "emit_disp"
273 : monnier 247
274 : leunga 583 (*#line 243.7 "x86/x86.md"*)
275 : george 545 fun stupidGas (I.ImmedLabel lexp) = emit_labexp lexp
276 :     | stupidGas (I.LabelEA _) = error "stupidGas"
277 :     | stupidGas opnd = emit_operand opnd
278 :    
279 : leunga 583 (*#line 248.7 "x86/x86.md"*)
280 : george 555 fun isMemOpnd (I.MemReg _) = true
281 :     | isMemOpnd (I.FDirect f) = true
282 :     | isMemOpnd (I.LabelEA _) = true
283 :     | isMemOpnd (I.Displace _) = true
284 :     | isMemOpnd (I.Indexed _) = true
285 :     | isMemOpnd _ = false
286 :    
287 : leunga 583 (*#line 254.7 "x86/x86.md"*)
288 : leunga 565 fun chop fbinOp = let
289 : george 555
290 : leunga 583 (*#line 255.15 "x86/x86.md"*)
291 : leunga 565 val n = size fbinOp
292 :     in
293 :     (
294 :     case Char.toLower (String.sub (fbinOp, n - 1)) of
295 :     (#"s" | #"l") => String.substring (fbinOp, 0, n - 1)
296 :     | _ => fbinOp
297 :     )
298 :     end
299 : george 555
300 : leunga 565
301 : leunga 583 (*#line 261.7 "x86/x86.md"*)
302 : monnier 411 val emit_dst = emit_operand
303 : george 545
304 : leunga 583 (*#line 262.7 "x86/x86.md"*)
305 : monnier 411 val emit_src = emit_operand
306 : george 545
307 : leunga 583 (*#line 263.7 "x86/x86.md"*)
308 : monnier 411 val emit_opnd = emit_operand
309 : george 545
310 : leunga 583 (*#line 264.7 "x86/x86.md"*)
311 : monnier 411 val emit_rsrc = emit_operand
312 : george 545
313 : leunga 583 (*#line 265.7 "x86/x86.md"*)
314 : monnier 411 val emit_lsrc = emit_operand
315 : george 545
316 : leunga 583 (*#line 266.7 "x86/x86.md"*)
317 : monnier 411 val emit_addr = emit_operand
318 : monnier 247
319 : leunga 583 (*#line 267.7 "x86/x86.md"*)
320 : george 545 val emit_src1 = emit_operand
321 : monnier 411 fun emitInstr instr =
322 : george 545 ( tab ();
323 : monnier 411
324 :     (
325 :     case instr of
326 : george 545 I.NOP => emit "nop"
327 : monnier 411 | I.JMP(operand, label) =>
328 : george 545 ( emit "jmp\t";
329 :     stupidGas operand )
330 : monnier 247 | I.JCC{cond, opnd} =>
331 : george 545 ( emit "j";
332 :     emit_cond cond;
333 :     emit "\t";
334 :     stupidGas opnd )
335 : monnier 411 | I.CALL(operand, cellset1, cellset2, region) =>
336 : george 545 ( emit "call\t";
337 :     stupidGas operand;
338 :     emit_region region;
339 :     emit_defs cellset1;
340 :     emit_uses cellset2 )
341 :     | I.LEAVE => emit "leave"
342 : monnier 429 | I.RET operand =>
343 : george 545 ( emit "ret";
344 : monnier 429
345 :     (
346 :     case operand of
347 :     NONE => ()
348 :     | SOME e =>
349 : george 545 ( emit "\t";
350 :     emit_operand e )
351 : monnier 429 ))
352 : monnier 247 | I.MOVE{mvOp, src, dst} =>
353 : george 545 ( emit_move mvOp;
354 :     emit "\t";
355 :     emit_src src;
356 :     emit ", ";
357 :     emit_dst dst )
358 : monnier 247 | I.LEA{r32, addr} =>
359 : george 545 ( emit "leal\t";
360 :     emit_addr addr;
361 :     emit ", ";
362 :     emit_GP r32 )
363 :     | I.CMPL{lsrc, rsrc} =>
364 :     ( emit "cmpl\t";
365 :     emit_rsrc rsrc;
366 :     emit ", ";
367 :     emit_lsrc lsrc )
368 :     | I.CMPW{lsrc, rsrc} =>
369 :     ( emit "cmpb\t";
370 :     emit_rsrc rsrc;
371 :     emit ", ";
372 :     emit_lsrc lsrc )
373 :     | I.CMPB{lsrc, rsrc} =>
374 :     ( emit "cmpb\t";
375 :     emit_rsrc rsrc;
376 :     emit ", ";
377 :     emit_lsrc lsrc )
378 :     | I.TESTL{lsrc, rsrc} =>
379 :     ( emit "testl\t";
380 :     emit_rsrc rsrc;
381 :     emit ", ";
382 :     emit_lsrc lsrc )
383 :     | I.TESTW{lsrc, rsrc} =>
384 :     ( emit "testw\t";
385 :     emit_rsrc rsrc;
386 :     emit ", ";
387 :     emit_lsrc lsrc )
388 :     | I.TESTB{lsrc, rsrc} =>
389 :     ( emit "testb\t";
390 :     emit_rsrc rsrc;
391 :     emit ", ";
392 :     emit_lsrc lsrc )
393 : monnier 411 | I.BINARY{binOp, src, dst} =>
394 : george 545 (
395 :     case (src, binOp) of
396 :     (I.Direct _, (I.SARL | I.SHRL | I.SHLL | I.SARW | I.SHRW | I.SHLW | I.SARB | I.SHRB | I.SHLB)) =>
397 :     ( emit_binaryOp binOp;
398 :     emit "\t%cl, ";
399 :     emit_dst dst )
400 :     | _ =>
401 :     ( emit_binaryOp binOp;
402 :     emit "\t";
403 :     emit_src src;
404 :     emit ", ";
405 :     emit_dst dst )
406 :     )
407 : monnier 411 | I.MULTDIV{multDivOp, src} =>
408 : george 545 ( emit_multDivOp multDivOp;
409 :     emit "l\t";
410 :     emit_src src )
411 :     | I.MUL3{dst, src2, src1} =>
412 :     (
413 :     case src2 of
414 :     NONE =>
415 :     ( emit "imul\t";
416 :     emit_src1 src1;
417 :     emit ", ";
418 :     emit_GP dst )
419 :     | SOME i =>
420 :     ( emit "imul\t$";
421 :     emitInt32 i;
422 :     emit ", ";
423 :     emit_src1 src1;
424 :     emit ", ";
425 :     emit_GP dst )
426 :     )
427 : monnier 247 | I.UNARY{unOp, opnd} =>
428 : george 545 ( emit_unaryOp unOp;
429 :     emit "\t";
430 :     emit_opnd opnd )
431 :     | I.SET{cond, opnd} =>
432 :     ( emit "set";
433 :     emit_cond cond;
434 :     emit "\t";
435 :     emit_opnd opnd )
436 :     | I.CMOV{cond, src, dst} =>
437 :     ( emit "cmov";
438 :     emit_cond cond;
439 :     emit "\t";
440 :     emit_src src;
441 :     emit ", ";
442 :     emit_GP dst )
443 :     | I.PUSHL operand =>
444 :     ( emit "pushl\t";
445 :     emit_operand operand )
446 :     | I.PUSHW operand =>
447 :     ( emit "pushw\t";
448 :     emit_operand operand )
449 :     | I.PUSHB operand =>
450 :     ( emit "pushb\t";
451 :     emit_operand operand )
452 : monnier 411 | I.POP operand =>
453 : george 545 ( emit "popl\t";
454 :     emit_operand operand )
455 :     | I.CDQ => emit "cdq"
456 :     | I.INTO => emit "into"
457 :     | I.COPY{dst, src, tmp} => emitInstrs (Shuffle.shuffle {regmap=regmap, tmp=tmp, dst=dst, src=src})
458 :     | I.FCOPY{dst, src, tmp} => emitInstrs (Shuffle.shufflefp {regmap=regmap, tmp=tmp, dst=dst, src=src})
459 : leunga 565 | I.FBINARY{binOp, src, dst} => (if (isMemOpnd src)
460 :     then
461 :     ( emit_fbinOp binOp;
462 :     emit "\t";
463 :     emit_src src )
464 :     else
465 :     ( emit (chop (asm_fbinOp binOp));
466 :     emit "\t";
467 :     emit_src src;
468 :     emit ", ";
469 :     emit_dst dst ))
470 :     | I.FIBINARY{binOp, src} =>
471 :     ( emit_fibinOp binOp;
472 : george 545 emit "\t";
473 : leunga 565 emit_src src )
474 : george 545 | I.FUNARY funOp => emit_funOp funOp
475 :     | I.FUCOMPP => emit "fucompp"
476 :     | I.FCOMPP => emit "fcompp"
477 :     | I.FXCH{opnd} =>
478 :     ( emit "fxch\t";
479 :     (if (opnd = (C.ST 1))
480 :     then ()
481 :     else (emit_FP opnd)))
482 :     | I.FSTPL operand =>
483 :     ( emit "fstpl\t";
484 :     emit_operand operand )
485 :     | I.FSTPS operand =>
486 :     ( emit "fstps\t";
487 :     emit_operand operand )
488 : george 555 | I.FSTPT operand =>
489 :     ( emit "fstps\t";
490 :     emit_operand operand )
491 : leunga 579 | I.FSTL operand =>
492 :     ( emit "fstl\t";
493 :     emit_operand operand )
494 :     | I.FSTS operand =>
495 :     ( emit "fsts\t";
496 :     emit_operand operand )
497 : leunga 565 | I.FLD1 => emit "fld1"
498 :     | I.FLDL2E => emit "fldl2e"
499 :     | I.FLDL2T => emit "fldl2t"
500 :     | I.FLDLG2 => emit "fldlg2"
501 :     | I.FLDLN2 => emit "fldln2"
502 :     | I.FLDPI => emit "fldpi"
503 :     | I.FLDZ => emit "fldz"
504 : george 545 | I.FLDL operand =>
505 :     ( emit "fldl\t";
506 :     emit_operand operand )
507 :     | I.FLDS operand =>
508 :     ( emit "flds\t";
509 :     emit_operand operand )
510 : george 555 | I.FLDT operand =>
511 :     ( emit "fldt\t";
512 :     emit_operand operand )
513 : monnier 411 | I.FILD operand =>
514 : george 545 ( emit "fild\t";
515 :     emit_operand operand )
516 : leunga 565 | I.FILDL operand =>
517 :     ( emit "fildl\t";
518 :     emit_operand operand )
519 :     | I.FILDLL operand =>
520 :     ( emit "fildll\t";
521 :     emit_operand operand )
522 : george 545 | I.FNSTSW => emit "fnstsw"
523 :     | I.FENV{fenvOp, opnd} =>
524 :     ( emit_fenvOp fenvOp;
525 :     emit "\t";
526 :     emit_opnd opnd )
527 :     | I.SAHF => emit "sahf"
528 : monnier 411 | I.ANNOTATION{i, a} =>
529 : george 545 ( emitInstr i;
530 :     comment (Annotations.toString a))
531 : monnier 411 );
532 : george 545 nl ())
533 : monnier 411 and emitInstrs [] = ()
534 :     | emitInstrs (i::is) =
535 :     (emitInstr i; app (fn i => (tab(); emitInstr i)) is)
536 :     in emitInstr end
537 :    
538 : monnier 429 in S.STREAM{beginCluster=init,
539 : monnier 411 pseudoOp=pseudoOp,
540 :     emit=emitter,
541 : monnier 429 endCluster=doNothing,
542 : monnier 411 defineLabel=defineLabel,
543 :     entryLabel=entryLabel,
544 :     comment=comment,
545 :     exitBlock=doNothing,
546 : monnier 429 annotation=annotation,
547 :     phi=doNothing,
548 :     alias=doNothing
549 : monnier 411 }
550 :     end
551 : monnier 247 end
552 :    

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