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/branches/SMLNJ/src/MLRISC/hppa/emit/hppaAsm.sml
ViewVC logotype

Annotation of /sml/branches/SMLNJ/src/MLRISC/hppa/emit/hppaAsm.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 498 - (view) (download)

1 : monnier 411 (*
2 :     * This file was automatically generated by MDGen
3 :     * from the machine description file "hppa/hppa.md".
4 : monnier 245 *)
5 :    
6 : monnier 411
7 :     functor HppaAsmEmitter(structure Instr : HPPAINSTR
8 :     structure Stream : INSTRUCTION_STREAM
9 :     structure Shuffle : HPPASHUFFLE
10 :     where I = Instr
11 :     ) : INSTRUCTION_EMITTER =
12 : monnier 245 struct
13 : monnier 411 structure I = Instr
14 :     structure C = I.C
15 :     structure S = Stream
16 :     structure P = S.P
17 :     structure LE = LabelExp
18 :     structure Constant = I.Constant
19 :    
20 : monnier 498 val show_cellset = MLRiscControl.getFlag "asm-show-cellset"
21 :    
22 : monnier 411 fun error msg = MLRiscErrorMsg.error("HppaAsm",msg)
23 :    
24 : monnier 429 fun makeStream formatAnnotations =
25 : monnier 411 let val stream = !AsmStream.asmOutStream
26 : monnier 429 fun emit' s = TextIO.output(stream,s)
27 :     val newline = ref true
28 :     val tabs = ref 0
29 :     fun tabbing 0 = ()
30 :     | tabbing n = (emit' "\t"; tabbing(n-1))
31 :     fun emit s = (tabbing(!tabs); tabs := 0; newline := false; emit' s)
32 :     fun nl() = (tabs := 0; if !newline then () else (newline := true; emit' "\n"))
33 : monnier 411 fun comma() = emit ","
34 : monnier 429 fun tab() = tabs := !tabs + 1
35 :     fun ms n = let val s = Int.toString n
36 :     in if n<0 then "-"^String.substring(s,1,size s-1)
37 :     else s
38 :     end
39 : monnier 411 fun emit_label lab = emit(Label.nameOf lab)
40 :     fun emit_labexp le = emit(LabelExp.toString le)
41 :     fun emit_const c = emit(Constant.toString c)
42 :     fun emit_int i = emit(ms i)
43 :     fun paren f = (emit "("; f(); emit ")")
44 :     fun defineLabel lab = emit(Label.nameOf lab^":\n")
45 :     fun entryLabel lab = defineLabel lab
46 :     fun comment msg = emit("\t/* " ^ msg ^ " */")
47 :     fun annotation a = (comment(Annotations.toString a); nl())
48 :     fun emit_region mem = comment(I.Region.toString mem)
49 :     fun pseudoOp pOp = emit(P.toString pOp)
50 :     fun init size = (comment("Code Size = " ^ ms size); nl())
51 :     fun doNothing _ = ()
52 : monnier 429 val emitRegInfo = AsmFormatUtil.reginfo(emit,formatAnnotations)
53 : monnier 411 fun emitter regmap =
54 :     let
55 : monnier 245
56 : monnier 429 fun emit_CC r =
57 :     ((emit (C.showCC (regmap r)));
58 :     (emitRegInfo r))
59 :     and emit_CR r =
60 :     ((emit (C.showCR (regmap r)));
61 :     (emitRegInfo r))
62 :     and emit_FP r =
63 :     ((emit (C.showFP (regmap r)));
64 :     (emitRegInfo r))
65 :     and emit_GP r =
66 :     ((emit (C.showGP (regmap r)));
67 :     (emitRegInfo r))
68 : monnier 498
69 :     fun emit_cellset(title,cellset) =
70 :     if !show_cellset then
71 :     (nl(); comment(title^C.cellsetToString' regmap cellset))
72 :     else ()
73 :     fun emit_defs cellset = emit_cellset("defs: ",cellset)
74 :     fun emit_uses cellset = emit_cellset("uses: ",cellset)
75 : monnier 245
76 : monnier 429 fun asm_farith (I.FADD_S) = "fadd,sgl"
77 :     | asm_farith (I.FADD_D) = "fadd,dbl"
78 :     | asm_farith (I.FADD_Q) = "fadd,quad"
79 :     | asm_farith (I.FSUB_S) = "fsub,sgl"
80 :     | asm_farith (I.FSUB_D) = "fsub,dbl"
81 :     | asm_farith (I.FSUB_Q) = "fsub,quad"
82 :     | asm_farith (I.FMPY_S) = "fmpy,sgl"
83 :     | asm_farith (I.FMPY_D) = "fmpy,dbl"
84 :     | asm_farith (I.FMPY_Q) = "fmpy,quad"
85 :     | asm_farith (I.FDIV_S) = "fdiv,sgl"
86 :     | asm_farith (I.FDIV_D) = "fdiv,dbl"
87 :     | asm_farith (I.FDIV_Q) = "fdiv,quad"
88 :     | asm_farith (I.XMPYU) = "xmpyu"
89 :     and emit_farith x = (emit (asm_farith x))
90 :     and asm_floadx (I.FLDDX) = "flddx"
91 :     | asm_floadx (I.FLDDX_S) = "flddx,s"
92 :     | asm_floadx (I.FLDDX_M) = "flddx,m"
93 :     | asm_floadx (I.FLDDX_SM) = "flddx,sm"
94 :     | asm_floadx (I.FLDWX) = "fldwx"
95 :     | asm_floadx (I.FLDWX_S) = "fldwx,s"
96 :     | asm_floadx (I.FLDWX_M) = "fldwx,m"
97 :     | asm_floadx (I.FLDWX_SM) = "fldwx,sm"
98 :     and emit_floadx x = (emit (asm_floadx x))
99 : monnier 411 and asm_store (I.STW) = "stw"
100 :     | asm_store (I.STH) = "sth"
101 :     | asm_store (I.STB) = "stb"
102 :     and emit_store x = (emit (asm_store x))
103 : monnier 429 and asm_fstorex (I.FSTDX) = "fstdx"
104 :     | asm_fstorex (I.FSTDX_S) = "fstdx,s"
105 :     | asm_fstorex (I.FSTDX_M) = "fstdx,m"
106 :     | asm_fstorex (I.FSTDX_SM) = "fstdx,sm"
107 :     | asm_fstorex (I.FSTWX) = "fstwx"
108 :     | asm_fstorex (I.FSTWX_S) = "fstwx,s"
109 :     | asm_fstorex (I.FSTWX_M) = "fstwx,m"
110 :     | asm_fstorex (I.FSTWX_SM) = "fstwx,sm"
111 :     and emit_fstorex x = (emit (asm_fstorex x))
112 : monnier 411 and asm_fcond (I.False_) = "false?"
113 :     | asm_fcond (I.False) = "false"
114 :     | asm_fcond (I.?) = "?"
115 :     | asm_fcond (I.!<=>) = "!<=>"
116 :     | asm_fcond (I.==) = "=="
117 :     | asm_fcond (I.EQT) = "=T"
118 :     | asm_fcond (I.?=) = "?="
119 :     | asm_fcond (I.!<>) = "!<>"
120 :     | asm_fcond (I.!?>=) = "!?>="
121 :     | asm_fcond (I.<) = "<"
122 :     | asm_fcond (I.?<) = "?<"
123 :     | asm_fcond (I.!>=) = "!>="
124 :     | asm_fcond (I.!?>) = "!?>"
125 :     | asm_fcond (I.<=) = "<="
126 :     | asm_fcond (I.?<=) = "?<="
127 :     | asm_fcond (I.!>) = "!>"
128 :     | asm_fcond (I.!?<=) = "!?<="
129 :     | asm_fcond (I.>) = ">"
130 :     | asm_fcond (I.?>) = "?>"
131 :     | asm_fcond (I.!<=) = "!<="
132 :     | asm_fcond (I.!?<) = "!?<"
133 :     | asm_fcond (I.>=) = ">="
134 :     | asm_fcond (I.?>=) = "?>="
135 :     | asm_fcond (I.!<) = "!<"
136 :     | asm_fcond (I.!?=) = "!?="
137 :     | asm_fcond (I.<>) = "<>"
138 :     | asm_fcond (I.!=) = "!="
139 :     | asm_fcond (I.NET) = "!=T"
140 :     | asm_fcond (I.!?) = "!?"
141 :     | asm_fcond (I.<=>) = "<=>"
142 :     | asm_fcond (I.True_) = "true?"
143 :     | asm_fcond (I.True) = "true"
144 :     and emit_fcond x = (emit (asm_fcond x))
145 : monnier 429 and asm_loadi (I.LDW) = "ldw"
146 :     | asm_loadi (I.LDH) = "ldh"
147 :     | asm_loadi (I.LDB) = "ldb"
148 :     and emit_loadi x = (emit (asm_loadi x))
149 :     and emit_operand (I.IMMED int) = (emit_int int)
150 :     | emit_operand (I.LabExp(labexp, field_selector)) = (emit_labexp labexp)
151 :     | emit_operand (I.HILabExp(labexp, field_selector)) = (emit_labexp labexp)
152 :     | emit_operand (I.LOLabExp(labexp, field_selector)) = (emit_labexp labexp)
153 :     | emit_operand (I.ConstOp const) = (emit_const const)
154 :     and asm_fmt (I.SGL) = "sgl"
155 :     | asm_fmt (I.DBL) = "dbl"
156 :     | asm_fmt (I.QUAD) = "quad"
157 :     and emit_fmt x = (emit (asm_fmt x))
158 :     and asm_fload (I.FLDDS) = "fldds"
159 :     | asm_fload (I.FLDWS) = "fldws"
160 :     and emit_fload x = (emit (asm_fload x))
161 :     and asm_bcond (I.EQ) = "="
162 :     | asm_bcond (I.LT) = "<"
163 :     | asm_bcond (I.LE) = "<="
164 :     | asm_bcond (I.LTU) = "<<"
165 :     | asm_bcond (I.LEU) = "<<="
166 :     | asm_bcond (I.NE) = "<>"
167 :     | asm_bcond (I.GE) = ">="
168 :     | asm_bcond (I.GT) = ">"
169 :     | asm_bcond (I.GTU) = ">>"
170 :     | asm_bcond (I.GEU) = ">>="
171 :     and emit_bcond x = (emit (asm_bcond x))
172 :     and asm_funary (I.FCPY_S) = "fcpy,sgl"
173 :     | asm_funary (I.FCPY_D) = "fcpy,dbl"
174 :     | asm_funary (I.FCPY_Q) = "fcpy,quad"
175 :     | asm_funary (I.FABS_S) = "fabs,sgl"
176 :     | asm_funary (I.FABS_D) = "fabs,dbl"
177 :     | asm_funary (I.FABS_Q) = "fabs,quad"
178 :     | asm_funary (I.FSQRT_S) = "fsqrt,sgl"
179 :     | asm_funary (I.FSQRT_D) = "fsqrt,dbl"
180 :     | asm_funary (I.FSQRT_Q) = "fsqrt,quad"
181 :     | asm_funary (I.FRND_S) = "frnd,sgl"
182 :     | asm_funary (I.FRND_D) = "frnd,dbl"
183 :     | asm_funary (I.FRND_Q) = "frnd,quad"
184 :     and emit_funary x = (emit (asm_funary x))
185 :     and asm_shiftv (I.VEXTRU) = "vextru"
186 :     | asm_shiftv (I.VEXTRS) = "vextrs"
187 :     | asm_shiftv (I.ZVDEP) = "zvdep"
188 :     and emit_shiftv x = (emit (asm_shiftv x))
189 :     and asm_fstore (I.FSTDS) = "fstds"
190 :     | asm_fstore (I.FSTWS) = "fstws"
191 :     and emit_fstore x = (emit (asm_fstore x))
192 :     and asm_bitcond (I.BSET) = "<"
193 :     | asm_bitcond (I.BCLR) = ">="
194 :     and emit_bitcond x = (emit (asm_bitcond x))
195 :     and asm_cmplt (I.ADDR) = ""
196 :     | asm_cmplt (I.ADDR_S) = ",s"
197 :     | asm_cmplt (I.ADDR_M) = ",m"
198 :     | asm_cmplt (I.ADDR_SM) = ",sm"
199 :     and emit_cmplt x = (emit (asm_cmplt x))
200 :     and asm_cmp (I.COMBT) = "combt"
201 :     | asm_cmp (I.COMBF) = "combf"
202 :     and emit_cmp x = (emit (asm_cmp x))
203 :     and asm_shift (I.EXTRU) = "extru"
204 :     | asm_shift (I.EXTRS) = "extrs"
205 :     | asm_shift (I.ZDEP) = "zdep"
206 :     and emit_shift x = (emit (asm_shift x))
207 : monnier 411 and asm_fcnv (I.FCNVFF_SD) = "fcnvff,sgl,dbl"
208 :     | asm_fcnv (I.FCNVFF_SQ) = "fcnvff,sgl,quad"
209 :     | asm_fcnv (I.FCNVFF_DS) = "fcnvff,dbl,sgl"
210 :     | asm_fcnv (I.FCNVFF_DQ) = "fcnvff,dbl,quad"
211 :     | asm_fcnv (I.FCNVFF_QS) = "fcnvff,quad,sgl"
212 :     | asm_fcnv (I.FCNVFF_QD) = "fcnvff,quad,dbl"
213 :     | asm_fcnv (I.FCNVXF_S) = "fcnvxf,,sgl"
214 :     | asm_fcnv (I.FCNVXF_D) = "fcnvxf,,dbl"
215 :     | asm_fcnv (I.FCNVXF_Q) = "fcnvxf,,quad"
216 :     | asm_fcnv (I.FCNVFX_S) = "fcnvfx,sgl,"
217 :     | asm_fcnv (I.FCNVFX_D) = "fcnvfx,dbl,"
218 :     | asm_fcnv (I.FCNVFX_Q) = "fcnvfx,quad,"
219 :     | asm_fcnv (I.FCNVFXT_S) = "fcnvfxt,sgl,"
220 :     | asm_fcnv (I.FCNVFXT_D) = "fcnvfxt,dbl,"
221 :     | asm_fcnv (I.FCNVFXT_Q) = "fcnvfxt,quad,"
222 :     and emit_fcnv x = (emit (asm_fcnv x))
223 :     and asm_cmpi (I.COMIBT) = "comibt"
224 :     | asm_cmpi (I.COMIBF) = "comibf"
225 :     and emit_cmpi x = (emit (asm_cmpi x))
226 :     and asm_arith (I.ADD) = "add"
227 :     | asm_arith (I.ADDL) = "addl"
228 :     | asm_arith (I.ADDO) = "addo"
229 :     | asm_arith (I.SH1ADD) = "sh1add"
230 :     | asm_arith (I.SH1ADDL) = "sh1addl"
231 :     | asm_arith (I.SH1ADDO) = "sh1addo"
232 :     | asm_arith (I.SH2ADD) = "sh2add"
233 :     | asm_arith (I.SH2ADDL) = "sh2addl"
234 :     | asm_arith (I.SH2ADDO) = "sh2addo"
235 :     | asm_arith (I.SH3ADD) = "sh3add"
236 :     | asm_arith (I.SH3ADDL) = "sh3addl"
237 :     | asm_arith (I.SH3ADDO) = "sh3addo"
238 :     | asm_arith (I.SUB) = "sub"
239 :     | asm_arith (I.SUBO) = "subo"
240 :     | asm_arith (I.OR) = "or"
241 :     | asm_arith (I.XOR) = "xor"
242 :     | asm_arith (I.AND) = "and"
243 :     | asm_arith (I.ANDCM) = "andcm"
244 :     and emit_arith x = (emit (asm_arith x))
245 : monnier 429 and asm_arithi (I.ADDI) = "addi"
246 :     | asm_arithi (I.ADDIO) = "addio"
247 :     | asm_arithi (I.ADDIL) = "addil"
248 :     | asm_arithi (I.SUBI) = "subi"
249 :     | asm_arithi (I.SUBIO) = "subio"
250 :     and emit_arithi x = (emit (asm_arithi x))
251 : monnier 411 and asm_load (I.LDWX) = "ldwx"
252 :     | asm_load (I.LDWX_S) = "ldwx,s"
253 :     | asm_load (I.LDWX_M) = "ldwx,m"
254 :     | asm_load (I.LDWX_SM) = "ldwx,sm"
255 :     | asm_load (I.LDHX) = "ldhx"
256 :     | asm_load (I.LDHX_S) = "ldhx,s"
257 :     | asm_load (I.LDHX_M) = "ldhx,m"
258 :     | asm_load (I.LDHX_SM) = "ldhx,sm"
259 :     | asm_load (I.LDBX) = "ldbx"
260 :     | asm_load (I.LDBX_M) = "ldbx,m"
261 :     and emit_load x = (emit (asm_load x))
262 : monnier 245
263 : monnier 411 fun emit_n false = ()
264 :     | emit_n true = (emit ",n")
265 : monnier 245
266 : monnier 411 fun emit_nop false = ()
267 :     | emit_nop true = (emit "\n\tnop")
268 : monnier 245
269 : monnier 411 fun emitInstr instr =
270 :     ((tab ());
271 :    
272 :     (
273 :     case instr of
274 :     I.LOADI{li, r, i, t, mem} =>
275 :     ((emit_loadi li);
276 :     (emit "\t");
277 :     (emit_operand i);
278 :     (emit "(");
279 :     (emit_GP r);
280 :     (emit "), ");
281 :     (emit_GP t);
282 :     (emit_region mem))
283 :     | I.LOAD{l, r1, r2, t, mem} =>
284 :     ((emit_load l);
285 :     (emit "\t");
286 :     (emit_GP r2);
287 :     (emit "(");
288 :     (emit_GP r1);
289 :     (emit "), ");
290 :     (emit_GP t);
291 :     (emit_region mem))
292 :     | I.STORE{st, b, d, r, mem} =>
293 :     ((emit_store st);
294 :     (emit "\t");
295 :     (emit_GP r);
296 :     (emit ", ");
297 :     (emit_operand d);
298 :     (emit "(");
299 :     (emit_GP b);
300 :     (emit ")");
301 :     (emit_region mem))
302 :     | I.ARITH{a, r1, r2, t} =>
303 :     ((emit_arith a);
304 :     (emit "\t");
305 :     (emit_GP r1);
306 :     (emit ", ");
307 :     (emit_GP r2);
308 :     (emit ", ");
309 :     (emit_GP t))
310 :     | I.ARITHI{ai, i, r, t} =>
311 :     ((emit_arithi ai);
312 :     (emit "\t");
313 :     (emit_operand i);
314 :     (emit ", ");
315 :     (emit_GP r);
316 :     (emit ", ");
317 :     (emit_GP t))
318 :     | I.COMCLR_LDO{cc, r1, r2, t1, i, b, t2} =>
319 :     ((emit "comclr,");
320 :     (emit_bcond cc);
321 :     (emit "\t");
322 :     (emit_GP r1);
323 :     (emit ", ");
324 :     (emit_GP r2);
325 :     (emit ", ");
326 :     (emit_GP t1);
327 :     (emit "\n\tldo\t");
328 :     (emit_int i);
329 :     (emit "(");
330 :     (emit_GP b);
331 :     (emit "), ");
332 :     (emit_GP t2))
333 :     | I.SHIFTV{sv, r, len, t} =>
334 :     ((emit_shiftv sv);
335 :     (emit "\t");
336 :     (emit_GP r);
337 :     (emit ", ");
338 :     (emit_int len);
339 :     (emit ", ");
340 :     (emit_GP t))
341 :     | I.SHIFT{s, r, p, len, t} =>
342 :     ((emit_shift s);
343 :     (emit "\t");
344 :     (emit_GP r);
345 :     (emit ", ");
346 :     (emit_int p);
347 :     (emit ", ");
348 :     (emit_int len);
349 :     (emit ", ");
350 :     (emit_GP t))
351 :     | I.BCOND{cmp, bc, r1, r2, n, nop, t, f} =>
352 :     ((emit_cmp cmp);
353 :     (emit ",");
354 :     (emit_bcond bc);
355 :     (emit_n n);
356 :     (emit "\t");
357 :     (emit_GP r1);
358 :     (emit ", ");
359 :     (emit_GP r2);
360 :     (emit ", ");
361 :     (emit_label t);
362 :     (emit_nop nop))
363 :     | I.BCONDI{cmpi, bc, i, r2, n, nop, t, f} =>
364 :     ((emit_cmpi cmpi);
365 :     (emit ",");
366 :     (emit_bcond bc);
367 :     (emit_n n);
368 :     (emit "\t");
369 :     (emit_int i);
370 :     (emit ", ");
371 :     (emit_GP r2);
372 :     (emit ", ");
373 :     (emit_label t);
374 :     (emit_nop nop))
375 :     | I.BB{bc, r, p, n, nop, t, f} =>
376 :     ((emit "bb,");
377 :     (emit_bitcond bc);
378 :     (emit_n n);
379 :     (emit "\t");
380 :     (emit_GP r);
381 :     (emit ", ");
382 :     (emit_int p);
383 :     (emit ", ");
384 :     (emit_label t);
385 :     (emit_nop nop))
386 :     | I.B{lab, n} =>
387 :     ((emit "b");
388 :     (emit_n n);
389 :     (emit "\t");
390 :     (emit_label lab))
391 : monnier 429 | I.BE{b, d, sr, n, labs} =>
392 :     ((emit "be");
393 :     (emit_n n);
394 :     (emit "\t");
395 :     (emit_operand d);
396 :     (emit "(");
397 :     (emit_int sr);
398 :     (emit ",");
399 :     (emit_GP b);
400 :     (emit ")"))
401 : monnier 411 | I.BV{x, b, labs, n} =>
402 :     ((emit "bv");
403 :     (emit_n n);
404 :     (emit "\t");
405 :     (emit_GP x);
406 :     (emit "(");
407 :     (emit_GP b);
408 :     (emit ")"))
409 :     | I.BLR{x, t, labs, n} =>
410 :     ((emit "blr");
411 :     (emit_n n);
412 :     (emit "\t");
413 :     (emit_GP x);
414 :     (emit "(");
415 :     (emit_GP t);
416 :     (emit ")"))
417 :     | I.BL{x, t, defs, uses, n} =>
418 :     ((emit "bl");
419 :     (emit_n n);
420 :     (emit "\t");
421 :     (emit_operand x);
422 :     (emit "), ");
423 : monnier 498 (emit_GP t);
424 :     (emit_defs defs);
425 :     (emit_uses uses))
426 : monnier 411 | I.BLE{d, b, sr, t, defs, uses, mem} =>
427 :     ((emit "ble\t");
428 :     (emit_operand d);
429 :     (emit "(");
430 :     (emit_int sr);
431 :     (emit ",");
432 :     (emit_GP b);
433 :     (emit ")");
434 : monnier 498 (emit_region mem);
435 :     (emit_defs defs);
436 :     (emit_uses uses))
437 : monnier 411 | I.LDIL{i, t} =>
438 :     ((emit "ldil\t");
439 :     (emit_operand i);
440 :     (emit ", ");
441 :     (emit_GP t))
442 :     | I.LDO{i, b, t} =>
443 :     ((emit "ldo\t");
444 :     (emit_operand i);
445 :     (emit "(");
446 :     (emit_GP b);
447 :     (emit "), ");
448 :     (emit_GP t))
449 :     | I.MTCTL{r, t} =>
450 :     ((emit "mtctl\t");
451 :     (emit_GP r);
452 :     (emit ", ");
453 :     (emit_CR t))
454 : monnier 245 | I.FSTORE{fst, b, d, r, mem} =>
455 : monnier 411 ((emit_fstore fst);
456 :     (emit "\t");
457 :     (emit_int d);
458 :     (emit "(");
459 :     (emit_GP b);
460 :     (emit "), ");
461 :     (emit_FP r);
462 :     (emit_region mem))
463 : monnier 245 | I.FSTOREX{fstx, b, x, r, mem} =>
464 : monnier 411 ((emit_fstorex fstx);
465 :     (emit "\t");
466 :     (emit_GP x);
467 :     (emit "(");
468 :     (emit_GP b);
469 :     (emit "), ");
470 :     (emit_FP r);
471 :     (emit_region mem))
472 :     | I.FLOAD{fl, b, d, t, mem} =>
473 :     ((emit_fload fl);
474 :     (emit "\t");
475 :     (emit_int d);
476 :     (emit "(");
477 :     (emit_GP b);
478 :     (emit "), ");
479 :     (emit_FP t);
480 :     (emit_region mem))
481 :     | I.FLOADX{flx, b, x, t, mem} =>
482 :     ((emit_floadx flx);
483 :     (emit "\t");
484 :     (emit_GP x);
485 :     (emit "(");
486 :     (emit_GP b);
487 :     (emit "), ");
488 :     (emit_FP t);
489 :     (emit_region mem))
490 :     | I.FARITH{fa, r1, r2, t} =>
491 :     ((emit_farith fa);
492 :     (emit "\t");
493 :     (emit_FP r1);
494 :     (emit ", ");
495 :     (emit_FP r2);
496 :     (emit ", ");
497 :     (emit_FP t))
498 :     | I.FUNARY{fu, f, t} =>
499 :     ((emit_funary fu);
500 :     (emit "\t");
501 :     (emit_FP f);
502 :     (emit ", ");
503 :     (emit_FP t))
504 :     | I.FCNV{fcnv, f, t} =>
505 :     ((emit_fcnv fcnv);
506 :     (emit "\t");
507 :     (emit_FP f);
508 :     (emit ", ");
509 :     (emit_FP t))
510 :     | I.FBRANCH{cc, fmt, f1, f2, t, f, n, long} =>
511 :     ((emit "fcmp,");
512 :     (emit_fmt fmt);
513 :     (emit ",");
514 :     (emit_fcond cc);
515 :     (emit "\t");
516 :     (emit_FP f1);
517 :     (emit ", ");
518 :     (emit_FP f2);
519 :     (emit "\n\tftest\n\tb");
520 :     (emit_n n);
521 :     (emit "\t");
522 :     (emit_label t))
523 :     | I.BREAK{code1, code2} =>
524 :     ((emit "break\t");
525 :     (emit_int code1);
526 :     (emit ", ");
527 :     (emit_int code2))
528 :     | I.NOP => (emit "nop")
529 :     | I.COPY{dst, src, impl, tmp} => (emitInstrs (Shuffle.shuffle {regmap=regmap, tmp=tmp, src=src, dst=dst}))
530 :     | I.FCOPY{dst, src, impl, tmp} => (emitInstrs (Shuffle.shufflefp {regmap=regmap, tmp=tmp, src=src, dst=dst}))
531 :     | I.ANNOTATION{i, a} =>
532 :     ((emitInstr i);
533 :     (comment (Annotations.toString a)))
534 :     | I.GROUP annotation => (comment (Annotations.toString annotation))
535 :     );
536 :     (nl ()))
537 :     and emitInstrs [] = ()
538 :     | emitInstrs (i::is) =
539 :     (emitInstr i; app (fn i => (tab(); emitInstr i)) is)
540 :     in emitInstr end
541 :    
542 : monnier 429 in S.STREAM{beginCluster=init,
543 : monnier 411 pseudoOp=pseudoOp,
544 :     emit=emitter,
545 : monnier 429 endCluster=doNothing,
546 : monnier 411 defineLabel=defineLabel,
547 :     entryLabel=entryLabel,
548 :     comment=comment,
549 :     exitBlock=doNothing,
550 : monnier 429 annotation=annotation,
551 :     phi=doNothing,
552 :     alias=doNothing
553 : monnier 411 }
554 :     end
555 : monnier 245 end
556 :    

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