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

Annotation of /sml/trunk/src/MLRISC/hppa/emit/hppaAsm.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1116 - (view) (download)

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

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