Debian Codegraph @

lib/mlrisc-lib/MLRISC/amd64/instructions/amd64Instr.sml

raw
1 (*
2 * WARNING: This file was automatically generated by MDLGen (v3.1)
3 * from the machine description file "amd64/amd64.mdl".
4 * DO NOT EDIT this file directly
5 *)
6
7
8 signature AMD64INSTR =
9 sig
10 structure C : AMD64CELLS
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 operand =
27 Immed of Int32.int
28 | Immed64 of Int64.int
29 | ImmedLabel of T.labexp
30 | Relative of int
31 | LabelEA of T.labexp
32 | Direct of int * (CellsBasis.cell)
33 | FDirect of CellsBasis.cell
34 | Displace of {base:CellsBasis.cell, disp:operand, mem:Region.region}
35 | Indexed of {base:(CellsBasis.cell) option, index:CellsBasis.cell, scale:int,
36 disp:operand, mem:Region.region}
37 type addressing_mode = operand
38 type ea = operand
39 type byte = Word8.word
40 datatype cond =
41 EQ
42 | NE
43 | LT
44 | LE
45 | GT
46 | GE
47 | B
48 | BE
49 | A
50 | AE
51 | C
52 | NC
53 | P
54 | NP
55 | O
56 | NO
57 datatype binaryOp =
58 ADDQ
59 | SUBQ
60 | ANDQ
61 | ORQ
62 | XORQ
63 | SHLQ
64 | SARQ
65 | SHRQ
66 | IMULQ
67 | ADCQ
68 | SBBQ
69 | ADDL
70 | SUBL
71 | ANDL
72 | ORL
73 | XORL
74 | SHLL
75 | SARL
76 | SHRL
77 | IMULL
78 | ADCL
79 | SBBL
80 | ADDW
81 | SUBW
82 | ANDW
83 | ORW
84 | XORW
85 | SHLW
86 | SARW
87 | SHRW
88 | IMULW
89 | ADDB
90 | SUBB
91 | ANDB
92 | ORB
93 | XORB
94 | SHLB
95 | SARB
96 | SHRB
97 | IMULB
98 | BTSW
99 | BTCW
100 | BTRW
101 | BTSL
102 | BTCL
103 | BTRL
104 | ROLW
105 | RORW
106 | ROLL
107 | RORL
108 | XCHGB
109 | XCHGW
110 | XCHGL
111 | LOCK_ADCW
112 | LOCK_ADCL
113 | LOCK_ADDW
114 | LOCK_ADDL
115 | LOCK_ANDW
116 | LOCK_ANDL
117 | LOCK_BTSW
118 | LOCK_BTSL
119 | LOCK_BTRW
120 | LOCK_BTRL
121 | LOCK_BTCW
122 | LOCK_BTCL
123 | LOCK_ORW
124 | LOCK_ORL
125 | LOCK_SBBW
126 | LOCK_SBBL
127 | LOCK_SUBW
128 | LOCK_SUBL
129 | LOCK_XORW
130 | LOCK_XORL
131 | LOCK_XADDB
132 | LOCK_XADDW
133 | LOCK_XADDL
134 datatype multDivOp =
135 IMULL1
136 | MULL1
137 | IDIVL1
138 | DIVL1
139 | IMULQ1
140 | MULQ1
141 | IDIVQ1
142 | DIVQ1
143 datatype unaryOp =
144 DECQ
145 | INCQ
146 | NEGQ
147 | NOTQ
148 | DECL
149 | INCL
150 | NEGL
151 | NOTL
152 | DECW
153 | INCW
154 | NEGW
155 | NOTW
156 | DECB
157 | INCB
158 | NEGB
159 | NOTB
160 | LOCK_DECQ
161 | LOCK_INCQ
162 | LOCK_NEGQ
163 | LOCK_NOTQ
164 datatype shiftOp =
165 SHLDL
166 | SHRDL
167 datatype bitOp =
168 BTW
169 | BTL
170 | BTQ
171 | LOCK_BTW
172 | LOCK_BTL
173 datatype move =
174 MOVQ
175 | MOVL
176 | MOVB
177 | MOVW
178 | MOVABSQ
179 | MOVSWQ
180 | MOVZWQ
181 | MOVSWL
182 | MOVZWL
183 | MOVSBQ
184 | MOVZBQ
185 | MOVSBL
186 | MOVZBL
187 | MOVSLQ
188 | CVTSD2SI
189 | CVTSS2SI
190 | CVTSD2SIQ
191 | CVTSS2SIQ
192 datatype fbin_op =
193 ADDSS
194 | ADDSD
195 | SUBSS
196 | SUBSD
197 | MULSS
198 | MULSD
199 | DIVSS
200 | DIVSD
201 | XORPS
202 | XORPD
203 | ANDPS
204 | ANDPD
205 | ORPS
206 | ORPD
207 datatype fcom_op =
208 COMISS
209 | COMISD
210 | UCOMISS
211 | UCOMISD
212 datatype fmove_op =
213 MOVSS
214 | MOVSD
215 | CVTSS2SD
216 | CVTSD2SS
217 | CVTSI2SS
218 | CVTSI2SSQ
219 | CVTSI2SD
220 | CVTSI2SDQ
221 datatype fsize =
222 FP32
223 | FP64
224 datatype isize =
225 I8
226 | I16
227 | I32
228 | I64
229 datatype instr =
230 NOP
231 | JMP of operand * Label.label list
232 | JCC of {cond:cond, opnd:operand}
233 | CALL of {opnd:operand, defs:C.cellset, uses:C.cellset, return:C.cellset,
234 cutsTo:Label.label list, mem:Region.region, pops:Int32.int}
235 | ENTER of {src1:operand, src2:operand}
236 | LEAVE
237 | RET of operand option
238 | MOVE of {mvOp:move, src:operand, dst:operand}
239 | LEAL of {r32:CellsBasis.cell, addr:operand}
240 | LEAQ of {r64:CellsBasis.cell, addr:operand}
241 | CMPQ of {lsrc:operand, rsrc:operand}
242 | CMPL of {lsrc:operand, rsrc:operand}
243 | CMPW of {lsrc:operand, rsrc:operand}
244 | CMPB of {lsrc:operand, rsrc:operand}
245 | TESTQ of {lsrc:operand, rsrc:operand}
246 | TESTL of {lsrc:operand, rsrc:operand}
247 | TESTW of {lsrc:operand, rsrc:operand}
248 | TESTB of {lsrc:operand, rsrc:operand}
249 | BITOP of {bitOp:bitOp, lsrc:operand, rsrc:operand}
250 | BINARY of {binOp:binaryOp, src:operand, dst:operand}
251 | SHIFT of {shiftOp:shiftOp, src:operand, dst:operand, count:operand}
252 | MULTDIV of {multDivOp:multDivOp, src:operand}
253 | MUL3 of {dst:CellsBasis.cell, src2:Int32.int, src1:operand}
254 | MULQ3 of {dst:CellsBasis.cell, src2:Int32.int, src1:operand}
255 | UNARY of {unOp:unaryOp, opnd:operand}
256 | SET of {cond:cond, opnd:operand}
257 | CMOV of {cond:cond, src:operand, dst:CellsBasis.cell}
258 | PUSH of operand
259 | PUSHFQ
260 | POPFQ
261 | POP of operand
262 | CDQ
263 | CDO
264 | INT of byte
265 | FMOVE of {fmvOp:fmove_op, dst:operand, src:operand}
266 | FBINOP of {binOp:fbin_op, dst:CellsBasis.cell, src:operand}
267 | FCOM of {comOp:fcom_op, dst:CellsBasis.cell, src:operand}
268 | FSQRTS of {dst:operand, src:operand}
269 | FSQRTD of {dst:operand, src:operand}
270 | SAHF
271 | LFENCE
272 | MFENCE
273 | SFENCE
274 | PAUSE
275 | XCHG of {lock:bool, sz:isize, src:operand, dst:operand}
276 | CMPXCHG of {lock:bool, sz:isize, src:operand, dst:operand}
277 | XADD of {lock:bool, sz:isize, src:operand, dst:operand}
278 | RDTSC
279 | RDTSCP
280 | LAHF
281 | SOURCE of {}
282 | SINK of {}
283 | PHI of {}
284 and instruction =
285 LIVE of {regs: C.cellset, spilled: C.cellset}
286 | KILL of {regs: C.cellset, spilled: C.cellset}
287 | COPY of {k: CellsBasis.cellkind,
288 sz: int, (* in bits *)
289 dst: CellsBasis.cell list,
290 src: CellsBasis.cell list,
291 tmp: ea option (* NONE if |dst| = {src| = 1 *)}
292 | ANNOTATION of {i:instruction, a:Annotations.annotation}
293 | INSTR of instr
294 val nop : instruction
295 val jmp : operand * Label.label list -> instruction
296 val jcc : {cond:cond, opnd:operand} -> instruction
297 val call : {opnd:operand, defs:C.cellset, uses:C.cellset, return:C.cellset,
298 cutsTo:Label.label list, mem:Region.region, pops:Int32.int} -> instruction
299 val enter : {src1:operand, src2:operand} -> instruction
300 val leave : instruction
301 val ret : operand option -> instruction
302 val move : {mvOp:move, src:operand, dst:operand} -> instruction
303 val leal : {r32:CellsBasis.cell, addr:operand} -> instruction
304 val leaq : {r64:CellsBasis.cell, addr:operand} -> instruction
305 val cmpq : {lsrc:operand, rsrc:operand} -> instruction
306 val cmpl : {lsrc:operand, rsrc:operand} -> instruction
307 val cmpw : {lsrc:operand, rsrc:operand} -> instruction
308 val cmpb : {lsrc:operand, rsrc:operand} -> instruction
309 val testq : {lsrc:operand, rsrc:operand} -> instruction
310 val testl : {lsrc:operand, rsrc:operand} -> instruction
311 val testw : {lsrc:operand, rsrc:operand} -> instruction
312 val testb : {lsrc:operand, rsrc:operand} -> instruction
313 val bitop : {bitOp:bitOp, lsrc:operand, rsrc:operand} -> instruction
314 val binary : {binOp:binaryOp, src:operand, dst:operand} -> instruction
315 val shift : {shiftOp:shiftOp, src:operand, dst:operand, count:operand} -> instruction
316 val multdiv : {multDivOp:multDivOp, src:operand} -> instruction
317 val mul3 : {dst:CellsBasis.cell, src2:Int32.int, src1:operand} -> instruction
318 val mulq3 : {dst:CellsBasis.cell, src2:Int32.int, src1:operand} -> instruction
319 val unary : {unOp:unaryOp, opnd:operand} -> instruction
320 val set : {cond:cond, opnd:operand} -> instruction
321 val cmov : {cond:cond, src:operand, dst:CellsBasis.cell} -> instruction
322 val push : operand -> instruction
323 val pushfq : instruction
324 val popfq : instruction
325 val pop : operand -> instruction
326 val cdq : instruction
327 val cdo : instruction
328 val int : byte -> instruction
329 val fmove : {fmvOp:fmove_op, dst:operand, src:operand} -> instruction
330 val fbinop : {binOp:fbin_op, dst:CellsBasis.cell, src:operand} -> instruction
331 val fcom : {comOp:fcom_op, dst:CellsBasis.cell, src:operand} -> instruction
332 val fsqrts : {dst:operand, src:operand} -> instruction
333 val fsqrtd : {dst:operand, src:operand} -> instruction
334 val sahf : instruction
335 val lfence : instruction
336 val mfence : instruction
337 val sfence : instruction
338 val pause : instruction
339 val xchg : {lock:bool, sz:isize, src:operand, dst:operand} -> instruction
340 val cmpxchg : {lock:bool, sz:isize, src:operand, dst:operand} -> instruction
341 val xadd : {lock:bool, sz:isize, src:operand, dst:operand} -> instruction
342 val rdtsc : instruction
343 val rdtscp : instruction
344 val lahf : instruction
345 val source : {} -> instruction
346 val sink : {} -> instruction
347 val phi : {} -> instruction
348 end
349
350 functor AMD64Instr(T: MLTREE
351 ) : AMD64INSTR =
352 struct
353 structure C = AMD64Cells
354 structure CB = CellsBasis
355 structure T = T
356 structure Region = T.Region
357 structure Constant = T.Constant
358 datatype operand =
359 Immed of Int32.int
360 | Immed64 of Int64.int
361 | ImmedLabel of T.labexp
362 | Relative of int
363 | LabelEA of T.labexp
364 | Direct of int * (CellsBasis.cell)
365 | FDirect of CellsBasis.cell
366 | Displace of {base:CellsBasis.cell, disp:operand, mem:Region.region}
367 | Indexed of {base:(CellsBasis.cell) option, index:CellsBasis.cell, scale:int,
368 disp:operand, mem:Region.region}
369 type addressing_mode = operand
370 type ea = operand
371 type byte = Word8.word
372 datatype cond =
373 EQ
374 | NE
375 | LT
376 | LE
377 | GT
378 | GE
379 | B
380 | BE
381 | A
382 | AE
383 | C
384 | NC
385 | P
386 | NP
387 | O
388 | NO
389 datatype binaryOp =
390 ADDQ
391 | SUBQ
392 | ANDQ
393 | ORQ
394 | XORQ
395 | SHLQ
396 | SARQ
397 | SHRQ
398 | IMULQ
399 | ADCQ
400 | SBBQ
401 | ADDL
402 | SUBL
403 | ANDL
404 | ORL
405 | XORL
406 | SHLL
407 | SARL
408 | SHRL
409 | IMULL
410 | ADCL
411 | SBBL
412 | ADDW
413 | SUBW
414 | ANDW
415 | ORW
416 | XORW
417 | SHLW
418 | SARW
419 | SHRW
420 | IMULW
421 | ADDB
422 | SUBB
423 | ANDB
424 | ORB
425 | XORB
426 | SHLB
427 | SARB
428 | SHRB
429 | IMULB
430 | BTSW
431 | BTCW
432 | BTRW
433 | BTSL
434 | BTCL
435 | BTRL
436 | ROLW
437 | RORW
438 | ROLL
439 | RORL
440 | XCHGB
441 | XCHGW
442 | XCHGL
443 | LOCK_ADCW
444 | LOCK_ADCL
445 | LOCK_ADDW
446 | LOCK_ADDL
447 | LOCK_ANDW
448 | LOCK_ANDL
449 | LOCK_BTSW
450 | LOCK_BTSL
451 | LOCK_BTRW
452 | LOCK_BTRL
453 | LOCK_BTCW
454 | LOCK_BTCL
455 | LOCK_ORW
456 | LOCK_ORL
457 | LOCK_SBBW
458 | LOCK_SBBL
459 | LOCK_SUBW
460 | LOCK_SUBL
461 | LOCK_XORW
462 | LOCK_XORL
463 | LOCK_XADDB
464 | LOCK_XADDW
465 | LOCK_XADDL
466 datatype multDivOp =
467 IMULL1
468 | MULL1
469 | IDIVL1
470 | DIVL1
471 | IMULQ1
472 | MULQ1
473 | IDIVQ1
474 | DIVQ1
475 datatype unaryOp =
476 DECQ
477 | INCQ
478 | NEGQ
479 | NOTQ
480 | DECL
481 | INCL
482 | NEGL
483 | NOTL
484 | DECW
485 | INCW
486 | NEGW
487 | NOTW
488 | DECB
489 | INCB
490 | NEGB
491 | NOTB
492 | LOCK_DECQ
493 | LOCK_INCQ
494 | LOCK_NEGQ
495 | LOCK_NOTQ
496 datatype shiftOp =
497 SHLDL
498 | SHRDL
499 datatype bitOp =
500 BTW
501 | BTL
502 | BTQ
503 | LOCK_BTW
504 | LOCK_BTL
505 datatype move =
506 MOVQ
507 | MOVL
508 | MOVB
509 | MOVW
510 | MOVABSQ
511 | MOVSWQ
512 | MOVZWQ
513 | MOVSWL
514 | MOVZWL
515 | MOVSBQ
516 | MOVZBQ
517 | MOVSBL
518 | MOVZBL
519 | MOVSLQ
520 | CVTSD2SI
521 | CVTSS2SI
522 | CVTSD2SIQ
523 | CVTSS2SIQ
524 datatype fbin_op =
525 ADDSS
526 | ADDSD
527 | SUBSS
528 | SUBSD
529 | MULSS
530 | MULSD
531 | DIVSS
532 | DIVSD
533 | XORPS
534 | XORPD
535 | ANDPS
536 | ANDPD
537 | ORPS
538 | ORPD
539 datatype fcom_op =
540 COMISS
541 | COMISD
542 | UCOMISS
543 | UCOMISD
544 datatype fmove_op =
545 MOVSS
546 | MOVSD
547 | CVTSS2SD
548 | CVTSD2SS
549 | CVTSI2SS
550 | CVTSI2SSQ
551 | CVTSI2SD
552 | CVTSI2SDQ
553 datatype fsize =
554 FP32
555 | FP64
556 datatype isize =
557 I8
558 | I16
559 | I32
560 | I64
561 datatype instr =
562 NOP
563 | JMP of operand * Label.label list
564 | JCC of {cond:cond, opnd:operand}
565 | CALL of {opnd:operand, defs:C.cellset, uses:C.cellset, return:C.cellset,
566 cutsTo:Label.label list, mem:Region.region, pops:Int32.int}
567 | ENTER of {src1:operand, src2:operand}
568 | LEAVE
569 | RET of operand option
570 | MOVE of {mvOp:move, src:operand, dst:operand}
571 | LEAL of {r32:CellsBasis.cell, addr:operand}
572 | LEAQ of {r64:CellsBasis.cell, addr:operand}
573 | CMPQ of {lsrc:operand, rsrc:operand}
574 | CMPL of {lsrc:operand, rsrc:operand}
575 | CMPW of {lsrc:operand, rsrc:operand}
576 | CMPB of {lsrc:operand, rsrc:operand}
577 | TESTQ of {lsrc:operand, rsrc:operand}
578 | TESTL of {lsrc:operand, rsrc:operand}
579 | TESTW of {lsrc:operand, rsrc:operand}
580 | TESTB of {lsrc:operand, rsrc:operand}
581 | BITOP of {bitOp:bitOp, lsrc:operand, rsrc:operand}
582 | BINARY of {binOp:binaryOp, src:operand, dst:operand}
583 | SHIFT of {shiftOp:shiftOp, src:operand, dst:operand, count:operand}
584 | MULTDIV of {multDivOp:multDivOp, src:operand}
585 | MUL3 of {dst:CellsBasis.cell, src2:Int32.int, src1:operand}
586 | MULQ3 of {dst:CellsBasis.cell, src2:Int32.int, src1:operand}
587 | UNARY of {unOp:unaryOp, opnd:operand}
588 | SET of {cond:cond, opnd:operand}
589 | CMOV of {cond:cond, src:operand, dst:CellsBasis.cell}
590 | PUSH of operand
591 | PUSHFQ
592 | POPFQ
593 | POP of operand
594 | CDQ
595 | CDO
596 | INT of byte
597 | FMOVE of {fmvOp:fmove_op, dst:operand, src:operand}
598 | FBINOP of {binOp:fbin_op, dst:CellsBasis.cell, src:operand}
599 | FCOM of {comOp:fcom_op, dst:CellsBasis.cell, src:operand}
600 | FSQRTS of {dst:operand, src:operand}
601 | FSQRTD of {dst:operand, src:operand}
602 | SAHF
603 | LFENCE
604 | MFENCE
605 | SFENCE
606 | PAUSE
607 | XCHG of {lock:bool, sz:isize, src:operand, dst:operand}
608 | CMPXCHG of {lock:bool, sz:isize, src:operand, dst:operand}
609 | XADD of {lock:bool, sz:isize, src:operand, dst:operand}
610 | RDTSC
611 | RDTSCP
612 | LAHF
613 | SOURCE of {}
614 | SINK of {}
615 | PHI of {}
616 and instruction =
617 LIVE of {regs: C.cellset, spilled: C.cellset}
618 | KILL of {regs: C.cellset, spilled: C.cellset}
619 | COPY of {k: CellsBasis.cellkind,
620 sz: int, (* in bits *)
621 dst: CellsBasis.cell list,
622 src: CellsBasis.cell list,
623 tmp: ea option (* NONE if |dst| = {src| = 1 *)}
624 | ANNOTATION of {i:instruction, a:Annotations.annotation}
625 | INSTR of instr
626 val nop = INSTR NOP
627 and jmp = INSTR o JMP
628 and jcc = INSTR o JCC
629 and call = INSTR o CALL
630 and enter = INSTR o ENTER
631 and leave = INSTR LEAVE
632 and ret = INSTR o RET
633 and move = INSTR o MOVE
634 and leal = INSTR o LEAL
635 and leaq = INSTR o LEAQ
636 and cmpq = INSTR o CMPQ
637 and cmpl = INSTR o CMPL
638 and cmpw = INSTR o CMPW
639 and cmpb = INSTR o CMPB
640 and testq = INSTR o TESTQ
641 and testl = INSTR o TESTL
642 and testw = INSTR o TESTW
643 and testb = INSTR o TESTB
644 and bitop = INSTR o BITOP
645 and binary = INSTR o BINARY
646 and shift = INSTR o SHIFT
647 and multdiv = INSTR o MULTDIV
648 and mul3 = INSTR o MUL3
649 and mulq3 = INSTR o MULQ3
650 and unary = INSTR o UNARY
651 and set = INSTR o SET
652 and cmov = INSTR o CMOV
653 and push = INSTR o PUSH
654 and pushfq = INSTR PUSHFQ
655 and popfq = INSTR POPFQ
656 and pop = INSTR o POP
657 and cdq = INSTR CDQ
658 and cdo = INSTR CDO
659 and int = INSTR o INT
660 and fmove = INSTR o FMOVE
661 and fbinop = INSTR o FBINOP
662 and fcom = INSTR o FCOM
663 and fsqrts = INSTR o FSQRTS
664 and fsqrtd = INSTR o FSQRTD
665 and sahf = INSTR SAHF
666 and lfence = INSTR LFENCE
667 and mfence = INSTR MFENCE
668 and sfence = INSTR SFENCE
669 and pause = INSTR PAUSE
670 and xchg = INSTR o XCHG
671 and cmpxchg = INSTR o CMPXCHG
672 and xadd = INSTR o XADD
673 and rdtsc = INSTR RDTSC
674 and rdtscp = INSTR RDTSCP
675 and lahf = INSTR LAHF
676 and source = INSTR o SOURCE
677 and sink = INSTR o SINK
678 and phi = INSTR o PHI
679 end
680