fix fmt_instr
This commit is contained in:
parent
209d8382e2
commit
a923bdb6b9
1 changed files with 19 additions and 24 deletions
7
mips.ml
7
mips.ml
|
@ -113,11 +113,6 @@ let fmt_loc = function
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let fmt_instr = function
|
let fmt_instr = function
|
||||||
| Label _ -> ""
|
|
||||||
| _ as i ->
|
|
||||||
Printf.sprintf " "
|
|
||||||
^
|
|
||||||
(match i with
|
|
||||||
| Label l -> Printf.sprintf "%s:" l
|
| Label l -> Printf.sprintf "%s:" l
|
||||||
| Li (r, i) -> Printf.sprintf " li %s, %d" (fmt_reg r) i
|
| Li (r, i) -> Printf.sprintf " li %s, %d" (fmt_reg r) i
|
||||||
| La (r, a) -> Printf.sprintf " la %s, %s" (fmt_reg r) (fmt_loc a)
|
| La (r, a) -> Printf.sprintf " la %s, %s" (fmt_reg r) (fmt_loc a)
|
||||||
|
@ -136,7 +131,7 @@ let fmt_instr = function
|
||||||
| B l -> Printf.sprintf " b %s" l
|
| B l -> Printf.sprintf " b %s" l
|
||||||
| Beqz (r, l) -> Printf.sprintf " beqz %s, %s" (fmt_reg r) l
|
| Beqz (r, l) -> Printf.sprintf " beqz %s, %s" (fmt_reg r) l
|
||||||
| Jal l -> Printf.sprintf " jal %s" l
|
| Jal l -> Printf.sprintf " jal %s" l
|
||||||
| Jr r -> Printf.sprintf "jr %s" (fmt_reg r))
|
| Jr r -> Printf.sprintf " jr %s" (fmt_reg r)
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let fmt_dir = function
|
let fmt_dir = function
|
||||||
|
|
Reference in a new issue