Debian Codegraph @

lib/mlrisc-lib/MLRISC/sparc/instructions/sparcInstr.sml

raw
1 (*
2 * WARNING: This file was automatically generated by MDLGen (v3.1)
3 * from the machine description file "sparc/sparc.mdl".
4 * DO NOT EDIT this file directly
5 *)
6
7
8 signature SPARCINSTR =
9 sig
10 structure C : SPARCCELLS
11 structure CB : CELLS_BASIS (* = CellsBasis *)
12 where type CellSet.cellset = CellsBasis.CellSet.cellset
13 and type 'a ColorTable.hash_table = 'a CellsBasis.ColorTable.hash_table
14 and type 'a HashTable.hash_table = 'a CellsBasis.HashTable.hash_table
15 and type SortedCells.sorted_cells = CellsBasis.SortedCells.sorted_cells
16 and type cell = CellsBasis.cell
17 and type cellColor = CellsBasis.cellColor
18 and type cellkind = CellsBasis.cellkind
19 and type cellkindDesc = CellsBasis.cellkindDesc
20 and type cellkindInfo = CellsBasis.cellkindInfo
21 structure T : MLTREE
22 structure Constant: CONSTANT
23 structure Region : REGION
24 sharing Constant = T.Constant
25 sharing Region = T.Region
26 datatype load =
27 LDSB
28 | LDSH
29 | LDUB
30 | LDUH
31 | LD
32 | LDX
33 | LDD
34 datatype store =
35 STB
36 | STH
37 | ST
38 | STX
39 | STD
40 datatype fload =
41 LDF
42 | LDDF
43 | LDQF
44 | LDFSR
45 | LDXFSR
46 datatype fstore =
47 STF
48 | STDF
49 | STFSR
50 datatype arith =
51 AND
52 | ANDCC
53 | ANDN
54 | ANDNCC
55 | OR
56 | ORCC
57 | ORN
58 | ORNCC
59 | XOR
60 | XORCC
61 | XNOR
62 | XNORCC
63 | ADD
64 | ADDCC
65 | TADD
66 | TADDCC
67 | TADDTV
68 | TADDTVCC
69 | SUB
70 | SUBCC
71 | TSUB
72 | TSUBCC
73 | TSUBTV
74 | TSUBTVCC
75 | UMUL
76 | UMULCC
77 | SMUL
78 | SMULCC
79 | UDIV
80 | UDIVCC
81 | SDIV
82 | SDIVCC
83 | MULX
84 | SDIVX
85 | UDIVX
86 datatype shift =
87 SLL
88 | SRL
89 | SRA
90 | SLLX
91 | SRLX
92 | SRAX
93 datatype farith1 =
94 FiTOs
95 | FiTOd
96 | FiTOq
97 | FsTOi
98 | FdTOi
99 | FqTOi
100 | FsTOd
101 | FsTOq
102 | FdTOs
103 | FdTOq
104 | FqTOs
105 | FqTOd
106 | FMOVs
107 | FNEGs
108 | FABSs
109 | FMOVd
110 | FNEGd
111 | FABSd
112 | FMOVq
113 | FNEGq
114 | FABSq
115 | FSQRTs
116 | FSQRTd
117 | FSQRTq
118 datatype farith2 =
119 FADDs
120 | FADDd
121 | FADDq
122 | FSUBs
123 | FSUBd
124 | FSUBq
125 | FMULs
126 | FMULd
127 | FMULq
128 | FsMULd
129 | FdMULq
130 | FDIVs
131 | FDIVd
132 | FDIVq
133 datatype fcmp =
134 FCMPs
135 | FCMPd
136 | FCMPq
137 | FCMPEs
138 | FCMPEd
139 | FCMPEq
140 datatype branch =
141 BN
142 | BE
143 | BLE
144 | BL
145 | BLEU
146 | BCS
147 | BNEG
148 | BVS
149 | BA
150 | BNE
151 | BG
152 | BGE
153 | BGU
154 | BCC
155 | BPOS
156 | BVC
157 datatype rcond =
158 RZ
159 | RLEZ
160 | RLZ
161 | RNZ
162 | RGZ
163 | RGEZ
164 datatype cc =
165 ICC
166 | XCC
167 datatype prediction =
168 PT
169 | PN
170 datatype fbranch =
171 FBN
172 | FBNE
173 | FBLG
174 | FBUL
175 | FBL
176 | FBUG
177 | FBG
178 | FBU
179 | FBA
180 | FBE
181 | FBUE
182 | FBGE
183 | FBUGE
184 | FBLE
185 | FBULE
186 | FBO
187 datatype ea =
188 Direct of CellsBasis.cell
189 | FDirect of CellsBasis.cell
190 | Displace of {base:CellsBasis.cell, disp:T.labexp, mem:Region.region}
191 datatype fsize =
192 S
193 | D
194 | Q
195 datatype operand =
196 REG of CellsBasis.cell
197 | IMMED of int
198 | LAB of T.labexp
199 | LO of T.labexp
200 | HI of T.labexp
201 type addressing_mode = CellsBasis.cell * operand
202 datatype instr =
203 LOAD of {l:load, d:CellsBasis.cell, r:CellsBasis.cell, i:operand, mem:Region.region}
204 | STORE of {s:store, d:CellsBasis.cell, r:CellsBasis.cell, i:operand, mem:Region.region}
205 | FLOAD of {l:fload, r:CellsBasis.cell, i:operand, d:CellsBasis.cell, mem:Region.region}
206 | FSTORE of {s:fstore, d:CellsBasis.cell, r:CellsBasis.cell, i:operand,
207 mem:Region.region}
208 | UNIMP of {const22:int}
209 | SETHI of {i:int, d:CellsBasis.cell}
210 | ARITH of {a:arith, r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
211 | SHIFT of {s:shift, r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
212 | MOVicc of {b:branch, i:operand, d:CellsBasis.cell}
213 | MOVfcc of {b:fbranch, i:operand, d:CellsBasis.cell}
214 | MOVR of {rcond:rcond, r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
215 | FMOVicc of {sz:fsize, b:branch, r:CellsBasis.cell, d:CellsBasis.cell}
216 | FMOVfcc of {sz:fsize, b:fbranch, r:CellsBasis.cell, d:CellsBasis.cell}
217 | Bicc of {b:branch, a:bool, label:Label.label, nop:bool}
218 | FBfcc of {b:fbranch, a:bool, label:Label.label, nop:bool}
219 | BR of {rcond:rcond, p:prediction, r:CellsBasis.cell, a:bool, label:Label.label,
220 nop:bool}
221 | BP of {b:branch, p:prediction, cc:cc, a:bool, label:Label.label, nop:bool}
222 | JMP of {r:CellsBasis.cell, i:operand, labs:Label.label list, nop:bool}
223 | JMPL of {r:CellsBasis.cell, i:operand, d:CellsBasis.cell, defs:C.cellset,
224 uses:C.cellset, cutsTo:Label.label list, nop:bool, mem:Region.region}
225 | CALL of {defs:C.cellset, uses:C.cellset, label:Label.label, cutsTo:Label.label list,
226 nop:bool, mem:Region.region}
227 | Ticc of {t:branch, cc:cc, r:CellsBasis.cell, i:operand}
228 | FPop1 of {a:farith1, r:CellsBasis.cell, d:CellsBasis.cell}
229 | FPop2 of {a:farith2, r1:CellsBasis.cell, r2:CellsBasis.cell, d:CellsBasis.cell}
230 | FCMP of {cmp:fcmp, r1:CellsBasis.cell, r2:CellsBasis.cell, nop:bool}
231 | SAVE of {r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
232 | RESTORE of {r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
233 | RDY of {d:CellsBasis.cell}
234 | WRY of {r:CellsBasis.cell, i:operand}
235 | RET of {leaf:bool, nop:bool}
236 | SOURCE of {}
237 | SINK of {}
238 | PHI of {}
239 and instruction =
240 LIVE of {regs: C.cellset, spilled: C.cellset}
241 | KILL of {regs: C.cellset, spilled: C.cellset}
242 | COPY of {k: CellsBasis.cellkind,
243 sz: int, (* in bits *)
244 dst: CellsBasis.cell list,
245 src: CellsBasis.cell list,
246 tmp: ea option (* NONE if |dst| = {src| = 1 *)}
247 | ANNOTATION of {i:instruction, a:Annotations.annotation}
248 | INSTR of instr
249 val load : {l:load, d:CellsBasis.cell, r:CellsBasis.cell, i:operand, mem:Region.region} -> instruction
250 val store : {s:store, d:CellsBasis.cell, r:CellsBasis.cell, i:operand, mem:Region.region} -> instruction
251 val fload : {l:fload, r:CellsBasis.cell, i:operand, d:CellsBasis.cell, mem:Region.region} -> instruction
252 val fstore : {s:fstore, d:CellsBasis.cell, r:CellsBasis.cell, i:operand,
253 mem:Region.region} -> instruction
254 val unimp : {const22:int} -> instruction
255 val sethi : {i:int, d:CellsBasis.cell} -> instruction
256 val arith : {a:arith, r:CellsBasis.cell, i:operand, d:CellsBasis.cell} -> instruction
257 val shift : {s:shift, r:CellsBasis.cell, i:operand, d:CellsBasis.cell} -> instruction
258 val movicc : {b:branch, i:operand, d:CellsBasis.cell} -> instruction
259 val movfcc : {b:fbranch, i:operand, d:CellsBasis.cell} -> instruction
260 val movr : {rcond:rcond, r:CellsBasis.cell, i:operand, d:CellsBasis.cell} -> instruction
261 val fmovicc : {sz:fsize, b:branch, r:CellsBasis.cell, d:CellsBasis.cell} -> instruction
262 val fmovfcc : {sz:fsize, b:fbranch, r:CellsBasis.cell, d:CellsBasis.cell} -> instruction
263 val bicc : {b:branch, a:bool, label:Label.label, nop:bool} -> instruction
264 val fbfcc : {b:fbranch, a:bool, label:Label.label, nop:bool} -> instruction
265 val br : {rcond:rcond, p:prediction, r:CellsBasis.cell, a:bool, label:Label.label,
266 nop:bool} -> instruction
267 val bp : {b:branch, p:prediction, cc:cc, a:bool, label:Label.label, nop:bool} -> instruction
268 val jmp : {r:CellsBasis.cell, i:operand, labs:Label.label list, nop:bool} -> instruction
269 val jmpl : {r:CellsBasis.cell, i:operand, d:CellsBasis.cell, defs:C.cellset,
270 uses:C.cellset, cutsTo:Label.label list, nop:bool, mem:Region.region} -> instruction
271 val call : {defs:C.cellset, uses:C.cellset, label:Label.label, cutsTo:Label.label list,
272 nop:bool, mem:Region.region} -> instruction
273 val ticc : {t:branch, cc:cc, r:CellsBasis.cell, i:operand} -> instruction
274 val fpop1 : {a:farith1, r:CellsBasis.cell, d:CellsBasis.cell} -> instruction
275 val fpop2 : {a:farith2, r1:CellsBasis.cell, r2:CellsBasis.cell, d:CellsBasis.cell} -> instruction
276 val fcmp : {cmp:fcmp, r1:CellsBasis.cell, r2:CellsBasis.cell, nop:bool} -> instruction
277 val save : {r:CellsBasis.cell, i:operand, d:CellsBasis.cell} -> instruction
278 val restore : {r:CellsBasis.cell, i:operand, d:CellsBasis.cell} -> instruction
279 val rdy : {d:CellsBasis.cell} -> instruction
280 val wry : {r:CellsBasis.cell, i:operand} -> instruction
281 val ret : {leaf:bool, nop:bool} -> instruction
282 val source : {} -> instruction
283 val sink : {} -> instruction
284 val phi : {} -> instruction
285 end
286
287 functor SparcInstr(T: MLTREE
288 ) : SPARCINSTR =
289 struct
290 structure C = SparcCells
291 structure CB = CellsBasis
292 structure T = T
293 structure Region = T.Region
294 structure Constant = T.Constant
295 datatype load =
296 LDSB
297 | LDSH
298 | LDUB
299 | LDUH
300 | LD
301 | LDX
302 | LDD
303 datatype store =
304 STB
305 | STH
306 | ST
307 | STX
308 | STD
309 datatype fload =
310 LDF
311 | LDDF
312 | LDQF
313 | LDFSR
314 | LDXFSR
315 datatype fstore =
316 STF
317 | STDF
318 | STFSR
319 datatype arith =
320 AND
321 | ANDCC
322 | ANDN
323 | ANDNCC
324 | OR
325 | ORCC
326 | ORN
327 | ORNCC
328 | XOR
329 | XORCC
330 | XNOR
331 | XNORCC
332 | ADD
333 | ADDCC
334 | TADD
335 | TADDCC
336 | TADDTV
337 | TADDTVCC
338 | SUB
339 | SUBCC
340 | TSUB
341 | TSUBCC
342 | TSUBTV
343 | TSUBTVCC
344 | UMUL
345 | UMULCC
346 | SMUL
347 | SMULCC
348 | UDIV
349 | UDIVCC
350 | SDIV
351 | SDIVCC
352 | MULX
353 | SDIVX
354 | UDIVX
355 datatype shift =
356 SLL
357 | SRL
358 | SRA
359 | SLLX
360 | SRLX
361 | SRAX
362 datatype farith1 =
363 FiTOs
364 | FiTOd
365 | FiTOq
366 | FsTOi
367 | FdTOi
368 | FqTOi
369 | FsTOd
370 | FsTOq
371 | FdTOs
372 | FdTOq
373 | FqTOs
374 | FqTOd
375 | FMOVs
376 | FNEGs
377 | FABSs
378 | FMOVd
379 | FNEGd
380 | FABSd
381 | FMOVq
382 | FNEGq
383 | FABSq
384 | FSQRTs
385 | FSQRTd
386 | FSQRTq
387 datatype farith2 =
388 FADDs
389 | FADDd
390 | FADDq
391 | FSUBs
392 | FSUBd
393 | FSUBq
394 | FMULs
395 | FMULd
396 | FMULq
397 | FsMULd
398 | FdMULq
399 | FDIVs
400 | FDIVd
401 | FDIVq
402 datatype fcmp =
403 FCMPs
404 | FCMPd
405 | FCMPq
406 | FCMPEs
407 | FCMPEd
408 | FCMPEq
409 datatype branch =
410 BN
411 | BE
412 | BLE
413 | BL
414 | BLEU
415 | BCS
416 | BNEG
417 | BVS
418 | BA
419 | BNE
420 | BG
421 | BGE
422 | BGU
423 | BCC
424 | BPOS
425 | BVC
426 datatype rcond =
427 RZ
428 | RLEZ
429 | RLZ
430 | RNZ
431 | RGZ
432 | RGEZ
433 datatype cc =
434 ICC
435 | XCC
436 datatype prediction =
437 PT
438 | PN
439 datatype fbranch =
440 FBN
441 | FBNE
442 | FBLG
443 | FBUL
444 | FBL
445 | FBUG
446 | FBG
447 | FBU
448 | FBA
449 | FBE
450 | FBUE
451 | FBGE
452 | FBUGE
453 | FBLE
454 | FBULE
455 | FBO
456 datatype ea =
457 Direct of CellsBasis.cell
458 | FDirect of CellsBasis.cell
459 | Displace of {base:CellsBasis.cell, disp:T.labexp, mem:Region.region}
460 datatype fsize =
461 S
462 | D
463 | Q
464 datatype operand =
465 REG of CellsBasis.cell
466 | IMMED of int
467 | LAB of T.labexp
468 | LO of T.labexp
469 | HI of T.labexp
470 type addressing_mode = CellsBasis.cell * operand
471 datatype instr =
472 LOAD of {l:load, d:CellsBasis.cell, r:CellsBasis.cell, i:operand, mem:Region.region}
473 | STORE of {s:store, d:CellsBasis.cell, r:CellsBasis.cell, i:operand, mem:Region.region}
474 | FLOAD of {l:fload, r:CellsBasis.cell, i:operand, d:CellsBasis.cell, mem:Region.region}
475 | FSTORE of {s:fstore, d:CellsBasis.cell, r:CellsBasis.cell, i:operand,
476 mem:Region.region}
477 | UNIMP of {const22:int}
478 | SETHI of {i:int, d:CellsBasis.cell}
479 | ARITH of {a:arith, r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
480 | SHIFT of {s:shift, r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
481 | MOVicc of {b:branch, i:operand, d:CellsBasis.cell}
482 | MOVfcc of {b:fbranch, i:operand, d:CellsBasis.cell}
483 | MOVR of {rcond:rcond, r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
484 | FMOVicc of {sz:fsize, b:branch, r:CellsBasis.cell, d:CellsBasis.cell}
485 | FMOVfcc of {sz:fsize, b:fbranch, r:CellsBasis.cell, d:CellsBasis.cell}
486 | Bicc of {b:branch, a:bool, label:Label.label, nop:bool}
487 | FBfcc of {b:fbranch, a:bool, label:Label.label, nop:bool}
488 | BR of {rcond:rcond, p:prediction, r:CellsBasis.cell, a:bool, label:Label.label,
489 nop:bool}
490 | BP of {b:branch, p:prediction, cc:cc, a:bool, label:Label.label, nop:bool}
491 | JMP of {r:CellsBasis.cell, i:operand, labs:Label.label list, nop:bool}
492 | JMPL of {r:CellsBasis.cell, i:operand, d:CellsBasis.cell, defs:C.cellset,
493 uses:C.cellset, cutsTo:Label.label list, nop:bool, mem:Region.region}
494 | CALL of {defs:C.cellset, uses:C.cellset, label:Label.label, cutsTo:Label.label list,
495 nop:bool, mem:Region.region}
496 | Ticc of {t:branch, cc:cc, r:CellsBasis.cell, i:operand}
497 | FPop1 of {a:farith1, r:CellsBasis.cell, d:CellsBasis.cell}
498 | FPop2 of {a:farith2, r1:CellsBasis.cell, r2:CellsBasis.cell, d:CellsBasis.cell}
499 | FCMP of {cmp:fcmp, r1:CellsBasis.cell, r2:CellsBasis.cell, nop:bool}
500 | SAVE of {r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
501 | RESTORE of {r:CellsBasis.cell, i:operand, d:CellsBasis.cell}
502 | RDY of {d:CellsBasis.cell}
503 | WRY of {r:CellsBasis.cell, i:operand}
504 | RET of {leaf:bool, nop:bool}
505 | SOURCE of {}
506 | SINK of {}
507 | PHI of {}
508 and instruction =
509 LIVE of {regs: C.cellset, spilled: C.cellset}
510 | KILL of {regs: C.cellset, spilled: C.cellset}
511 | COPY of {k: CellsBasis.cellkind,
512 sz: int, (* in bits *)
513 dst: CellsBasis.cell list,
514 src: CellsBasis.cell list,
515 tmp: ea option (* NONE if |dst| = {src| = 1 *)}
516 | ANNOTATION of {i:instruction, a:Annotations.annotation}
517 | INSTR of instr
518 val load = INSTR o LOAD
519 and store = INSTR o STORE
520 and fload = INSTR o FLOAD
521 and fstore = INSTR o FSTORE
522 and unimp = INSTR o UNIMP
523 and sethi = INSTR o SETHI
524 and arith = INSTR o ARITH
525 and shift = INSTR o SHIFT
526 and movicc = INSTR o MOVicc
527 and movfcc = INSTR o MOVfcc
528 and movr = INSTR o MOVR
529 and fmovicc = INSTR o FMOVicc
530 and fmovfcc = INSTR o FMOVfcc
531 and bicc = INSTR o Bicc
532 and fbfcc = INSTR o FBfcc
533 and br = INSTR o BR
534 and bp = INSTR o BP
535 and jmp = INSTR o JMP
536 and jmpl = INSTR o JMPL
537 and call = INSTR o CALL
538 and ticc = INSTR o Ticc
539 and fpop1 = INSTR o FPop1
540 and fpop2 = INSTR o FPop2
541 and fcmp = INSTR o FCMP
542 and save = INSTR o SAVE
543 and restore = INSTR o RESTORE
544 and rdy = INSTR o RDY
545 and wry = INSTR o WRY
546 and ret = INSTR o RET
547 and source = INSTR o SOURCE
548 and sink = INSTR o SINK
549 and phi = INSTR o PHI
550 end
551