Debian Codegraph @

lib/mlrisc-lib/MLRISC/alpha/emit/alphaAsm.sml

raw
1 (*
2 * WARNING: This file was automatically generated by MDLGen (v3.1)
3 * from the machine description file "alpha/alpha.mdl".
4 * DO NOT EDIT this file directly
5 *)
6
7
8 functor AlphaAsmEmitter(structure S : INSTRUCTION_STREAM
9 structure Instr : ALPHAINSTR (* where T = S.P.T *)
10 where type T.Basis.cond = S.P.T.Basis.cond
11 and type T.Basis.div_rounding_mode = S.P.T.Basis.div_rounding_mode
12 and type T.Basis.ext = S.P.T.Basis.ext
13 and type T.Basis.fcond = S.P.T.Basis.fcond
14 and type T.Basis.rounding_mode = S.P.T.Basis.rounding_mode
15 and type T.Constant.const = S.P.T.Constant.const
16 and type ('s,'r,'f,'c) T.Extension.ccx = ('s,'r,'f,'c) S.P.T.Extension.ccx
17 and type ('s,'r,'f,'c) T.Extension.fx = ('s,'r,'f,'c) S.P.T.Extension.fx
18 and type ('s,'r,'f,'c) T.Extension.rx = ('s,'r,'f,'c) S.P.T.Extension.rx
19 and type ('s,'r,'f,'c) T.Extension.sx = ('s,'r,'f,'c) S.P.T.Extension.sx
20 and type T.I.div_rounding_mode = S.P.T.I.div_rounding_mode
21 and type T.Region.region = S.P.T.Region.region
22 and type T.ccexp = S.P.T.ccexp
23 and type T.fexp = S.P.T.fexp
24 (* and type T.labexp = S.P.T.labexp *)
25 and type T.mlrisc = S.P.T.mlrisc
26 and type T.oper = S.P.T.oper
27 and type T.rep = S.P.T.rep
28 and type T.rexp = S.P.T.rexp
29 and type T.stm = S.P.T.stm
30 structure Shuffle : ALPHASHUFFLE (* where I = Instr *)
31 where type I.Constant.const = Instr.Constant.const
32 and type I.Region.region = Instr.Region.region
33 and type I.T.Basis.cond = Instr.T.Basis.cond
34 and type I.T.Basis.div_rounding_mode = Instr.T.Basis.div_rounding_mode
35 and type I.T.Basis.ext = Instr.T.Basis.ext
36 and type I.T.Basis.fcond = Instr.T.Basis.fcond
37 and type I.T.Basis.rounding_mode = Instr.T.Basis.rounding_mode
38 and type ('s,'r,'f,'c) I.T.Extension.ccx = ('s,'r,'f,'c) Instr.T.Extension.ccx
39 and type ('s,'r,'f,'c) I.T.Extension.fx = ('s,'r,'f,'c) Instr.T.Extension.fx
40 and type ('s,'r,'f,'c) I.T.Extension.rx = ('s,'r,'f,'c) Instr.T.Extension.rx
41 and type ('s,'r,'f,'c) I.T.Extension.sx = ('s,'r,'f,'c) Instr.T.Extension.sx
42 and type I.T.I.div_rounding_mode = Instr.T.I.div_rounding_mode
43 and type I.T.ccexp = Instr.T.ccexp
44 and type I.T.fexp = Instr.T.fexp
45 (* and type I.T.labexp = Instr.T.labexp *)
46 and type I.T.mlrisc = Instr.T.mlrisc
47 and type I.T.oper = Instr.T.oper
48 and type I.T.rep = Instr.T.rep
49 and type I.T.rexp = Instr.T.rexp
50 and type I.T.stm = Instr.T.stm
51 and type I.branch = Instr.branch
52 and type I.cmove = Instr.cmove
53 and type I.ea = Instr.ea
54 and type I.fbranch = Instr.fbranch
55 and type I.fcmove = Instr.fcmove
56 and type I.fload = Instr.fload
57 and type I.foperate = Instr.foperate
58 and type I.foperateV = Instr.foperateV
59 and type I.fstore = Instr.fstore
60 and type I.funary = Instr.funary
61 and type I.instr = Instr.instr
62 and type I.instruction = Instr.instruction
63 and type I.load = Instr.load
64 and type I.operand = Instr.operand
65 and type I.operate = Instr.operate
66 and type I.operateV = Instr.operateV
67 and type I.osf_user_palcode = Instr.osf_user_palcode
68 and type I.pseudo_op = Instr.pseudo_op
69 and type I.store = Instr.store
70 structure MLTreeEval : MLTREE_EVAL (* where T = Instr.T *)
71 where type T.Basis.cond = Instr.T.Basis.cond
72 and type T.Basis.div_rounding_mode = Instr.T.Basis.div_rounding_mode
73 and type T.Basis.ext = Instr.T.Basis.ext
74 and type T.Basis.fcond = Instr.T.Basis.fcond
75 and type T.Basis.rounding_mode = Instr.T.Basis.rounding_mode
76 and type T.Constant.const = Instr.T.Constant.const
77 and type ('s,'r,'f,'c) T.Extension.ccx = ('s,'r,'f,'c) Instr.T.Extension.ccx
78 and type ('s,'r,'f,'c) T.Extension.fx = ('s,'r,'f,'c) Instr.T.Extension.fx
79 and type ('s,'r,'f,'c) T.Extension.rx = ('s,'r,'f,'c) Instr.T.Extension.rx
80 and type ('s,'r,'f,'c) T.Extension.sx = ('s,'r,'f,'c) Instr.T.Extension.sx
81 and type T.I.div_rounding_mode = Instr.T.I.div_rounding_mode
82 and type T.Region.region = Instr.T.Region.region
83 and type T.ccexp = Instr.T.ccexp
84 and type T.fexp = Instr.T.fexp
85 (* and type T.labexp = Instr.T.labexp *)
86 and type T.mlrisc = Instr.T.mlrisc
87 and type T.oper = Instr.T.oper
88 and type T.rep = Instr.T.rep
89 and type T.rexp = Instr.T.rexp
90 and type T.stm = Instr.T.stm
91 ) : INSTRUCTION_EMITTER =
92 struct
93 structure I = Instr
94 structure C = I.C
95 structure T = I.T
96 structure S = S
97 structure P = S.P
98 structure Constant = I.Constant
99
100 open AsmFlags
101
102 fun error msg = MLRiscErrorMsg.error("AlphaAsmEmitter",msg)
103
104 fun makeStream formatAnnotations =
105 let val stream = !AsmStream.asmOutStream
106 fun emit' s = TextIO.output(stream,s)
107 val newline = ref true
108 val tabs = ref 0
109 fun tabbing 0 = ()
110 | tabbing n = (emit' "\t"; tabbing(n-1))
111 fun emit s = (tabbing(!tabs); tabs := 0; newline := false; emit' s)
112 fun nl() = (tabs := 0; if !newline then () else (newline := true; emit' "\n"))
113 fun comma() = emit ","
114 fun tab() = tabs := 1
115 fun indent() = tabs := 2
116 fun ms n = let val s = Int.toString n
117 in if n<0 then "-"^String.substring(s,1,size s-1)
118 else s
119 end
120 fun emit_label lab = emit(P.Client.AsmPseudoOps.lexpToString(T.LABEL lab))
121 fun emit_labexp le = emit(P.Client.AsmPseudoOps.lexpToString (T.LABEXP le))
122 fun emit_const c = emit(Constant.toString c)
123 fun emit_int i = emit(ms i)
124 fun paren f = (emit "("; f(); emit ")")
125 fun defineLabel lab = emit(P.Client.AsmPseudoOps.defineLabel lab^"\n")
126 fun entryLabel lab = defineLabel lab
127 fun comment msg = (tab(); emit("/* " ^ msg ^ " */"); nl())
128 fun annotation a = comment(Annotations.toString a)
129 fun getAnnotations() = error "getAnnotations"
130 fun doNothing _ = ()
131 fun fail _ = raise Fail "AsmEmitter"
132 fun emit_region mem = comment(I.Region.toString mem)
133 val emit_region =
134 if !show_region then emit_region else doNothing
135 fun pseudoOp pOp = (emit(P.toString pOp); emit "\n")
136 fun init size = (comment("Code Size = " ^ ms size); nl())
137 val emitCellInfo = AsmFormatUtil.reginfo
138 (emit,formatAnnotations)
139 fun emitCell r = (emit(CellsBasis.toString r); emitCellInfo r)
140 fun emit_cellset(title,cellset) =
141 (nl(); comment(title^CellsBasis.CellSet.toString cellset))
142 val emit_cellset =
143 if !show_cellset then emit_cellset else doNothing
144 fun emit_defs cellset = emit_cellset("defs: ",cellset)
145 fun emit_uses cellset = emit_cellset("uses: ",cellset)
146 val emit_cutsTo =
147 if !show_cutsTo then AsmFormatUtil.emit_cutsTo emit
148 else doNothing
149 fun emitter instr =
150 let
151 fun emit_operand (I.REGop GP) = emitCell GP
152 | emit_operand (I.IMMop int) = emit_int int
153 | emit_operand (I.HILABop labexp) =
154 ( emit "hi(";
155 emit_labexp labexp;
156 emit ")" )
157 | emit_operand (I.LOLABop labexp) =
158 ( emit "lo(";
159 emit_labexp labexp;
160 emit ")" )
161 | emit_operand (I.LABop labexp) = emit_labexp labexp
162 and asm_branch (I.BR) = "br"
163 | asm_branch (I.BLBC) = "blbc"
164 | asm_branch (I.BEQ) = "beq"
165 | asm_branch (I.BLT) = "blt"
166 | asm_branch (I.BLE) = "ble"
167 | asm_branch (I.BLBS) = "blbs"
168 | asm_branch (I.BNE) = "bne"
169 | asm_branch (I.BGE) = "bge"
170 | asm_branch (I.BGT) = "bgt"
171 and emit_branch x = emit (asm_branch x)
172 and asm_fbranch (I.FBEQ) = "fbeq"
173 | asm_fbranch (I.FBLT) = "fblt"
174 | asm_fbranch (I.FBLE) = "fble"
175 | asm_fbranch (I.FBNE) = "fbne"
176 | asm_fbranch (I.FBGE) = "fbge"
177 | asm_fbranch (I.FBGT) = "fbgt"
178 and emit_fbranch x = emit (asm_fbranch x)
179 and asm_load (I.LDB) = "ldb"
180 | asm_load (I.LDW) = "ldw"
181 | asm_load (I.LDBU) = "ldbu"
182 | asm_load (I.LDWU) = "ldwu"
183 | asm_load (I.LDL) = "ldl"
184 | asm_load (I.LDL_L) = "ldl_l"
185 | asm_load (I.LDQ) = "ldq"
186 | asm_load (I.LDQ_L) = "ldq_l"
187 | asm_load (I.LDQ_U) = "ldq_u"
188 and emit_load x = emit (asm_load x)
189 and asm_store (I.STB) = "stb"
190 | asm_store (I.STW) = "stw"
191 | asm_store (I.STL) = "stl"
192 | asm_store (I.STQ) = "stq"
193 | asm_store (I.STQ_U) = "stq_u"
194 and emit_store x = emit (asm_store x)
195 and asm_fload (I.LDF) = "ldf"
196 | asm_fload (I.LDG) = "ldg"
197 | asm_fload (I.LDS) = "lds"
198 | asm_fload (I.LDT) = "ldt"
199 and emit_fload x = emit (asm_fload x)
200 and asm_fstore (I.STF) = "stf"
201 | asm_fstore (I.STG) = "stg"
202 | asm_fstore (I.STS) = "sts"
203 | asm_fstore (I.STT) = "stt"
204 and emit_fstore x = emit (asm_fstore x)
205 and asm_operate (I.ADDL) = "addl"
206 | asm_operate (I.ADDQ) = "addq"
207 | asm_operate (I.CMPBGE) = "cmpbge"
208 | asm_operate (I.CMPEQ) = "cmpeq"
209 | asm_operate (I.CMPLE) = "cmple"
210 | asm_operate (I.CMPLT) = "cmplt"
211 | asm_operate (I.CMPULE) = "cmpule"
212 | asm_operate (I.CMPULT) = "cmpult"
213 | asm_operate (I.SUBL) = "subl"
214 | asm_operate (I.SUBQ) = "subq"
215 | asm_operate (I.S4ADDL) = "s4addl"
216 | asm_operate (I.S4ADDQ) = "s4addq"
217 | asm_operate (I.S4SUBL) = "s4subl"
218 | asm_operate (I.S4SUBQ) = "s4subq"
219 | asm_operate (I.S8ADDL) = "s8addl"
220 | asm_operate (I.S8ADDQ) = "s8addq"
221 | asm_operate (I.S8SUBL) = "s8subl"
222 | asm_operate (I.S8SUBQ) = "s8subq"
223 | asm_operate (I.AND) = "and"
224 | asm_operate (I.BIC) = "bic"
225 | asm_operate (I.BIS) = "bis"
226 | asm_operate (I.EQV) = "eqv"
227 | asm_operate (I.ORNOT) = "ornot"
228 | asm_operate (I.XOR) = "xor"
229 | asm_operate (I.EXTBL) = "extbl"
230 | asm_operate (I.EXTLH) = "extlh"
231 | asm_operate (I.EXTLL) = "extll"
232 | asm_operate (I.EXTQH) = "extqh"
233 | asm_operate (I.EXTQL) = "extql"
234 | asm_operate (I.EXTWH) = "extwh"
235 | asm_operate (I.EXTWL) = "extwl"
236 | asm_operate (I.INSBL) = "insbl"
237 | asm_operate (I.INSLH) = "inslh"
238 | asm_operate (I.INSLL) = "insll"
239 | asm_operate (I.INSQH) = "insqh"
240 | asm_operate (I.INSQL) = "insql"
241 | asm_operate (I.INSWH) = "inswh"
242 | asm_operate (I.INSWL) = "inswl"
243 | asm_operate (I.MSKBL) = "mskbl"
244 | asm_operate (I.MSKLH) = "msklh"
245 | asm_operate (I.MSKLL) = "mskll"
246 | asm_operate (I.MSKQH) = "mskqh"
247 | asm_operate (I.MSKQL) = "mskql"
248 | asm_operate (I.MSKWH) = "mskwh"
249 | asm_operate (I.MSKWL) = "mskwl"
250 | asm_operate (I.SLL) = "sll"
251 | asm_operate (I.SRA) = "sra"
252 | asm_operate (I.SRL) = "srl"
253 | asm_operate (I.ZAP) = "zap"
254 | asm_operate (I.ZAPNOT) = "zapnot"
255 | asm_operate (I.MULL) = "mull"
256 | asm_operate (I.MULQ) = "mulq"
257 | asm_operate (I.UMULH) = "umulh"
258 and emit_operate x = emit (asm_operate x)
259 and asm_cmove (I.CMOVEQ) = "cmoveq"
260 | asm_cmove (I.CMOVLBC) = "cmovlbc"
261 | asm_cmove (I.CMOVLBS) = "cmovlbs"
262 | asm_cmove (I.CMOVGE) = "cmovge"
263 | asm_cmove (I.CMOVGT) = "cmovgt"
264 | asm_cmove (I.CMOVLE) = "cmovle"
265 | asm_cmove (I.CMOVLT) = "cmovlt"
266 | asm_cmove (I.CMOVNE) = "cmovne"
267 and emit_cmove x = emit (asm_cmove x)
268 and asm_pseudo_op (I.DIVL) = "divl"
269 | asm_pseudo_op (I.DIVLU) = "divlu"
270 | asm_pseudo_op (I.DIVQ) = "divq"
271 | asm_pseudo_op (I.DIVQU) = "divqu"
272 | asm_pseudo_op (I.REML) = "reml"
273 | asm_pseudo_op (I.REMLU) = "remlu"
274 | asm_pseudo_op (I.REMQ) = "remq"
275 | asm_pseudo_op (I.REMQU) = "remqu"
276 and emit_pseudo_op x = emit (asm_pseudo_op x)
277 and asm_operateV (I.ADDLV) = "addlv"
278 | asm_operateV (I.ADDQV) = "addqv"
279 | asm_operateV (I.SUBLV) = "sublv"
280 | asm_operateV (I.SUBQV) = "subqv"
281 | asm_operateV (I.MULLV) = "mullv"
282 | asm_operateV (I.MULQV) = "mulqv"
283 and emit_operateV x = emit (asm_operateV x)
284 and asm_funary (I.CVTLQ) = "cvtlq"
285 | asm_funary (I.CVTQL) = "cvtql"
286 | asm_funary (I.CVTQLSV) = "cvtqlsv"
287 | asm_funary (I.CVTQLV) = "cvtqlv"
288 | asm_funary (I.CVTQS) = "cvtqs"
289 | asm_funary (I.CVTQSC) = "cvtqsc"
290 | asm_funary (I.CVTQT) = "cvtqt"
291 | asm_funary (I.CVTQTC) = "cvtqtc"
292 | asm_funary (I.CVTTS) = "cvtts"
293 | asm_funary (I.CVTTSC) = "cvttsc"
294 | asm_funary (I.CVTST) = "cvtst"
295 | asm_funary (I.CVTSTS) = "cvtsts"
296 | asm_funary (I.CVTTQ) = "cvttq"
297 | asm_funary (I.CVTTQC) = "cvttqc"
298 and emit_funary x = emit (asm_funary x)
299 and asm_foperate (I.CPYS) = "cpys"
300 | asm_foperate (I.CPYSE) = "cpyse"
301 | asm_foperate (I.CPYSN) = "cpysn"
302 | asm_foperate (I.MF_FPCR) = "mf_fpcr"
303 | asm_foperate (I.MT_FPCR) = "mt_fpcr"
304 | asm_foperate (I.CMPTEQ) = "cmpteq"
305 | asm_foperate (I.CMPTLT) = "cmptlt"
306 | asm_foperate (I.CMPTLE) = "cmptle"
307 | asm_foperate (I.CMPTUN) = "cmptun"
308 | asm_foperate (I.CMPTEQSU) = "cmpteqsu"
309 | asm_foperate (I.CMPTLTSU) = "cmptltsu"
310 | asm_foperate (I.CMPTLESU) = "cmptlesu"
311 | asm_foperate (I.CMPTUNSU) = "cmptunsu"
312 | asm_foperate (I.ADDS) = "adds"
313 | asm_foperate (I.ADDT) = "addt"
314 | asm_foperate (I.DIVS) = "divs"
315 | asm_foperate (I.DIVT) = "divt"
316 | asm_foperate (I.MULS) = "muls"
317 | asm_foperate (I.MULT) = "mult"
318 | asm_foperate (I.SUBS) = "subs"
319 | asm_foperate (I.SUBT) = "subt"
320 and emit_foperate x = emit (asm_foperate x)
321 and asm_fcmove (I.FCMOVEQ) = "fcmoveq"
322 | asm_fcmove (I.FCMOVGE) = "fcmovge"
323 | asm_fcmove (I.FCMOVGT) = "fcmovgt"
324 | asm_fcmove (I.FCMOVLE) = "fcmovle"
325 | asm_fcmove (I.FCMOVLT) = "fcmovlt"
326 | asm_fcmove (I.FCMOVNE) = "fcmovne"
327 and emit_fcmove x = emit (asm_fcmove x)
328 and asm_foperateV (I.ADDSSUD) = "addssud"
329 | asm_foperateV (I.ADDSSU) = "addssu"
330 | asm_foperateV (I.ADDTSUD) = "addtsud"
331 | asm_foperateV (I.ADDTSU) = "addtsu"
332 | asm_foperateV (I.DIVSSUD) = "divssud"
333 | asm_foperateV (I.DIVSSU) = "divssu"
334 | asm_foperateV (I.DIVTSUD) = "divtsud"
335 | asm_foperateV (I.DIVTSU) = "divtsu"
336 | asm_foperateV (I.MULSSUD) = "mulssud"
337 | asm_foperateV (I.MULSSU) = "mulssu"
338 | asm_foperateV (I.MULTSUD) = "multsud"
339 | asm_foperateV (I.MULTSU) = "multsu"
340 | asm_foperateV (I.SUBSSUD) = "subssud"
341 | asm_foperateV (I.SUBSSU) = "subssu"
342 | asm_foperateV (I.SUBTSUD) = "subtsud"
343 | asm_foperateV (I.SUBTSU) = "subtsu"
344 and emit_foperateV x = emit (asm_foperateV x)
345 and asm_osf_user_palcode (I.BPT) = "bpt"
346 | asm_osf_user_palcode (I.BUGCHK) = "bugchk"
347 | asm_osf_user_palcode (I.CALLSYS) = "callsys"
348 | asm_osf_user_palcode (I.GENTRAP) = "gentrap"
349 | asm_osf_user_palcode (I.IMB) = "imb"
350 | asm_osf_user_palcode (I.RDUNIQUE) = "rdunique"
351 | asm_osf_user_palcode (I.WRUNIQUE) = "wrunique"
352 and emit_osf_user_palcode x = emit (asm_osf_user_palcode x)
353
354 (*#line 479.7 "alpha/alpha.mdl"*)
355 fun isZero (I.LABop le) = (MLTreeEval.valueOf le) = 0
356 | isZero _ = false
357 fun emitInstr' instr =
358 (case instr of
359 I.LDA{r, b, d} => (if ((isZero d) andalso (CellsBasis.sameCell (r,
360 b)))
361 then ()
362 else
363 (
364 ( emit "lda\t";
365 emitCell r;
366 emit ", ";
367 emit_operand d );
368 (if ((CellsBasis.registerId b) = 31)
369 then ()
370 else
371 ( emit "(";
372 emitCell b;
373 emit ")" ))))
374 | I.LDAH{r, b, d} =>
375 (
376 ( emit "ldah\t";
377 emitCell r;
378 emit ", ";
379 emit_operand d );
380 (if ((CellsBasis.registerId b) = 31)
381 then ()
382 else
383 ( emit "(";
384 emitCell b;
385 emit ")" )))
386 | I.LOAD{ldOp, r, b, d, mem} =>
387 ( emit_load ldOp;
388 emit "\t";
389 emitCell r;
390 emit ", ";
391 emit_operand d;
392 emit "(";
393 emitCell b;
394 emit ")";
395 emit_region mem )
396 | I.STORE{stOp, r, b, d, mem} =>
397 ( emit_store stOp;
398 emit "\t";
399 emitCell r;
400 emit ", ";
401 emit_operand d;
402 emit "(";
403 emitCell b;
404 emit ")";
405 emit_region mem )
406 | I.FLOAD{ldOp, r, b, d, mem} =>
407 ( emit_fload ldOp;
408 emit "\t";
409 emitCell r;
410 emit ", ";
411 emit_operand d;
412 emit "(";
413 emitCell b;
414 emit ")";
415 emit_region mem )
416 | I.FSTORE{stOp, r, b, d, mem} =>
417 ( emit_fstore stOp;
418 emit "\t";
419 emitCell r;
420 emit ", ";
421 emit_operand d;
422 emit "(";
423 emitCell b;
424 emit ")";
425 emit_region mem )
426 | I.JMPL({r, b, d}, list) =>
427 ( emit "jmp\t";
428 emitCell r;
429 emit ", (";
430 emitCell b;
431 emit ")" )
432 | I.JSR{r, b, d, defs, uses, cutsTo, mem} =>
433 ( emit "jsr\t";
434 emitCell r;
435 emit ", (";
436 emitCell b;
437 emit ")";
438 emit_region mem;
439 emit_defs defs;
440 emit_uses uses;
441 emit_cutsTo cutsTo )
442 | I.BSR{r, lab, defs, uses, cutsTo, mem} =>
443 ( emit "bsr\t";
444 emitCell r;
445 emit ", ";
446 emit_label lab;
447 emit_region mem;
448 emit_defs defs;
449 emit_uses uses;
450 emit_cutsTo cutsTo )
451 | I.RET{r, b, d} =>
452 ( emit "ret\t";
453 emitCell r;
454 emit ", (";
455 emitCell b;
456 emit ")" )
457 | I.BRANCH{b, r, lab} =>
458 ( emit_branch b;
459 emit "\t";
460 emitCell r;
461 emit ", ";
462 emit_label lab )
463 | I.FBRANCH{b, f, lab} =>
464 ( emit_fbranch b;
465 emit "\t";
466 emitCell f;
467 emit ", ";
468 emit_label lab )
469 | I.OPERATE{oper, ra, rb, rc} =>
470 let
471 (*#line 568.15 "alpha/alpha.mdl"*)
472 fun disp () =
473 ( emit_operate oper;
474 emit "\t";
475 emitCell ra;
476 emit ", ";
477 emit_operand rb;
478 emit ", ";
479 emitCell rc )
480 in
481 (case (oper, CellsBasis.registerId ra, rb, CellsBasis.registerId rc) of
482 (I.BIS, 27, I.REGop rb, 29) => (if ((CellsBasis.registerId rb) = 31)
483 then (emit "ldgp\t$29, 0($27)")
484 else (disp ()))
485 | (I.BIS, 26, I.REGop rb, 29) => (if ((CellsBasis.registerId rb) = 31)
486 then (emit "ldgp\t$29, 0($26)")
487 else (disp ()))
488 | _ => disp ()
489 )
490 end
491 | I.OPERATEV{oper, ra, rb, rc} =>
492 ( emit_operateV oper;
493 emit "\t";
494 emitCell ra;
495 emit ", ";
496 emit_operand rb;
497 emit ", ";
498 emitCell rc )
499 | I.CMOVE{oper, ra, rb, rc} =>
500 ( emit_cmove oper;
501 emit "\t";
502 emitCell ra;
503 emit ", ";
504 emit_operand rb;
505 emit ", ";
506 emitCell rc )
507 | I.PSEUDOARITH{oper, ra, rb, rc, tmps} =>
508 ( emit_pseudo_op oper;
509 emit "\t";
510 emitCell ra;
511 emit ", ";
512 emit_operand rb;
513 emit ", ";
514 emitCell rc;
515 emit_cellset ("tmps", tmps))
516 | I.FUNARY{oper, fb, fc} =>
517 ( emit_funary oper;
518 emit "\t";
519 emitCell fb;
520 emit ", ";
521 emitCell fc )
522 | I.FOPERATE{oper, fa, fb, fc} =>
523 ( emit_foperate oper;
524 emit "\t";
525 emitCell fa;
526 emit ", ";
527 emitCell fb;
528 emit ", ";
529 emitCell fc )
530 | I.FOPERATEV{oper, fa, fb, fc} =>
531 ( emit_foperateV oper;
532 emit "\t";
533 emitCell fa;
534 emit ", ";
535 emitCell fb;
536 emit ", ";
537 emitCell fc )
538 | I.FCMOVE{oper, fa, fb, fc} =>
539 ( emit_fcmove oper;
540 emit "\t";
541 emitCell fa;
542 emit ", ";
543 emitCell fb;
544 emit ", ";
545 emitCell fc )
546 | I.TRAPB => emit "trapb"
547 | I.CALL_PAL{code, def, use} =>
548 ( emit "call_pal ";
549 emit_osf_user_palcode code )
550 | I.SOURCE{} => emit "source"
551 | I.SINK{} => emit "sink"
552 | I.PHI{} => emit "phi"
553 )
554 in tab(); emitInstr' instr; nl()
555 end (* emitter *)
556 and emitInstrIndented i = (indent(); emitInstr i; nl())
557 and emitInstrs instrs =
558 app (if !indent_copies then emitInstrIndented
559 else emitInstr) instrs
560
561 and emitInstr(I.ANNOTATION{i,a}) =
562 ( comment(Annotations.toString a);
563 nl();
564 emitInstr i )
565 | emitInstr(I.LIVE{regs, spilled}) =
566 comment("live= " ^ CellsBasis.CellSet.toString regs ^
567 "spilled= " ^ CellsBasis.CellSet.toString spilled)
568 | emitInstr(I.KILL{regs, spilled}) =
569 comment("killed:: " ^ CellsBasis.CellSet.toString regs ^
570 "spilled:: " ^ CellsBasis.CellSet.toString spilled)
571 | emitInstr(I.INSTR i) = emitter i
572 | emitInstr(I.COPY{k=CellsBasis.GP, sz, src, dst, tmp}) =
573 emitInstrs(Shuffle.shuffle{tmp=tmp, src=src, dst=dst})
574 | emitInstr(I.COPY{k=CellsBasis.FP, sz, src, dst, tmp}) =
575 emitInstrs(Shuffle.shufflefp{tmp=tmp, src=src, dst=dst})
576 | emitInstr _ = error "emitInstr"
577
578 in S.STREAM{beginCluster=init,
579 pseudoOp=pseudoOp,
580 emit=emitInstr,
581 endCluster=fail,
582 defineLabel=defineLabel,
583 entryLabel=entryLabel,
584 comment=comment,
585 exitBlock=doNothing,
586 annotation=annotation,
587 getAnnotations=getAnnotations
588 }
589 end
590 end
591