Debian Codegraph @

lib/mlrisc-lib/MLRISC/mips/instructions/mipsInstr.sml

raw
1 (*
2 * WARNING: This file was automatically generated by MDLGen (v3.0)
3 * from the machine description file "mips/mips.mdl".
4 * DO NOT EDIT this file directly
5 *)
6
7
8 signature MIPSINSTR =
9 sig
10 structure C : MIPSCELLS
11 structure CB : CELLS_BASIS = CellsBasis
12 structure T : MLTREE
13 structure Constant: CONSTANT
14 structure Region : REGION
15 sharing Constant = T.Constant
16 sharing Region = T.Region
17 datatype load =
18 LD
19 | LW
20 | LH
21 | LHU
22 | LB
23 | LBU
24 | LWL
25 | LWR
26 | LWU
27 | LDL
28 | LDR
29 | ULH
30 | ULHU
31 | ULW
32 | ULD
33 datatype store =
34 SD
35 | SW
36 | SH
37 | SB
38 | SWL
39 | SWR
40 | SDL
41 | SDR
42 | USH
43 | USW
44 | USD
45 datatype fload =
46 LDC1
47 | LWC1
48 datatype fstore =
49 SDC1
50 | SWC1
51 datatype fcond =
52 FF
53 | FUN
54 | FEQ
55 | FUEQ
56 | FOLT
57 | FULT
58 | FOLE
59 | FULE
60 | FNGLE
61 | FSP
62 | FNGL
63 | FSEQ
64 | FLT
65 | FNGE
66 | FLE
67 | FNGT
68 datatype cond =
69 EQ
70 | NE
71 | LEZ
72 | GTZ
73 | LTZ
74 | GEZ
75 datatype fbranch =
76 BC1T
77 | BC1F
78 datatype likely =
79 LIKELY
80 | UNLIKELY
81 datatype arith =
82 ADD
83 | ADDU
84 | AND
85 | XOR
86 | MUL
87 | MULO
88 | MULOU
89 | NOR
90 | OR
91 | SEQ
92 | SGT
93 | SGE
94 | SGEU
95 | SGTU
96 | SLT
97 | SLE
98 | SLEU
99 | SLTU
100 | SNE
101 | SUB
102 | SUBU
103 | REM
104 | REMU
105 | SRA
106 | SLL
107 | SRL
108 | ROR
109 | ROL
110 | MOVN
111 | MOVZ
112 | DADD
113 | DADDU
114 | DMUL
115 | DMULO
116 | DMULOU
117 | DSUB
118 | DSUBU
119 | DREM
120 | DREMU
121 | DROL
122 | DROR
123 | DSLL
124 | DSLL32
125 | DSLLV
126 | DSRA
127 | DSRA32
128 | DSRAV
129 | DSRL
130 | DSRL32
131 | DSRLV
132 datatype unary =
133 ABS
134 | NEG
135 | NEGU
136 | NOT
137 | DABS
138 | DNEG
139 | DNEGU
140 datatype multiply =
141 MULT
142 | MULTU
143 | DMULT
144 | DMULTU
145 datatype divide =
146 DIV
147 | DIVU
148 | DDIV
149 | DDIVU
150 datatype trap =
151 TEQ
152 | TNE
153 | TLT
154 | TLTU
155 | TGE
156 | TGEU
157 datatype farith =
158 ADD_D
159 | ADD_S
160 | SUB_D
161 | SUB_S
162 | MUL_D
163 | MUL_S
164 | DIV_D
165 | DIV_S
166 datatype funary =
167 MOV_D
168 | MOV_S
169 | ABS_D
170 | ABS_S
171 | NEG_D
172 | NEG_S
173 | SQRT_D
174 | SQRT_S
175 | CVT_SD
176 | CVT_SW
177 | CVT_DS
178 | CVT_DW
179 | CVT_WS
180 | CVT_WD
181 | CVT_SL
182 | CVT_DL
183 | CVT_LS
184 | CVT_LD
185 datatype cvti2f =
186 MTC1
187 | DMTC1
188 datatype cvtf2i =
189 MFC1
190 | DMFC1
191 datatype farith3 =
192 MADD_D
193 | MADD_S
194 | NMADD_D
195 | NMADD_S
196 | MSUB_D
197 | MSUB_S
198 | NMSUB_D
199 | NMSUB_S
200 datatype fround =
201 TRUNC_WS
202 | TRUNC_WD
203 | ROUND_WS
204 | ROUND_WD
205 | CEIL_WD
206 | CEIL_WS
207 | CEILU_WD
208 | CEILU_WS
209 | FLOOR_WD
210 | FLOOR_WS
211 | FLOORU_WD
212 | FLOORU_WS
213 | ROUNDU_WD
214 | ROUNDU_WS
215 | TRUNCU_WD
216 | TRUNCU_WS
217 | TRUNC_LS
218 | TRUNC_LD
219 | ROUND_LS
220 | ROUND_LD
221 | CEIL_LS
222 | CEIL_LD
223 | FLOOR_LS
224 | FLOOR_LD
225 datatype fmt =
226 SINGLE
227 | DOUBLE
228 datatype operand =
229 Imm of int
230 | Reg of CellsBasis.cell
231 | Lab of T.labexp
232 | HiLab of T.labexp
233 | LoLab of T.labexp
234 datatype ea =
235 Direct of CellsBasis.cell
236 | FDirect of CellsBasis.cell
237 | Displace of {base:CellsBasis.cell, disp:int}
238 type addressing_mode = C.cell * operand
239 datatype instr =
240 NOP
241 | LUI of {rt:CellsBasis.cell, imm:operand}
242 | LA of {rt:CellsBasis.cell, b:CellsBasis.cell, d:operand}
243 | DLA of {rt:CellsBasis.cell, b:CellsBasis.cell, d:operand}
244 | LOAD of {l:load, rt:CellsBasis.cell, b:CellsBasis.cell, d:operand, mem:Region.region}
245 | STORE of {s:store, rs:CellsBasis.cell, b:CellsBasis.cell, d:operand, mem:Region.region}
246 | FLOAD of {l:fload, ft:CellsBasis.cell, b:CellsBasis.cell, d:operand, mem:Region.region}
247 | FSTORE of {s:fstore, fs:CellsBasis.cell, b:CellsBasis.cell, d:operand,
248 mem:Region.region}
249 | FCMP of {fcond:fcond, fmt:fmt, cc:CellsBasis.cell, fs1:CellsBasis.cell,
250 fs2:CellsBasis.cell}
251 | TRAP of {t:trap, rs:CellsBasis.cell, i:operand}
252 | J of {lab:Label.label, nop:bool}
253 | JR of {rs:CellsBasis.cell, labels:Label.label list, nop:bool}
254 | JAL of {lab:Label.label, defs:C.cellset, uses:C.cellset, cutsTo:Label.label list,
255 mem:Region.region, nop:bool}
256 | JALR of {rt:CellsBasis.cell, rs:CellsBasis.cell, defs:C.cellset, uses:C.cellset,
257 cutsTo:Label.label list, mem:Region.region, nop:bool}
258 | RET of {nop:bool}
259 | BRANCH of {likely:likely, cond:cond, rs:CellsBasis.cell, rt:CellsBasis.cell,
260 lab:Label.label, nop:bool}
261 | FBRANCH of {likely:likely, fbranch:fbranch, cc:CellsBasis.cell, lab:Label.label,
262 nop:bool}
263 | ARITH of {oper:arith, rt:CellsBasis.cell, rs:CellsBasis.cell, i:operand}
264 | UNARY of {oper:unary, rt:CellsBasis.cell, rs:CellsBasis.cell}
265 | MULTIPLY of {oper:multiply, rt:CellsBasis.cell, rs:CellsBasis.cell}
266 | DIVIDE of {oper:divide, rt:CellsBasis.cell, rs:CellsBasis.cell}
267 | MFLO of CellsBasis.cell
268 | MTLO of CellsBasis.cell
269 | MFHI of CellsBasis.cell
270 | MTHI of CellsBasis.cell
271 | BREAK of int
272 | FARITH of {oper:farith, ft:CellsBasis.cell, fs1:CellsBasis.cell, fs2:CellsBasis.cell}
273 | FUNARY of {oper:funary, ft:CellsBasis.cell, fs:CellsBasis.cell}
274 | FARITH3 of {oper:farith3, ft:CellsBasis.cell, fs1:CellsBasis.cell, fs2:CellsBasis.cell,
275 fs3:CellsBasis.cell}
276 | FROUND of {oper:fround, ft:CellsBasis.cell, fs1:CellsBasis.cell, rs2:CellsBasis.cell}
277 | CVTI2F of {cvt:cvti2f, rs:CellsBasis.cell, ft:CellsBasis.cell}
278 | CVTF2I of {cvt:cvtf2i, fs:CellsBasis.cell, rt:CellsBasis.cell}
279 | COPY of {dst:(CellsBasis.cell) list, src:(CellsBasis.cell) list, impl:instruction list option ref,
280 tmp:ea option}
281 | FCOPY of {dst:(CellsBasis.cell) list, src:(CellsBasis.cell) list, impl:instruction list option ref,
282 tmp:ea option}
283 | ANNOTATION of {i:instruction, a:Annotations.annotation}
284 | PHI of {}
285 | SOURCE of {}
286 | SINK of {}
287 and instruction =
288 LIVE of {regs: C.cellset, spilled: C.cellset}
289 | KILL of {regs: C.cellset, spilled: C.cellset}
290 | COPY of {k: CellsBasis.cellkind,
291 sz: int, (* in bits *)
292 dst: CellsBasis.cell list,
293 src: CellsBasis.cell list,
294 tmp: ea option (* NONE if |dst| = {src| = 1 *)}
295 | ANNOTATION of {i:instruction, a:Annotations.annotation}
296 | INSTR of instr
297 val nop : instruction
298 val lui : {rt:CellsBasis.cell, imm:operand} -> instruction
299 val la : {rt:CellsBasis.cell, b:CellsBasis.cell, d:operand} -> instruction
300 val dla : {rt:CellsBasis.cell, b:CellsBasis.cell, d:operand} -> instruction
301 val load : {l:load, rt:CellsBasis.cell, b:CellsBasis.cell, d:operand, mem:Region.region} -> instruction
302 val store : {s:store, rs:CellsBasis.cell, b:CellsBasis.cell, d:operand,
303 mem:Region.region} -> instruction
304 val fload : {l:fload, ft:CellsBasis.cell, b:CellsBasis.cell, d:operand,
305 mem:Region.region} -> instruction
306 val fstore : {s:fstore, fs:CellsBasis.cell, b:CellsBasis.cell, d:operand,
307 mem:Region.region} -> instruction
308 val fcmp : {fcond:fcond, fmt:fmt, cc:CellsBasis.cell, fs1:CellsBasis.cell,
309 fs2:CellsBasis.cell} -> instruction
310 val trap : {t:trap, rs:CellsBasis.cell, i:operand} -> instruction
311 val j : {lab:Label.label, nop:bool} -> instruction
312 val jr : {rs:CellsBasis.cell, labels:Label.label list, nop:bool} -> instruction
313 val jal : {lab:Label.label, defs:C.cellset, uses:C.cellset, cutsTo:Label.label list,
314 mem:Region.region, nop:bool} -> instruction
315 val jalr : {rt:CellsBasis.cell, rs:CellsBasis.cell, defs:C.cellset, uses:C.cellset,
316 cutsTo:Label.label list, mem:Region.region, nop:bool} -> instruction
317 val ret : {nop:bool} -> instruction
318 val branch : {likely:likely, cond:cond, rs:CellsBasis.cell, rt:CellsBasis.cell,
319 lab:Label.label, nop:bool} -> instruction
320 val fbranch : {likely:likely, fbranch:fbranch, cc:CellsBasis.cell, lab:Label.label,
321 nop:bool} -> instruction
322 val arith : {oper:arith, rt:CellsBasis.cell, rs:CellsBasis.cell, i:operand} -> instruction
323 val unary : {oper:unary, rt:CellsBasis.cell, rs:CellsBasis.cell} -> instruction
324 val multiply : {oper:multiply, rt:CellsBasis.cell, rs:CellsBasis.cell} -> instruction
325 val divide : {oper:divide, rt:CellsBasis.cell, rs:CellsBasis.cell} -> instruction
326 val mflo : CellsBasis.cell -> instruction
327 val mtlo : CellsBasis.cell -> instruction
328 val mfhi : CellsBasis.cell -> instruction
329 val mthi : CellsBasis.cell -> instruction
330 val break : int -> instruction
331 val farith : {oper:farith, ft:CellsBasis.cell, fs1:CellsBasis.cell, fs2:CellsBasis.cell} -> instruction
332 val funary : {oper:funary, ft:CellsBasis.cell, fs:CellsBasis.cell} -> instruction
333 val farith3 : {oper:farith3, ft:CellsBasis.cell, fs1:CellsBasis.cell, fs2:CellsBasis.cell,
334 fs3:CellsBasis.cell} -> instruction
335 val fround : {oper:fround, ft:CellsBasis.cell, fs1:CellsBasis.cell, rs2:CellsBasis.cell} -> instruction
336 val cvti2f : {cvt:cvti2f, rs:CellsBasis.cell, ft:CellsBasis.cell} -> instruction
337 val cvtf2i : {cvt:cvtf2i, fs:CellsBasis.cell, rt:CellsBasis.cell} -> instruction
338 val copy : {dst:(CellsBasis.cell) list, src:(CellsBasis.cell) list, impl:instruction list option ref,
339 tmp:ea option} -> instruction
340 val fcopy : {dst:(CellsBasis.cell) list, src:(CellsBasis.cell) list, impl:instruction list option ref,
341 tmp:ea option} -> instruction
342 val annotation : {i:instruction, a:Annotations.annotation} -> instruction
343 val phi : {} -> instruction
344 val source : {} -> instruction
345 val sink : {} -> instruction
346 end
347
348 functor MIPSInstr(T: MLTREE
349 ) : MIPSINSTR =
350 struct
351 structure C = MIPSCells
352 structure CB = CellsBasis
353 structure T = T
354 structure Region = T.Region
355 structure Constant = T.Constant
356 datatype load =
357 LD
358 | LW
359 | LH
360 | LHU
361 | LB
362 | LBU
363 | LWL
364 | LWR
365 | LWU
366 | LDL
367 | LDR
368 | ULH
369 | ULHU
370 | ULW
371 | ULD
372 datatype store =
373 SD
374 | SW
375 | SH
376 | SB
377 | SWL
378 | SWR
379 | SDL
380 | SDR
381 | USH
382 | USW
383 | USD
384 datatype fload =
385 LDC1
386 | LWC1
387 datatype fstore =
388 SDC1
389 | SWC1
390 datatype fcond =
391 FF
392 | FUN
393 | FEQ
394 | FUEQ
395 | FOLT
396 | FULT
397 | FOLE
398 | FULE
399 | FNGLE
400 | FSP
401 | FNGL
402 | FSEQ
403 | FLT
404 | FNGE
405 | FLE
406 | FNGT
407 datatype cond =
408 EQ
409 | NE
410 | LEZ
411 | GTZ
412 | LTZ
413 | GEZ
414 datatype fbranch =
415 BC1T
416 | BC1F
417 datatype likely =
418 LIKELY
419 | UNLIKELY
420 datatype arith =
421 ADD
422 | ADDU
423 | AND
424 | XOR
425 | MUL
426 | MULO
427 | MULOU
428 | NOR
429 | OR
430 | SEQ
431 | SGT
432 | SGE
433 | SGEU
434 | SGTU
435 | SLT
436 | SLE
437 | SLEU
438 | SLTU
439 | SNE
440 | SUB
441 | SUBU
442 | REM
443 | REMU
444 | SRA
445 | SLL
446 | SRL
447 | ROR
448 | ROL
449 | MOVN
450 | MOVZ
451 | DADD
452 | DADDU
453 | DMUL
454 | DMULO
455 | DMULOU
456 | DSUB
457 | DSUBU
458 | DREM
459 | DREMU
460 | DROL
461 | DROR
462 | DSLL
463 | DSLL32
464 | DSLLV
465 | DSRA
466 | DSRA32
467 | DSRAV
468 | DSRL
469 | DSRL32
470 | DSRLV
471 datatype unary =
472 ABS
473 | NEG
474 | NEGU
475 | NOT
476 | DABS
477 | DNEG
478 | DNEGU
479 datatype multiply =
480 MULT
481 | MULTU
482 | DMULT
483 | DMULTU
484 datatype divide =
485 DIV
486 | DIVU
487 | DDIV
488 | DDIVU
489 datatype trap =
490 TEQ
491 | TNE
492 | TLT
493 | TLTU
494 | TGE
495 | TGEU
496 datatype farith =
497 ADD_D
498 | ADD_S
499 | SUB_D
500 | SUB_S
501 | MUL_D
502 | MUL_S
503 | DIV_D
504 | DIV_S
505 datatype funary =
506 MOV_D
507 | MOV_S
508 | ABS_D
509 | ABS_S
510 | NEG_D
511 | NEG_S
512 | SQRT_D
513 | SQRT_S
514 | CVT_SD
515 | CVT_SW
516 | CVT_DS
517 | CVT_DW
518 | CVT_WS
519 | CVT_WD
520 | CVT_SL
521 | CVT_DL
522 | CVT_LS
523 | CVT_LD
524 datatype cvti2f =
525 MTC1
526 | DMTC1
527 datatype cvtf2i =
528 MFC1
529 | DMFC1
530 datatype farith3 =
531 MADD_D
532 | MADD_S
533 | NMADD_D
534 | NMADD_S
535 | MSUB_D
536 | MSUB_S
537 | NMSUB_D
538 | NMSUB_S
539 datatype fround =
540 TRUNC_WS
541 | TRUNC_WD
542 | ROUND_WS
543 | ROUND_WD
544 | CEIL_WD
545 | CEIL_WS
546 | CEILU_WD
547 | CEILU_WS
548 | FLOOR_WD
549 | FLOOR_WS
550 | FLOORU_WD
551 | FLOORU_WS
552 | ROUNDU_WD
553 | ROUNDU_WS
554 | TRUNCU_WD
555 | TRUNCU_WS
556 | TRUNC_LS
557 | TRUNC_LD
558 | ROUND_LS
559 | ROUND_LD
560 | CEIL_LS
561 | CEIL_LD
562 | FLOOR_LS
563 | FLOOR_LD
564 datatype fmt =
565 SINGLE
566 | DOUBLE
567 datatype operand =
568 Imm of int
569 | Reg of CellsBasis.cell
570 | Lab of T.labexp
571 | HiLab of T.labexp
572 | LoLab of T.labexp
573 datatype ea =
574 Direct of CellsBasis.cell
575 | FDirect of CellsBasis.cell
576 | Displace of {base:CellsBasis.cell, disp:int}
577 type addressing_mode = C.cell * operand
578 datatype instr =
579 NOP
580 | LUI of {rt:CellsBasis.cell, imm:operand}
581 | LA of {rt:CellsBasis.cell, b:CellsBasis.cell, d:operand}
582 | DLA of {rt:CellsBasis.cell, b:CellsBasis.cell, d:operand}
583 | LOAD of {l:load, rt:CellsBasis.cell, b:CellsBasis.cell, d:operand, mem:Region.region}
584 | STORE of {s:store, rs:CellsBasis.cell, b:CellsBasis.cell, d:operand, mem:Region.region}
585 | FLOAD of {l:fload, ft:CellsBasis.cell, b:CellsBasis.cell, d:operand, mem:Region.region}
586 | FSTORE of {s:fstore, fs:CellsBasis.cell, b:CellsBasis.cell, d:operand,
587 mem:Region.region}
588 | FCMP of {fcond:fcond, fmt:fmt, cc:CellsBasis.cell, fs1:CellsBasis.cell,
589 fs2:CellsBasis.cell}
590 | TRAP of {t:trap, rs:CellsBasis.cell, i:operand}
591 | J of {lab:Label.label, nop:bool}
592 | JR of {rs:CellsBasis.cell, labels:Label.label list, nop:bool}
593 | JAL of {lab:Label.label, defs:C.cellset, uses:C.cellset, cutsTo:Label.label list,
594 mem:Region.region, nop:bool}
595 | JALR of {rt:CellsBasis.cell, rs:CellsBasis.cell, defs:C.cellset, uses:C.cellset,
596 cutsTo:Label.label list, mem:Region.region, nop:bool}
597 | RET of {nop:bool}
598 | BRANCH of {likely:likely, cond:cond, rs:CellsBasis.cell, rt:CellsBasis.cell,
599 lab:Label.label, nop:bool}
600 | FBRANCH of {likely:likely, fbranch:fbranch, cc:CellsBasis.cell, lab:Label.label,
601 nop:bool}
602 | ARITH of {oper:arith, rt:CellsBasis.cell, rs:CellsBasis.cell, i:operand}
603 | UNARY of {oper:unary, rt:CellsBasis.cell, rs:CellsBasis.cell}
604 | MULTIPLY of {oper:multiply, rt:CellsBasis.cell, rs:CellsBasis.cell}
605 | DIVIDE of {oper:divide, rt:CellsBasis.cell, rs:CellsBasis.cell}
606 | MFLO of CellsBasis.cell
607 | MTLO of CellsBasis.cell
608 | MFHI of CellsBasis.cell
609 | MTHI of CellsBasis.cell
610 | BREAK of int
611 | FARITH of {oper:farith, ft:CellsBasis.cell, fs1:CellsBasis.cell, fs2:CellsBasis.cell}
612 | FUNARY of {oper:funary, ft:CellsBasis.cell, fs:CellsBasis.cell}
613 | FARITH3 of {oper:farith3, ft:CellsBasis.cell, fs1:CellsBasis.cell, fs2:CellsBasis.cell,
614 fs3:CellsBasis.cell}
615 | FROUND of {oper:fround, ft:CellsBasis.cell, fs1:CellsBasis.cell, rs2:CellsBasis.cell}
616 | CVTI2F of {cvt:cvti2f, rs:CellsBasis.cell, ft:CellsBasis.cell}
617 | CVTF2I of {cvt:cvtf2i, fs:CellsBasis.cell, rt:CellsBasis.cell}
618 | COPY of {dst:(CellsBasis.cell) list, src:(CellsBasis.cell) list, impl:instruction list option ref,
619 tmp:ea option}
620 | FCOPY of {dst:(CellsBasis.cell) list, src:(CellsBasis.cell) list, impl:instruction list option ref,
621 tmp:ea option}
622 | ANNOTATION of {i:instruction, a:Annotations.annotation}
623 | PHI of {}
624 | SOURCE of {}
625 | SINK of {}
626 and instruction =
627 LIVE of {regs: C.cellset, spilled: C.cellset}
628 | KILL of {regs: C.cellset, spilled: C.cellset}
629 | COPY of {k: CellsBasis.cellkind,
630 sz: int, (* in bits *)
631 dst: CellsBasis.cell list,
632 src: CellsBasis.cell list,
633 tmp: ea option (* NONE if |dst| = {src| = 1 *)}
634 | ANNOTATION of {i:instruction, a:Annotations.annotation}
635 | INSTR of instr
636 val nop = INSTR NOP
637 and lui = INSTR o LUI
638 and la = INSTR o LA
639 and dla = INSTR o DLA
640 and load = INSTR o LOAD
641 and store = INSTR o STORE
642 and fload = INSTR o FLOAD
643 and fstore = INSTR o FSTORE
644 and fcmp = INSTR o FCMP
645 and trap = INSTR o TRAP
646 and j = INSTR o J
647 and jr = INSTR o JR
648 and jal = INSTR o JAL
649 and jalr = INSTR o JALR
650 and ret = INSTR o RET
651 and branch = INSTR o BRANCH
652 and fbranch = INSTR o FBRANCH
653 and arith = INSTR o ARITH
654 and unary = INSTR o UNARY
655 and multiply = INSTR o MULTIPLY
656 and divide = INSTR o DIVIDE
657 and mflo = INSTR o MFLO
658 and mtlo = INSTR o MTLO
659 and mfhi = INSTR o MFHI
660 and mthi = INSTR o MTHI
661 and break = INSTR o BREAK
662 and farith = INSTR o FARITH
663 and funary = INSTR o FUNARY
664 and farith3 = INSTR o FARITH3
665 and fround = INSTR o FROUND
666 and cvti2f = INSTR o CVTI2F
667 and cvtf2i = INSTR o CVTF2I
668 and copy = INSTR o COPY
669 and fcopy = INSTR o FCOPY
670 and annotation = INSTR o ANNOTATION
671 and phi = INSTR o PHI
672 and source = INSTR o SOURCE
673 and sink = INSTR o SINK
674 end
675