Cosmetic, bringing i386 and amd64 versions of emit.mlp closer to each other.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/abstract_intel_emit@15326 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
79ee71e8ca
commit
7dea33dc40
|
@ -45,20 +45,16 @@ let register_name r =
|
|||
(* CFI directives *)
|
||||
|
||||
let cfi_startproc () =
|
||||
if Config.asm_cfi_supported then
|
||||
_cfi_startproc ()
|
||||
if Config.asm_cfi_supported then _cfi_startproc ()
|
||||
|
||||
let cfi_endproc () =
|
||||
if Config.asm_cfi_supported then
|
||||
_cfi_endproc ()
|
||||
if Config.asm_cfi_supported then _cfi_endproc ()
|
||||
|
||||
let cfi_adjust_cfa_offset n =
|
||||
if Config.asm_cfi_supported then
|
||||
_cfi_adjust_cfa_offset n
|
||||
if Config.asm_cfi_supported then _cfi_adjust_cfa_offset n
|
||||
|
||||
let emit_debug_info dbg =
|
||||
if system <> S_win64 then
|
||||
emit_debug_info_gen dbg _file _loc
|
||||
emit_debug_info_gen dbg _file _loc
|
||||
|
||||
let fp = Config.with_frame_pointers
|
||||
|
||||
|
@ -145,13 +141,11 @@ let emit_data_label lbl =
|
|||
|
||||
let label s = sym (emit_label s)
|
||||
|
||||
let def_label s = directive (NewLabel (emit_label s, NO))
|
||||
|
||||
(* Output a .align directive. *)
|
||||
let def_label s = _llabel (emit_label s)
|
||||
|
||||
let emit_Llabel fallthrough lbl =
|
||||
if not fallthrough && !fastcode_flag then _align 4;
|
||||
emit_label lbl
|
||||
def_label lbl
|
||||
|
||||
(* Output a pseudo-register *)
|
||||
|
||||
|
@ -651,7 +645,7 @@ let emit_instr fallthrough i =
|
|||
I.ret ()
|
||||
end
|
||||
| Llabel lbl ->
|
||||
_llabel (emit_Llabel fallthrough lbl)
|
||||
emit_Llabel fallthrough lbl
|
||||
| Lbranch lbl ->
|
||||
I.jmp (label lbl)
|
||||
| Lcondbranch(tst, lbl) ->
|
||||
|
@ -819,21 +813,21 @@ let fundecl fundecl =
|
|||
List.iter emit_call_gc !call_gc_sites;
|
||||
emit_call_bound_errors ();
|
||||
cfi_endproc ();
|
||||
if system = S_gnu || system = S_linux then begin
|
||||
_type (emit_symbol fundecl.fun_name) "@function";
|
||||
_size (emit_symbol fundecl.fun_name)
|
||||
(ConstSub (
|
||||
ConstThis,
|
||||
ConstLabel (emit_symbol fundecl.fun_name)))
|
||||
begin match system with
|
||||
| S_gnu | S_linux ->
|
||||
_type (emit_symbol fundecl.fun_name) "@function";
|
||||
_size (emit_symbol fundecl.fun_name)
|
||||
(ConstSub (
|
||||
ConstThis,
|
||||
ConstLabel (emit_symbol fundecl.fun_name)))
|
||||
| _ -> ()
|
||||
end
|
||||
|
||||
(* Emission of data *)
|
||||
|
||||
let emit_item = function
|
||||
| Cglobal_symbol s -> _global (emit_symbol s)
|
||||
| Cdefine_symbol s ->
|
||||
add_def_symbol s;
|
||||
_label (emit_symbol s)
|
||||
| Cdefine_symbol s -> add_def_symbol s; _label (emit_symbol s)
|
||||
| Cdefine_label lbl -> _label (emit_data_label lbl)
|
||||
| Cint8 n -> _byte (const n)
|
||||
| Cint16 n -> _word (const n)
|
||||
|
@ -841,14 +835,16 @@ let emit_item = function
|
|||
| Cint n -> _qword (const_nat n)
|
||||
| Csingle f -> _long (Const (Int64.of_int32 (Int32.bits_of_float f)))
|
||||
| Cdouble f -> _qword (Const (Int64.bits_of_float f))
|
||||
| Csymbol_address s ->
|
||||
add_used_symbol s;
|
||||
_qword (ConstLabel (emit_symbol s))
|
||||
| Csymbol_address s -> add_used_symbol s; _qword (ConstLabel (emit_symbol s))
|
||||
| Clabel_address lbl -> _qword (ConstLabel (emit_data_label lbl))
|
||||
| Cstring s -> _ascii s
|
||||
| Cskip n -> if n > 0 then _space n
|
||||
| Calign n -> _align n
|
||||
|
||||
let data l =
|
||||
_data ();
|
||||
List.iter emit_item l
|
||||
|
||||
(* Beginning / end of an assembly file *)
|
||||
|
||||
let begin_assembly() =
|
||||
|
@ -895,14 +891,9 @@ let begin_assembly() =
|
|||
|
||||
_text ();
|
||||
emit_global_label "code_begin";
|
||||
|
||||
if system = S_macosx then I.nop (); (* PR#4690 *)
|
||||
()
|
||||
|
||||
let data l =
|
||||
_data ();
|
||||
List.iter emit_item l
|
||||
|
||||
let end_assembly() =
|
||||
if !float_constants <> [] then begin
|
||||
begin match system with
|
||||
|
@ -915,7 +906,9 @@ let end_assembly() =
|
|||
end;
|
||||
|
||||
_text ();
|
||||
if system = S_macosx then I.nop (); (* suppress "ld warning: atom sorting error" *)
|
||||
if system = S_macosx then I.nop ();
|
||||
(* suppress "ld warning: atom sorting error" *)
|
||||
|
||||
emit_global_label "code_end";
|
||||
|
||||
_data ();
|
||||
|
@ -928,7 +921,7 @@ let end_assembly() =
|
|||
{ efa_label = (fun l -> _qword (ConstLabel (emit_label l)));
|
||||
efa_16 = (fun n -> _word (const n));
|
||||
efa_32 = (fun n -> _long (const_32 n));
|
||||
efa_word = (fun n -> _qword (Const (Int64.of_int n)));
|
||||
efa_word = (fun n -> _qword (const n));
|
||||
efa_align = _align;
|
||||
efa_label_rel =
|
||||
if system = S_macosx then begin
|
||||
|
|
|
@ -32,24 +32,17 @@ module I = Intel_dsl.INS32
|
|||
|
||||
(* CFI directives *)
|
||||
|
||||
let is_cfi_enabled () =
|
||||
Config.asm_cfi_supported
|
||||
|
||||
let cfi_startproc () =
|
||||
if is_cfi_enabled () then
|
||||
_cfi_startproc ()
|
||||
if Config.asm_cfi_supported then _cfi_startproc ()
|
||||
|
||||
let cfi_endproc () =
|
||||
if is_cfi_enabled () then
|
||||
_cfi_endproc ()
|
||||
if Config.asm_cfi_supported then _cfi_endproc ()
|
||||
|
||||
let cfi_adjust_cfa_offset n =
|
||||
if is_cfi_enabled () then
|
||||
_cfi_adjust_cfa_offset n
|
||||
if Config.asm_cfi_supported then _cfi_adjust_cfa_offset n
|
||||
|
||||
let emit_debug_info dbg =
|
||||
if system <> S_win32 then
|
||||
emit_debug_info_gen dbg _file _loc
|
||||
emit_debug_info_gen dbg _file _loc
|
||||
|
||||
(* Tradeoff between code size and code speed *)
|
||||
|
||||
|
@ -83,11 +76,8 @@ let slot_offset loc cl =
|
|||
let symbols_defined = ref StringSet.empty
|
||||
let symbols_used = ref StringSet.empty
|
||||
|
||||
let add_def_symbol s =
|
||||
symbols_defined := StringSet.add s !symbols_defined
|
||||
|
||||
let add_used_symbol s =
|
||||
symbols_used := StringSet.add s !symbols_used
|
||||
let add_def_symbol s = symbols_defined := StringSet.add s !symbols_defined
|
||||
let add_used_symbol s = symbols_used := StringSet.add s !symbols_used
|
||||
|
||||
let trap_frame_size = Misc.align 8 stack_alignment
|
||||
|
||||
|
@ -102,13 +92,11 @@ let symbol_prefix =
|
|||
| S_gnu -> ""
|
||||
| _ -> "_" (* win32 & others *)
|
||||
|
||||
let emit_symbol s =
|
||||
string_of_symbol symbol_prefix s
|
||||
let emit_symbol s = string_of_symbol symbol_prefix s
|
||||
|
||||
let immsym s = sym (emit_symbol s)
|
||||
|
||||
let emit_call s =
|
||||
I.call (immsym s)
|
||||
let emit_call s = I.call (immsym s)
|
||||
|
||||
(* Output a label *)
|
||||
|
||||
|
@ -129,18 +117,11 @@ let emit_data_label lbl =
|
|||
|
||||
let label s = sym (emit_label s)
|
||||
|
||||
let def_label s =
|
||||
directive (NewLabel (emit_label s, NO))
|
||||
|
||||
|
||||
(* MacOSX has its own way to reference symbols potentially defined in
|
||||
shared objects *)
|
||||
|
||||
let def_label s = _llabel (emit_label s)
|
||||
|
||||
let emit_Llabel fallthrough lbl =
|
||||
if not fallthrough && !fastcode_flag then
|
||||
_align 16 ;
|
||||
_llabel (emit_label lbl)
|
||||
if not fallthrough && !fastcode_flag then _align 16 ;
|
||||
def_label lbl
|
||||
|
||||
(* Output a pseudo-register *)
|
||||
|
||||
|
@ -152,8 +133,7 @@ let register_name r =
|
|||
if r < 100 then Reg32 (int_reg_name.(r))
|
||||
else Regf (float_reg_name.(r - 100))
|
||||
|
||||
let sym32 ?ofs s =
|
||||
mem_sym ?ofs DWORD (emit_symbol s)
|
||||
let sym32 ?ofs s = mem_sym ?ofs DWORD (emit_symbol s)
|
||||
|
||||
let reg = function
|
||||
| { loc = Reg r } -> register_name r
|
||||
|
@ -469,13 +449,19 @@ let emit_float64_split_directive x =
|
|||
let lo = Int64.logand x 0xFFFF_FFFFL
|
||||
and hi = Int64.shift_right_logical x 32 in
|
||||
_long (Const (if Arch.big_endian then hi else lo));
|
||||
_long (Const (if Arch.big_endian then lo else hi));
|
||||
()
|
||||
_long (Const (if Arch.big_endian then lo else hi))
|
||||
|
||||
let emit_float_constant cst lbl =
|
||||
_label (emit_label lbl);
|
||||
emit_float64_split_directive cst
|
||||
|
||||
let emit_global_label s =
|
||||
let lbl = Compilenv.make_symbol (Some s) in
|
||||
add_def_symbol lbl;
|
||||
let lbl = emit_symbol lbl in
|
||||
_global lbl;
|
||||
_label lbl
|
||||
|
||||
(* Output the assembly code for an instruction *)
|
||||
|
||||
(* Name of current function *)
|
||||
|
@ -973,18 +959,17 @@ let fundecl fundecl =
|
|||
cfi_startproc ();
|
||||
if !Clflags.gprofile then emit_profile();
|
||||
let n = frame_size() - 4 in
|
||||
if n > 0 then
|
||||
begin
|
||||
I.subl (int n, esp);
|
||||
cfi_adjust_cfa_offset n;
|
||||
end;
|
||||
if n > 0 then begin
|
||||
I.subl (int n, esp);
|
||||
cfi_adjust_cfa_offset n;
|
||||
end;
|
||||
def_label !tailrec_entry_point;
|
||||
emit_all true fundecl.fun_body;
|
||||
List.iter emit_call_gc !call_gc_sites;
|
||||
emit_call_bound_errors ();
|
||||
cfi_endproc ();
|
||||
begin match system with
|
||||
S_linux_elf | S_bsd_elf | S_gnu ->
|
||||
| S_linux_elf | S_bsd_elf | S_gnu ->
|
||||
_type (emit_symbol fundecl.fun_name) "@function";
|
||||
_size (emit_symbol fundecl.fun_name)
|
||||
(ConstSub (
|
||||
|
@ -997,28 +982,20 @@ let fundecl fundecl =
|
|||
(* Emission of data *)
|
||||
|
||||
let emit_item = function
|
||||
Cglobal_symbol s -> _global (emit_symbol s)
|
||||
| Cdefine_symbol s ->
|
||||
add_def_symbol s;
|
||||
_label (emit_symbol s)
|
||||
| Cglobal_symbol s -> _global (emit_symbol s)
|
||||
| Cdefine_symbol s -> add_def_symbol s; _label (emit_symbol s)
|
||||
| Cdefine_label lbl -> _label (emit_data_label lbl)
|
||||
| Cint8 n -> _byte (const n)
|
||||
| Cint16 n -> _word (const n)
|
||||
| Cint32 n -> _long (const_nat n)
|
||||
| Cint n -> _long (const_nat n)
|
||||
| Csingle f ->
|
||||
_long (Const (Int64.of_int32 (Int32.bits_of_float f)))
|
||||
| Cdouble f ->
|
||||
emit_float64_split_directive (Int64.bits_of_float f)
|
||||
| Csymbol_address s ->
|
||||
add_used_symbol s;
|
||||
_long (ConstLabel (emit_symbol s))
|
||||
| Csingle f -> _long (Const (Int64.of_int32 (Int32.bits_of_float f)))
|
||||
| Cdouble f -> emit_float64_split_directive (Int64.bits_of_float f)
|
||||
| Csymbol_address s -> add_used_symbol s; _long (ConstLabel (emit_symbol s))
|
||||
| Clabel_address lbl -> _long (ConstLabel (emit_data_label lbl))
|
||||
| Cstring s -> _ascii s
|
||||
| Cskip n ->
|
||||
if n > 0 then _space n
|
||||
| Calign n ->
|
||||
_align n
|
||||
| Cskip n -> if n > 0 then _space n
|
||||
| Calign n -> _align n
|
||||
|
||||
let data l =
|
||||
_data ();
|
||||
|
@ -1047,40 +1024,33 @@ let begin_assembly() =
|
|||
_extrn "_caml_raise_exn" PROC;
|
||||
_extrn "_caml_reraise_exn" PROC;
|
||||
end;
|
||||
let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
|
||||
add_def_symbol lbl_begin;
|
||||
|
||||
_data ();
|
||||
_global (emit_symbol lbl_begin);
|
||||
_label (emit_symbol lbl_begin);
|
||||
let lbl_begin = Compilenv.make_symbol (Some "code_begin") in
|
||||
add_def_symbol lbl_begin;
|
||||
emit_global_label "data_begin";
|
||||
|
||||
_text ();
|
||||
_global (emit_symbol lbl_begin);
|
||||
_label (emit_symbol lbl_begin);
|
||||
if system = S_macosx then I.nop () (* PR#4690 *)
|
||||
emit_global_label "code_begin";
|
||||
if system = S_macosx then I.nop (); (* PR#4690 *)
|
||||
()
|
||||
|
||||
let end_assembly() =
|
||||
if !float_constants <> [] then begin
|
||||
_data ();
|
||||
List.iter (fun (cst,lbl) -> emit_float_constant cst lbl) !float_constants
|
||||
end;
|
||||
let lbl_end = Compilenv.make_symbol (Some "code_end") in
|
||||
add_def_symbol lbl_end;
|
||||
|
||||
_text ();
|
||||
if system = S_macosx then
|
||||
I.nop (); (* suppress "ld warning: atom sorting error" *)
|
||||
_global (emit_symbol lbl_end);
|
||||
_label (emit_symbol lbl_end);
|
||||
if system = S_macosx then I.nop ();
|
||||
(* suppress "ld warning: atom sorting error" *)
|
||||
|
||||
emit_global_label "code_end";
|
||||
|
||||
_data ();
|
||||
let lbl_end = Compilenv.make_symbol (Some "data_end") in
|
||||
add_def_symbol lbl_end;
|
||||
_global (emit_symbol lbl_end);
|
||||
_label (emit_symbol lbl_end);
|
||||
emit_global_label "data_end";
|
||||
_long (const 0);
|
||||
let lbl = Compilenv.make_symbol (Some "frametable") in
|
||||
add_def_symbol lbl;
|
||||
_global (emit_symbol lbl);
|
||||
_label (emit_symbol lbl);
|
||||
|
||||
emit_global_label "frametable";
|
||||
|
||||
emit_frames
|
||||
{ efa_label = (fun l -> _long (ConstLabel (emit_label l)));
|
||||
efa_16 = (fun n -> _word (const n));
|
||||
|
@ -1093,10 +1063,9 @@ let end_assembly() =
|
|||
ConstThis),
|
||||
const_32 ofs)));
|
||||
efa_def_label = (fun l -> _label (emit_label l));
|
||||
efa_string = (fun s ->
|
||||
let s = s ^ "\000" in
|
||||
_ascii s
|
||||
) };
|
||||
efa_string = (fun s -> _ascii (s ^ "\000"))
|
||||
};
|
||||
|
||||
if system = S_macosx then emit_external_symbols ();
|
||||
if system = S_linux_elf then
|
||||
(* Mark stack as non-executable, PR#4564 *)
|
||||
|
@ -1111,9 +1080,10 @@ let end_assembly() =
|
|||
!symbols_used;
|
||||
symbols_used := StringSet.empty;
|
||||
symbols_defined := StringSet.empty;
|
||||
_end ();
|
||||
end;
|
||||
|
||||
_end ();
|
||||
|
||||
let asm =
|
||||
if !Emitaux.create_asm_file then
|
||||
Some
|
||||
|
|
|
@ -50,7 +50,7 @@ let print_reg b f r =
|
|||
Buffer.add_char b '%';
|
||||
Buffer.add_string b (f r)
|
||||
|
||||
let bprint_arg_mem b string_of_register {typ=_; idx; scale; base; sym; displ} =
|
||||
let arg_mem b string_of_register {typ=_; idx; scale; base; sym; displ} =
|
||||
begin match sym with
|
||||
| None ->
|
||||
if displ <> 0 || scale = 0 then
|
||||
|
@ -73,7 +73,7 @@ let bprint_arg_mem b string_of_register {typ=_; idx; scale; base; sym; displ} =
|
|||
Buffer.add_char b ')'
|
||||
end
|
||||
|
||||
let bprint_arg b = function
|
||||
let arg b = function
|
||||
| Sym x -> Buffer.add_char b '$'; Buffer.add_string b x
|
||||
| Imm x -> bprintf b "$%Ld" x
|
||||
| Reg8 x -> print_reg b string_of_register8 x
|
||||
|
@ -81,8 +81,8 @@ let bprint_arg b = function
|
|||
| Reg32 x -> print_reg b string_of_register32 x
|
||||
| Reg64 x -> print_reg b string_of_register64 x
|
||||
| Regf x -> print_reg b string_of_registerf x
|
||||
| Mem32 addr -> bprint_arg_mem b string_of_register32 addr
|
||||
| Mem64 addr -> bprint_arg_mem b string_of_register64 addr
|
||||
| Mem32 addr -> arg_mem b string_of_register32 addr
|
||||
| Mem64 addr -> arg_mem b string_of_register64 addr
|
||||
|
||||
let rec cst b = function
|
||||
| ConstLabel _ | Const _ | ConstThis as c -> scst b c
|
||||
|
@ -98,7 +98,7 @@ and scst b = function
|
|||
| ConstAdd (c1, c2) -> bprintf b "(%a + %a)" scst c1 scst c2
|
||||
| ConstSub (c1, c2) -> bprintf b "(%a - %a)" scst c1 scst c2
|
||||
|
||||
let suffix = function
|
||||
let suf = function
|
||||
| Mem32 {typ=BYTE; _} | Mem64 {typ=BYTE; _} | Reg8 _ -> "b"
|
||||
| Mem32 {typ=WORD; _} | Mem64 {typ=WORD; _} | Reg16 _ -> "w"
|
||||
| Mem32 {typ=DWORD; _} | Mem64 {typ=DWORD; _} | Reg32 _
|
||||
|
@ -108,38 +108,22 @@ let suffix = function
|
|||
| Mem32 {typ=NO; _} | Mem64 {typ=NO; _} -> assert false
|
||||
| _ -> ""
|
||||
|
||||
let i0 b s =
|
||||
bprintf b "\t%s" s
|
||||
|
||||
let i1 b s x =
|
||||
bprintf b "\t%s\t%a" s bprint_arg x
|
||||
|
||||
(* Automatically add suffix derived from argument *)
|
||||
let i1_s b s x =
|
||||
bprintf b "\t%s%s\t%a" s (suffix x) bprint_arg x
|
||||
|
||||
let i2 b s x y =
|
||||
bprintf b "\t%s\t%a, %a" s bprint_arg x bprint_arg y
|
||||
|
||||
(* Automatically add suffix derived from second argument *)
|
||||
let i2_s b s x y =
|
||||
bprintf b "\t%s%s\t%a, %a" s (suffix y) bprint_arg x bprint_arg y
|
||||
|
||||
(* Automatically add suffixes derived from first and second argument *)
|
||||
let i2_ss b s x y =
|
||||
bprintf b "\t%s%s%s\t%a, %a" s (suffix x) (suffix y) bprint_arg x bprint_arg y
|
||||
let i0 b s = bprintf b "\t%s" s
|
||||
let i1 b s x = bprintf b "\t%s\t%a" s arg x
|
||||
let i1_s b s x = bprintf b "\t%s%s\t%a" s (suf x) arg x
|
||||
let i2 b s x y = bprintf b "\t%s\t%a, %a" s arg x arg y
|
||||
let i2_s b s x y = bprintf b "\t%s%s\t%a, %a" s (suf y) arg x arg y
|
||||
let i2_ss b s x y = bprintf b "\t%s%s%s\t%a, %a" s (suf x) (suf y) arg x arg y
|
||||
|
||||
let i1_call_jmp b s = function
|
||||
(* this is the encoding of jump labels: don't use * *)
|
||||
| Mem64 {idx=RIP; scale=1; base=None; sym=Some _; _}
|
||||
| Mem32 {idx=_; scale=0; base=None; sym=Some _; _} (*used?*) as x ->
|
||||
i1 b s x
|
||||
| Reg32 _ | Reg64 _ | Mem32 _ | Mem64 _ as x ->
|
||||
bprintf b "\t%s\t*%a" s bprint_arg x
|
||||
| Reg32 _ | Reg64 _ | Mem32 _ | Mem64 _ as x -> bprintf b "\t%s\t*%a" s arg x
|
||||
| Sym x -> bprintf b "\t%s\t%s" s x
|
||||
| _ -> assert false
|
||||
|
||||
|
||||
let print_instr b = function
|
||||
| ADD (arg1, arg2) -> i2_s b "add" arg1 arg2
|
||||
| ADDSD (arg1, arg2) -> i2 b "addsd" arg1 arg2
|
||||
|
@ -154,7 +138,7 @@ let print_instr b = function
|
|||
| CQTO -> i0 b "cqto"
|
||||
| CVTSD2SI (arg1, arg2) -> i2 b "cvtsd2si" arg1 arg2
|
||||
| CVTSD2SS (arg1, arg2) -> i2 b "cvtsd2ss" arg1 arg2
|
||||
| CVTSI2SD (arg1, arg2) -> i2 b ("cvtsi2sd" ^ suffix arg1) arg1 arg2
|
||||
| CVTSI2SD (arg1, arg2) -> i2 b ("cvtsi2sd" ^ suf arg1) arg1 arg2
|
||||
| CVTSS2SD (arg1, arg2) -> i2 b "cvtss2sd" arg1 arg2
|
||||
| CVTTSD2SI (arg1, arg2) -> i2_s b "cvttsd2si" arg1 arg2
|
||||
| DEC arg -> i1_s b "dec" arg
|
||||
|
|
|
@ -46,7 +46,7 @@ let string_of_datatype_ptr = function
|
|||
| NEAR -> "NEAR PTR "
|
||||
| PROC -> "PROC PTR "
|
||||
|
||||
let bprint_arg_mem b string_of_register {typ; idx; scale; base; sym; displ} =
|
||||
let arg_mem b string_of_register {typ; idx; scale; base; sym; displ} =
|
||||
Buffer.add_string b (string_of_datatype_ptr typ);
|
||||
Buffer.add_char b '[';
|
||||
begin match sym with
|
||||
|
@ -70,7 +70,7 @@ let bprint_arg_mem b string_of_register {typ; idx; scale; base; sym; displ} =
|
|||
end;
|
||||
Buffer.add_char b ']'
|
||||
|
||||
let bprint_arg b = function
|
||||
let arg b = function
|
||||
| Sym s -> bprintf b "OFFSET %s" s
|
||||
| Imm n when n <= 0x7FFF_FFFFL && n >= -0x8000_0000L -> bprintf b "%Ld" n
|
||||
| Imm int -> bprintf b "0%LxH" int (* force ml64 to use mov reg, imm64 *)
|
||||
|
@ -87,8 +87,8 @@ let bprint_arg b = function
|
|||
bprintf b "%s%s" (string_of_datatype_ptr typ) s;
|
||||
if displ > 0 then bprintf b "+%d" displ
|
||||
else if displ < 0 then bprintf b "%d" displ
|
||||
| Mem32 addr -> bprint_arg_mem b string_of_register32 addr
|
||||
| Mem64 addr -> bprint_arg_mem b string_of_register64 addr
|
||||
| Mem32 addr -> arg_mem b string_of_register32 addr
|
||||
| Mem64 addr -> arg_mem b string_of_register64 addr
|
||||
|
||||
|
||||
let rec cst b = function
|
||||
|
@ -121,14 +121,9 @@ let buf_bytes_directive b directive s =
|
|||
if !pos >= 16 then begin pos := 0 end
|
||||
done
|
||||
|
||||
let i0 b s =
|
||||
bprintf b "\t%s" s
|
||||
|
||||
let i1 b s x =
|
||||
bprintf b "\t%s\t%a" s bprint_arg x
|
||||
|
||||
let i2 b s x y =
|
||||
bprintf b "\t%s\t%a, %a" s bprint_arg y bprint_arg x
|
||||
let i0 b s = bprintf b "\t%s" s
|
||||
let i1 b s x = bprintf b "\t%s\t%a" s arg x
|
||||
let i2 b s x y = bprintf b "\t%s\t%a, %a" s arg y arg x
|
||||
|
||||
let i1_call_jmp b s = function
|
||||
| Sym x -> bprintf b "\t%s\t%s" s x
|
||||
|
|
Loading…
Reference in New Issue