Skip to content

Commit 452390e

Browse files
committed
Follow-up to commit 14673: MASM has its own syntax for hex constants
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14683 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1 parent 0cba565 commit 452390e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

asmcomp/amd64/emit_nt.mlp

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ let slot_offset loc cl =
5353
else !stack_offset + (num_stack_slots.(0) + n) * 8
5454
| Outgoing n -> n
5555

56-
(* Output a 32 bit integer in hex *)
56+
(* Output a 32 or 64 bit integer in hex *)
5757

5858
let emit_int32 n = emit_printf "0%lxh" n
59+
let emit_int64 n = emit_printf "0%Lxh" n
5960

6061
(* Symbols *)
6162

@@ -334,8 +335,7 @@ let add_float_constant cst =
334335
lbl
335336

336337
let emit_float_constant (cst, lbl) =
337-
`{emit_label lbl}:`;
338-
emit_float64_directive "QWORD" cst
338+
`{emit_label lbl}: QWORD {emit_int64 cst}\n`
339339

340340
let emit_movabs reg n =
341341
(* force ml64 to use mov reg, imm64 instruction *)
@@ -706,9 +706,9 @@ let emit_item = function
706706
| Cint n ->
707707
` QWORD {emit_nativeint n}\n`
708708
| Csingle f ->
709-
emit_float32_directive "DWORD" (Int32.bits_of_float f)
709+
` DWORD {emit_int32 (Int32.bits_of_float f)}\n`
710710
| Cdouble f ->
711-
emit_float64_directive "QWORD" (Int64.bits_of_float f)
711+
` QWORD {emit_int64 (Int64.bits_of_float f)}\n`
712712
| Csymbol_address s ->
713713
add_used_symbol s;
714714
` QWORD {emit_symbol s}\n`

asmcomp/i386/emit_nt.mlp

+6-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ let add_used_symbol s =
6262
let emit_symbol s =
6363
emit_string "_"; Emitaux.emit_symbol '$' s
6464

65+
(* Output a 32 or 64 bit integer in hex *)
66+
6567
let emit_int32 n = emit_printf "0%lxh" n
68+
let emit_int64 n = emit_printf "0%Lxh" n
6669

6770
(* Output a label *)
6871

@@ -374,8 +377,7 @@ let add_float_constant cst =
374377
lbl
375378

376379
let emit_float_constant (cst, lbl) =
377-
`{emit_label lbl}:`;
378-
emit_float64_directive "QWORD" cst
380+
`{emit_label lbl}: QWORD {emit_int64 cst}\n`
379381

380382
(* Output the assembly code for an instruction *)
381383

@@ -801,9 +803,9 @@ let emit_item = function
801803
| Cint32 n ->
802804
` DWORD {emit_nativeint n}\n`
803805
| Csingle f ->
804-
emit_float32_directive "DWORD" (Int32.bits_of_float f)
806+
` DWORD {emit_int32 (Int32.bits_of_float f)}\n`
805807
| Cdouble f ->
806-
emit_float64_directive "QWORD" (Int64.bits_of_float f)
808+
` QWORD {emit_int64 (Int64.bits_of_float f)}\n`
807809
| Csymbol_address s ->
808810
add_used_symbol s ;
809811
` DWORD {emit_symbol s}\n`

0 commit comments

Comments
 (0)