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

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