Skip to content

Commit 774fb13

Browse files
committed
try fix maco error
1 parent 4e9b1da commit 774fb13

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/X86_64.ml

+21-12
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,15 @@ let in_memory = function M _ | S _ | I _ -> true | C _ | R _ | L _ -> false
261261

262262
let mov x s =
263263
(* Numeric literals with more than 32 bits cannot be directly moved to memory location *)
264-
let big_numeric_literal = function L num -> (num > 0xFFFFFFFF || num < -0xFFFFFFFF) | _ -> false in
264+
let big_numeric_literal = function
265+
| L num -> num > 0xFFFFFFFF || num < -0xFFFFFFFF
266+
| _ -> false
267+
in
265268
if x = s then []
266-
else if (in_memory x && in_memory s) || (big_numeric_literal x && (in_memory x || in_memory s)) then
267-
[ Mov (x, rax); Mov (rax, s) ]
269+
else if
270+
(in_memory x && in_memory s)
271+
|| (big_numeric_literal x && (in_memory x || in_memory s))
272+
then [ Mov (x, rax); Mov (rax, s) ]
268273
else [ Mov (x, s) ]
269274

270275
(* Boxing for numeric values *)
@@ -697,7 +702,10 @@ let compile cmd env imports code =
697702
let l, env = env#allocate in
698703
let env, call = compile_call env ~fname:".string" 1 false in
699704
(env, mov addr l @ call)
700-
| LDA _ -> failwith "Should not happen. Indirect assignemts are temporarily prohibited."
705+
| LDA _ ->
706+
failwith
707+
"Should not happen. Indirect assignemts are temporarily \
708+
prohibited."
701709
(*
702710
let s, env' = (env#variable x)#allocate in
703711
let s', env'' = env'#allocate in
@@ -726,8 +734,11 @@ let compile cmd env imports code =
726734
| S _ | M _ -> [ Mov (s, rax); Mov (rax, env'#loc x) ]
727735
| _ -> [ Mov (s, env'#loc x) ] ))
728736
| STA -> compile_call env ~fname:".sta" 3 false
729-
| STI -> failwith "Should not happen. Indirect assignemts are temporarily prohibited."
730-
(*
737+
| STI ->
738+
failwith
739+
"Should not happen. Indirect assignemts are temporarily \
740+
prohibited."
741+
(*
731742
let v, env = env#pop in
732743
let x = env#peek in
733744
( env,
@@ -921,7 +932,7 @@ let compile cmd env imports code =
921932
]
922933
@ (if name = "main" then [ Binop ("^", rax, rax) ] else [])
923934
@ [
924-
Meta "\t.cfi_restore\t5";
935+
Meta "\t.cfi_restore\trbp";
925936
Meta "\t.cfi_def_cfa\t4, 4";
926937
Ret;
927938
Meta "\t.cfi_endproc";
@@ -995,11 +1006,9 @@ let compile cmd env imports code =
9951006
in
9961007
let _, env = env#pop in
9971008
( env,
998-
mov (L col) col_arg_addr
999-
@ mov (L line) line_arg_addr
1000-
@ mov msg_addr msg_arg_addr
1001-
@ mov value value_arg_addr
1002-
@ code )
1009+
mov (L col) col_arg_addr @ mov (L line) line_arg_addr
1010+
@ mov msg_addr msg_arg_addr @ mov value value_arg_addr @ code
1011+
)
10031012
| i ->
10041013
invalid_arg
10051014
(Printf.sprintf "invalid SM insn: %s\n" (GT.show insn i))

0 commit comments

Comments
 (0)