blob: 551df62ecbcb337efb17c920184f97d217417c27 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
type register =
| ZERO | A0 | A1 | A2 | V0 | T0 | T1 | T2 | S0 | RA | SP | FP
type address =
| Alab of string
| Areg of int * register
type operand =
| Oimm of int
| Oreg of register
type arith = Add | Sub | Mul | Div | Rem
type condition = Eq | Ne | Le | Lt | Ge | Gt
type label = string
type instruction =
| Move of register * register
| Li of register * int
| Li32 of register * int32
| La of register * label
| Lw of register * address
| Sw of register * address
| Lb of register * address
| Sb of register * address
| Arith of arith * register * register * operand
| Neg of register * register
| Set of condition * register * register * operand
| B of label
| Beq of register * register * label
| Beqz of register * label
| Bnez of register * label
| J of string
| Jal of string
| Jr of register
| Jalr of register
| Syscall
| Label of string
| Inline of string
type code
val nop : code
val mips : instruction list -> code
val inline : string -> code
val (++) : code -> code -> code
type word = Wint of int | Waddr of string
type data =
| Asciiz of string * string
| Word of string * word list
| Space of string * int
| Align of int
type program = {
text : code;
data : data list;
}
val print_program : Format.formatter -> program -> unit
|