summaryrefslogtreecommitdiff
path: root/src/mips.mli
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2013-11-14 17:58:57 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2013-11-14 17:58:57 +0100
commit5dacc48b53568f673b03de794a9a13f7a5c11b0f (patch)
tree6040bbc45a0ee0ede2af63377c0df43920650b1a /src/mips.mli
parentd9fab442401005b49b9221b9d897501fef9a4d8d (diff)
downloadLPC-Projet-5dacc48b53568f673b03de794a9a13f7a5c11b0f.tar.gz
LPC-Projet-5dacc48b53568f673b03de794a9a13f7a5c11b0f.zip
Imported MIPS ASM definitions and more docs.
Diffstat (limited to 'src/mips.mli')
-rw-r--r--src/mips.mli64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/mips.mli b/src/mips.mli
new file mode 100644
index 0000000..551df62
--- /dev/null
+++ b/src/mips.mli
@@ -0,0 +1,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
+