Skip to content
Browse files

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
  • Loading branch information...
1 parent 0cba565 commit 452390e0eadaafe92ff9d2c9d008035dfdb878f9 @xavierleroy xavierleroy committed Apr 26, 2014
Showing with 11 additions and 9 deletions.
  1. +5 −5 asmcomp/amd64/emit_nt.mlp
  2. +6 −4 asmcomp/i386/emit_nt.mlp
View
10 asmcomp/amd64/emit_nt.mlp
@@ -53,9 +53,10 @@ let slot_offset loc cl =
else !stack_offset + (num_stack_slots.(0) + n) * 8
| Outgoing n -> n
-(* Output a 32 bit integer in hex *)
+(* Output a 32 or 64 bit integer in hex *)
let emit_int32 n = emit_printf "0%lxh" n
+let emit_int64 n = emit_printf "0%Lxh" n
(* Symbols *)
@@ -334,8 +335,7 @@ let add_float_constant cst =
lbl
let emit_float_constant (cst, lbl) =
- `{emit_label lbl}:`;
- emit_float64_directive "QWORD" cst
+ `{emit_label lbl}: QWORD {emit_int64 cst}\n`
let emit_movabs reg n =
(* force ml64 to use mov reg, imm64 instruction *)
@@ -706,9 +706,9 @@ let emit_item = function
| Cint n ->
` QWORD {emit_nativeint n}\n`
| Csingle f ->
- emit_float32_directive "DWORD" (Int32.bits_of_float f)
+ ` DWORD {emit_int32 (Int32.bits_of_float f)}\n`
| Cdouble f ->
- emit_float64_directive "QWORD" (Int64.bits_of_float f)
+ ` QWORD {emit_int64 (Int64.bits_of_float f)}\n`
| Csymbol_address s ->
add_used_symbol s;
` QWORD {emit_symbol s}\n`
View
10 asmcomp/i386/emit_nt.mlp
@@ -62,7 +62,10 @@ let add_used_symbol s =
let emit_symbol s =
emit_string "_"; Emitaux.emit_symbol '$' s
+(* Output a 32 or 64 bit integer in hex *)
+
let emit_int32 n = emit_printf "0%lxh" n
+let emit_int64 n = emit_printf "0%Lxh" n
(* Output a label *)
@@ -374,8 +377,7 @@ let add_float_constant cst =
lbl
let emit_float_constant (cst, lbl) =
- `{emit_label lbl}:`;
- emit_float64_directive "QWORD" cst
+ `{emit_label lbl}: QWORD {emit_int64 cst}\n`
(* Output the assembly code for an instruction *)
@@ -801,9 +803,9 @@ let emit_item = function
| Cint32 n ->
` DWORD {emit_nativeint n}\n`
| Csingle f ->
- emit_float32_directive "DWORD" (Int32.bits_of_float f)
+ ` DWORD {emit_int32 (Int32.bits_of_float f)}\n`
| Cdouble f ->
- emit_float64_directive "QWORD" (Int64.bits_of_float f)
+ ` QWORD {emit_int64 (Int64.bits_of_float f)}\n`
| Csymbol_address s ->
add_used_symbol s ;
` DWORD {emit_symbol s}\n`

0 comments on commit 452390e

Please sign in to comment.
Something went wrong with that request. Please try again.