Debian Codegraph @

lib/mlrisc-lib/MLRISC/ppc/instructions/ppcInstr.sml

raw
1 (*
2 * WARNING: This file was automatically generated by MDLGen (v3.1)
3 * from the machine description file "ppc/ppc.mdl".
4 * DO NOT EDIT this file directly
5 *)
6
7
8 signature PPCINSTR =
9 sig
10 structure C : PPCCELLS
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 type gpr = int
27 type fpr = int
28 type ccr = int
29 type crf = int
30 datatype spr =
31 XER
32 | LR
33 | CTR
34 datatype operand =
35 RegOp of CellsBasis.cell
36 | ImmedOp of int
37 | LabelOp of T.labexp
38 type addressing_mode = CellsBasis.cell * operand
39 datatype ea =
40 Direct of CellsBasis.cell
41 | FDirect of CellsBasis.cell
42 | Displace of {base:CellsBasis.cell, disp:T.labexp, mem:Region.region}
43 datatype load =
44 LBZ
45 | LBZE
46 | LHZ
47 | LHZE
48 | LHA
49 | LHAE
50 | LWZ
51 | LWZE
52 | LDE
53 | LBZU
54 | LHZU
55 | LHAU
56 | LWZU
57 | LDZU
58 datatype store =
59 STB
60 | STBE
61 | STH
62 | STHE
63 | STW
64 | STWE
65 | STDE
66 | STBU
67 | STHU
68 | STWU
69 | STDU
70 datatype fload =
71 LFS
72 | LFSE
73 | LFD
74 | LFDE
75 | LFSU
76 | LFDU
77 datatype fstore =
78 STFS
79 | STFSE
80 | STFD
81 | STFDE
82 | STFSU
83 | STFDU
84 datatype cmp =
85 CMP
86 | CMPL
87 datatype fcmp =
88 FCMPO
89 | FCMPU
90 datatype unary =
91 NEG
92 | EXTSB
93 | EXTSH
94 | EXTSW
95 | CNTLZW
96 | CNTLZD
97 datatype funary =
98 FMR
99 | FNEG
100 | FABS
101 | FNABS
102 | FSQRT
103 | FSQRTS
104 | FRSP
105 | FCTIW
106 | FCTIWZ
107 | FCTID
108 | FCTIDZ
109 | FCFID
110 datatype farith =
111 FADD
112 | FSUB
113 | FMUL
114 | FDIV
115 | FADDS
116 | FSUBS
117 | FMULS
118 | FDIVS
119 datatype farith3 =
120 FMADD
121 | FMADDS
122 | FMSUB
123 | FMSUBS
124 | FNMADD
125 | FNMADDS
126 | FNMSUB
127 | FNMSUBS
128 | FSEL
129 datatype bo =
130 TRUE
131 | FALSE
132 | ALWAYS
133 | COUNTER of {eqZero:bool, cond:bool option}
134 datatype arith =
135 ADD
136 | SUBF
137 | MULLW
138 | MULLD
139 | MULHW
140 | MULHWU
141 | DIVW
142 | DIVD
143 | DIVWU
144 | DIVDU
145 | AND
146 | OR
147 | XOR
148 | NAND
149 | NOR
150 | EQV
151 | ANDC
152 | ORC
153 | SLW
154 | SLD
155 | SRW
156 | SRD
157 | SRAW
158 | SRAD
159 datatype arithi =
160 ADDI
161 | ADDIS
162 | SUBFIC
163 | MULLI
164 | ANDI_Rc
165 | ANDIS_Rc
166 | ORI
167 | ORIS
168 | XORI
169 | XORIS
170 | SRAWI
171 | SRADI
172 datatype rotate =
173 RLWNM
174 | RLDCL
175 | RLDCR
176 datatype rotatei =
177 RLWINM
178 | RLWIMI
179 | RLDICL
180 | RLDICR
181 | RLDIC
182 | RLDIMI
183 datatype ccarith =
184 CRAND
185 | CROR
186 | CRXOR
187 | CRNAND
188 | CRNOR
189 | CREQV
190 | CRANDC
191 | CRORC
192 datatype bit =
193 LT
194 | GT
195 | EQ
196 | SO
197 | FL
198 | FG
199 | FE
200 | FU
201 | FX
202 | FEX
203 | VX
204 | OX
205 datatype xerbit =
206 SO64
207 | OV64
208 | CA64
209 | SO32
210 | OV32
211 | CA32
212 type cr_bit = (CellsBasis.cell) * bit
213 datatype instr =
214 L of {ld:load, rt:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region}
215 | LF of {ld:fload, ft:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region}
216 | ST of {st:store, rs:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region}
217 | STF of {st:fstore, fs:CellsBasis.cell, ra:CellsBasis.cell, d:operand,
218 mem:Region.region}
219 | UNARY of {oper:unary, rt:CellsBasis.cell, ra:CellsBasis.cell, Rc:bool,
220 OE:bool}
221 | ARITH of {oper:arith, rt:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell,
222 Rc:bool, OE:bool}
223 | ARITHI of {oper:arithi, rt:CellsBasis.cell, ra:CellsBasis.cell, im:operand}
224 | ROTATE of {oper:rotate, ra:CellsBasis.cell, rs:CellsBasis.cell, sh:CellsBasis.cell,
225 mb:int, me:int option}
226 | ROTATEI of {oper:rotatei, ra:CellsBasis.cell, rs:CellsBasis.cell, sh:operand,
227 mb:int, me:int option}
228 | COMPARE of {cmp:cmp, l:bool, bf:CellsBasis.cell, ra:CellsBasis.cell, rb:operand}
229 | FCOMPARE of {cmp:fcmp, bf:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell}
230 | FUNARY of {oper:funary, ft:CellsBasis.cell, fb:CellsBasis.cell, Rc:bool}
231 | FARITH of {oper:farith, ft:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell,
232 Rc:bool}
233 | FARITH3 of {oper:farith3, ft:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell,
234 fc:CellsBasis.cell, Rc:bool}
235 | CCARITH of {oper:ccarith, bt:cr_bit, ba:cr_bit, bb:cr_bit}
236 | MCRF of {bf:CellsBasis.cell, bfa:CellsBasis.cell}
237 | MTSPR of {rs:CellsBasis.cell, spr:CellsBasis.cell}
238 | MFSPR of {rt:CellsBasis.cell, spr:CellsBasis.cell}
239 | LWARX of {rt:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell}
240 | STWCX of {rs:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell}
241 | TW of {to:int, ra:CellsBasis.cell, si:operand}
242 | TD of {to:int, ra:CellsBasis.cell, si:operand}
243 | BC of {bo:bo, bf:CellsBasis.cell, bit:bit, addr:operand, LK:bool, fall:operand}
244 | BCLR of {bo:bo, bf:CellsBasis.cell, bit:bit, LK:bool, labels:Label.label list}
245 | B of {addr:operand, LK:bool}
246 | CALL of {def:C.cellset, use:C.cellset, cutsTo:Label.label list, mem:Region.region}
247 | SOURCE of {}
248 | SINK of {}
249 | PHI of {}
250 and instruction =
251 LIVE of {regs: C.cellset, spilled: C.cellset}
252 | KILL of {regs: C.cellset, spilled: C.cellset}
253 | COPY of {k: CellsBasis.cellkind,
254 sz: int, (* in bits *)
255 dst: CellsBasis.cell list,
256 src: CellsBasis.cell list,
257 tmp: ea option (* NONE if |dst| = {src| = 1 *)}
258 | ANNOTATION of {i:instruction, a:Annotations.annotation}
259 | INSTR of instr
260 val l : {ld:load, rt:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region} -> instruction
261 val lf : {ld:fload, ft:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region} -> instruction
262 val st : {st:store, rs:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region} -> instruction
263 val stf : {st:fstore, fs:CellsBasis.cell, ra:CellsBasis.cell, d:operand,
264 mem:Region.region} -> instruction
265 val unary : {oper:unary, rt:CellsBasis.cell, ra:CellsBasis.cell, Rc:bool,
266 OE:bool} -> instruction
267 val arith : {oper:arith, rt:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell,
268 Rc:bool, OE:bool} -> instruction
269 val arithi : {oper:arithi, rt:CellsBasis.cell, ra:CellsBasis.cell, im:operand} -> instruction
270 val rotate : {oper:rotate, ra:CellsBasis.cell, rs:CellsBasis.cell, sh:CellsBasis.cell,
271 mb:int, me:int option} -> instruction
272 val rotatei : {oper:rotatei, ra:CellsBasis.cell, rs:CellsBasis.cell, sh:operand,
273 mb:int, me:int option} -> instruction
274 val compare : {cmp:cmp, l:bool, bf:CellsBasis.cell, ra:CellsBasis.cell,
275 rb:operand} -> instruction
276 val fcompare : {cmp:fcmp, bf:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell} -> instruction
277 val funary : {oper:funary, ft:CellsBasis.cell, fb:CellsBasis.cell, Rc:bool} -> instruction
278 val farith : {oper:farith, ft:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell,
279 Rc:bool} -> instruction
280 val farith3 : {oper:farith3, ft:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell,
281 fc:CellsBasis.cell, Rc:bool} -> instruction
282 val ccarith : {oper:ccarith, bt:cr_bit, ba:cr_bit, bb:cr_bit} -> instruction
283 val mcrf : {bf:CellsBasis.cell, bfa:CellsBasis.cell} -> instruction
284 val mtspr : {rs:CellsBasis.cell, spr:CellsBasis.cell} -> instruction
285 val mfspr : {rt:CellsBasis.cell, spr:CellsBasis.cell} -> instruction
286 val lwarx : {rt:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell} -> instruction
287 val stwcx : {rs:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell} -> instruction
288 val tw : {to:int, ra:CellsBasis.cell, si:operand} -> instruction
289 val td : {to:int, ra:CellsBasis.cell, si:operand} -> instruction
290 val bc : {bo:bo, bf:CellsBasis.cell, bit:bit, addr:operand, LK:bool, fall:operand} -> instruction
291 val bclr : {bo:bo, bf:CellsBasis.cell, bit:bit, LK:bool, labels:Label.label list} -> instruction
292 val b : {addr:operand, LK:bool} -> instruction
293 val call : {def:C.cellset, use:C.cellset, cutsTo:Label.label list, mem:Region.region} -> instruction
294 val source : {} -> instruction
295 val sink : {} -> instruction
296 val phi : {} -> instruction
297 end
298
299 functor PPCInstr(T: MLTREE
300 ) : PPCINSTR =
301 struct
302 structure C = PPCCells
303 structure CB = CellsBasis
304 structure T = T
305 structure Region = T.Region
306 structure Constant = T.Constant
307 type gpr = int
308 type fpr = int
309 type ccr = int
310 type crf = int
311 datatype spr =
312 XER
313 | LR
314 | CTR
315 datatype operand =
316 RegOp of CellsBasis.cell
317 | ImmedOp of int
318 | LabelOp of T.labexp
319 type addressing_mode = CellsBasis.cell * operand
320 datatype ea =
321 Direct of CellsBasis.cell
322 | FDirect of CellsBasis.cell
323 | Displace of {base:CellsBasis.cell, disp:T.labexp, mem:Region.region}
324 datatype load =
325 LBZ
326 | LBZE
327 | LHZ
328 | LHZE
329 | LHA
330 | LHAE
331 | LWZ
332 | LWZE
333 | LDE
334 | LBZU
335 | LHZU
336 | LHAU
337 | LWZU
338 | LDZU
339 datatype store =
340 STB
341 | STBE
342 | STH
343 | STHE
344 | STW
345 | STWE
346 | STDE
347 | STBU
348 | STHU
349 | STWU
350 | STDU
351 datatype fload =
352 LFS
353 | LFSE
354 | LFD
355 | LFDE
356 | LFSU
357 | LFDU
358 datatype fstore =
359 STFS
360 | STFSE
361 | STFD
362 | STFDE
363 | STFSU
364 | STFDU
365 datatype cmp =
366 CMP
367 | CMPL
368 datatype fcmp =
369 FCMPO
370 | FCMPU
371 datatype unary =
372 NEG
373 | EXTSB
374 | EXTSH
375 | EXTSW
376 | CNTLZW
377 | CNTLZD
378 datatype funary =
379 FMR
380 | FNEG
381 | FABS
382 | FNABS
383 | FSQRT
384 | FSQRTS
385 | FRSP
386 | FCTIW
387 | FCTIWZ
388 | FCTID
389 | FCTIDZ
390 | FCFID
391 datatype farith =
392 FADD
393 | FSUB
394 | FMUL
395 | FDIV
396 | FADDS
397 | FSUBS
398 | FMULS
399 | FDIVS
400 datatype farith3 =
401 FMADD
402 | FMADDS
403 | FMSUB
404 | FMSUBS
405 | FNMADD
406 | FNMADDS
407 | FNMSUB
408 | FNMSUBS
409 | FSEL
410 datatype bo =
411 TRUE
412 | FALSE
413 | ALWAYS
414 | COUNTER of {eqZero:bool, cond:bool option}
415 datatype arith =
416 ADD
417 | SUBF
418 | MULLW
419 | MULLD
420 | MULHW
421 | MULHWU
422 | DIVW
423 | DIVD
424 | DIVWU
425 | DIVDU
426 | AND
427 | OR
428 | XOR
429 | NAND
430 | NOR
431 | EQV
432 | ANDC
433 | ORC
434 | SLW
435 | SLD
436 | SRW
437 | SRD
438 | SRAW
439 | SRAD
440 datatype arithi =
441 ADDI
442 | ADDIS
443 | SUBFIC
444 | MULLI
445 | ANDI_Rc
446 | ANDIS_Rc
447 | ORI
448 | ORIS
449 | XORI
450 | XORIS
451 | SRAWI
452 | SRADI
453 datatype rotate =
454 RLWNM
455 | RLDCL
456 | RLDCR
457 datatype rotatei =
458 RLWINM
459 | RLWIMI
460 | RLDICL
461 | RLDICR
462 | RLDIC
463 | RLDIMI
464 datatype ccarith =
465 CRAND
466 | CROR
467 | CRXOR
468 | CRNAND
469 | CRNOR
470 | CREQV
471 | CRANDC
472 | CRORC
473 datatype bit =
474 LT
475 | GT
476 | EQ
477 | SO
478 | FL
479 | FG
480 | FE
481 | FU
482 | FX
483 | FEX
484 | VX
485 | OX
486 datatype xerbit =
487 SO64
488 | OV64
489 | CA64
490 | SO32
491 | OV32
492 | CA32
493 type cr_bit = (CellsBasis.cell) * bit
494 datatype instr =
495 L of {ld:load, rt:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region}
496 | LF of {ld:fload, ft:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region}
497 | ST of {st:store, rs:CellsBasis.cell, ra:CellsBasis.cell, d:operand, mem:Region.region}
498 | STF of {st:fstore, fs:CellsBasis.cell, ra:CellsBasis.cell, d:operand,
499 mem:Region.region}
500 | UNARY of {oper:unary, rt:CellsBasis.cell, ra:CellsBasis.cell, Rc:bool,
501 OE:bool}
502 | ARITH of {oper:arith, rt:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell,
503 Rc:bool, OE:bool}
504 | ARITHI of {oper:arithi, rt:CellsBasis.cell, ra:CellsBasis.cell, im:operand}
505 | ROTATE of {oper:rotate, ra:CellsBasis.cell, rs:CellsBasis.cell, sh:CellsBasis.cell,
506 mb:int, me:int option}
507 | ROTATEI of {oper:rotatei, ra:CellsBasis.cell, rs:CellsBasis.cell, sh:operand,
508 mb:int, me:int option}
509 | COMPARE of {cmp:cmp, l:bool, bf:CellsBasis.cell, ra:CellsBasis.cell, rb:operand}
510 | FCOMPARE of {cmp:fcmp, bf:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell}
511 | FUNARY of {oper:funary, ft:CellsBasis.cell, fb:CellsBasis.cell, Rc:bool}
512 | FARITH of {oper:farith, ft:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell,
513 Rc:bool}
514 | FARITH3 of {oper:farith3, ft:CellsBasis.cell, fa:CellsBasis.cell, fb:CellsBasis.cell,
515 fc:CellsBasis.cell, Rc:bool}
516 | CCARITH of {oper:ccarith, bt:cr_bit, ba:cr_bit, bb:cr_bit}
517 | MCRF of {bf:CellsBasis.cell, bfa:CellsBasis.cell}
518 | MTSPR of {rs:CellsBasis.cell, spr:CellsBasis.cell}
519 | MFSPR of {rt:CellsBasis.cell, spr:CellsBasis.cell}
520 | LWARX of {rt:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell}
521 | STWCX of {rs:CellsBasis.cell, ra:CellsBasis.cell, rb:CellsBasis.cell}
522 | TW of {to:int, ra:CellsBasis.cell, si:operand}
523 | TD of {to:int, ra:CellsBasis.cell, si:operand}
524 | BC of {bo:bo, bf:CellsBasis.cell, bit:bit, addr:operand, LK:bool, fall:operand}
525 | BCLR of {bo:bo, bf:CellsBasis.cell, bit:bit, LK:bool, labels:Label.label list}
526 | B of {addr:operand, LK:bool}
527 | CALL of {def:C.cellset, use:C.cellset, cutsTo:Label.label list, mem:Region.region}
528 | SOURCE of {}
529 | SINK of {}
530 | PHI of {}
531 and instruction =
532 LIVE of {regs: C.cellset, spilled: C.cellset}
533 | KILL of {regs: C.cellset, spilled: C.cellset}
534 | COPY of {k: CellsBasis.cellkind,
535 sz: int, (* in bits *)
536 dst: CellsBasis.cell list,
537 src: CellsBasis.cell list,
538 tmp: ea option (* NONE if |dst| = {src| = 1 *)}
539 | ANNOTATION of {i:instruction, a:Annotations.annotation}
540 | INSTR of instr
541 val l = INSTR o L
542 and lf = INSTR o LF
543 and st = INSTR o ST
544 and stf = INSTR o STF
545 and unary = INSTR o UNARY
546 and arith = INSTR o ARITH
547 and arithi = INSTR o ARITHI
548 and rotate = INSTR o ROTATE
549 and rotatei = INSTR o ROTATEI
550 and compare = INSTR o COMPARE
551 and fcompare = INSTR o FCOMPARE
552 and funary = INSTR o FUNARY
553 and farith = INSTR o FARITH
554 and farith3 = INSTR o FARITH3
555 and ccarith = INSTR o CCARITH
556 and mcrf = INSTR o MCRF
557 and mtspr = INSTR o MTSPR
558 and mfspr = INSTR o MFSPR
559 and lwarx = INSTR o LWARX
560 and stwcx = INSTR o STWCX
561 and tw = INSTR o TW
562 and td = INSTR o TD
563 and bc = INSTR o BC
564 and bclr = INSTR o BCLR
565 and b = INSTR o B
566 and call = INSTR o CALL
567 and source = INSTR o SOURCE
568 and sink = INSTR o SINK
569 and phi = INSTR o PHI
570 end
571