diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2011-12-16 17:02:48 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2011-12-16 17:02:48 +0000 |
commit | e10723e701f219df799548e8b07025585eafbecf (patch) | |
tree | 3521e670f81318e8aa6a9263e0957700743a6c7b | |
parent | 7ff9d50434e589968380c988dded37cda384b96c (diff) | |
download | ocaml-e10723e701f219df799548e8b07025585eafbecf.tar.gz |
Merged proc_nt.ml into proc.ml in directories asmcomp/i386 and asmcomp/amd64.
This avoids much code duplication and is a baby step towards Mingw-64 bits
support (PR#5179). (There will be no need to create a third proc_xxx.ml
file for this configuration.)
Also, in amd64/emit_nt.mlp, the ml64 assembler didn't like my label subtractions, so I put the jumptable in code area instead of in data area.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11319 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | Makefile.nt | 6 | ||||
-rw-r--r-- | asmcomp/amd64/emit_nt.mlp | 4 | ||||
-rw-r--r-- | asmcomp/amd64/proc.ml | 145 | ||||
-rw-r--r-- | asmcomp/amd64/proc_nt.ml | 233 | ||||
-rw-r--r-- | asmcomp/i386/proc.ml | 25 | ||||
-rw-r--r-- | asmcomp/i386/proc_nt.ml | 186 | ||||
-rw-r--r-- | config/Makefile.mingw | 1 | ||||
-rw-r--r-- | config/Makefile.msvc | 1 | ||||
-rw-r--r-- | config/Makefile.msvc64 | 1 | ||||
-rw-r--r-- | utils/config.mli | 5 |
10 files changed, 148 insertions, 459 deletions
diff --git a/Makefile.nt b/Makefile.nt index 870374566f..69b8d6a4d6 100644 --- a/Makefile.nt +++ b/Makefile.nt @@ -432,15 +432,13 @@ partialclean:: beforedepend:: asmcomp/arch.ml ifeq ($(TOOLCHAIN),msvc) -ASMCOMP_PROC=asmcomp/$(ARCH)/proc_nt.ml ASMCOMP_EMIT=asmcomp/$(ARCH)/emit_nt.mlp else -ASMCOMP_PROC=asmcomp/$(ARCH)/proc.ml ASMCOMP_EMIT=asmcomp/$(ARCH)/emit.mlp endif -asmcomp/proc.ml: $(ASMCOMP_PROC) - cp $(ASMCOMP_PROC) asmcomp/proc.ml +asmcomp/proc.ml: asmcomp/$(ARCH)/proc.ml + cp asmcomp/$(ARCH)/proc.ml asmcomp/proc.ml partialclean:: rm -f asmcomp/proc.ml diff --git a/asmcomp/amd64/emit_nt.mlp b/asmcomp/amd64/emit_nt.mlp index e1f5410cb0..9a3274725c 100644 --- a/asmcomp/amd64/emit_nt.mlp +++ b/asmcomp/amd64/emit_nt.mlp @@ -604,13 +604,11 @@ let emit_instr fallthrough i = ` movsxd {emit_reg tmp2}, DWORD PTR [{emit_reg tmp1}+{emit_reg i.arg.(0)}*4]\n`; ` add {emit_reg tmp1}, {emit_reg tmp2}\n`; ` jmp {emit_reg tmp1}\n`; - ` .DATA\n`; emit_align 4; `{emit_label lbl} LABEL DWORD\n`; for i = 0 to Array.length jumptbl - 1 do ` DWORD {emit_label jumptbl.(i)} - {emit_label lbl}\n` - done; - ` .CODE\n` + done | Lsetuptrap lbl -> ` call {emit_label lbl}\n` | Lpushtrap -> diff --git a/asmcomp/amd64/proc.ml b/asmcomp/amd64/proc.ml index 864c22e185..fa0387bb6f 100644 --- a/asmcomp/amd64/proc.ml +++ b/asmcomp/amd64/proc.ml @@ -20,13 +20,27 @@ open Cmm open Reg open Mach +(* Which ABI to use *) + +let win64 = + match Config.system with + | "win64" | "mingw64" -> true + | _ -> false + +(* Which asm conventions to use *) + +let masm = + match Config.ccomp_type with + | "msvc" -> true + | _ -> false + (* Registers available for register allocation *) (* Register map: - rax 0 rax - r11: Caml function arguments - rbx 1 rdi - r9: C function arguments - rdi 2 rax: Caml and C function results - rsi 3 rbx, rbp, r12-r15 are preserved by C + rax 0 + rbx 1 + rdi 2 + rsi 3 rdx 4 rcx 5 r8 6 @@ -39,18 +53,44 @@ open Mach r14 trap pointer r15 allocation pointer - xmm0 - xmm15 100 - 115 xmm0 - xmm9: Caml function arguments - xmm0 - xmm7: C function arguments - xmm0: Caml and C function results *) + xmm0 - xmm15 100 - 115 *) + +(* Conventions: + rax - r11: Caml function arguments + rax: Caml and C function results + xmm0 - xmm9: Caml function arguments + xmm0: Caml and C function results + Under Unix: + rdi, rsi, rdx, rcx, r8, r9: C function arguments + xmm0 - xmm7: C function arguments + rbx, rbp, r12-r15 are preserved by C + xmm registers are not preserved by C + Under Win64: + rcx, rdx, r8, r9: C function arguments + xmm0 - xmm3: C function arguments + rbx, rbp, rsi, rdi r12-r15 are preserved by C + xmm6-xmm15 are preserved by C +*) let int_reg_name = - [| "%rax"; "%rbx"; "%rdi"; "%rsi"; "%rdx"; "%rcx"; "%r8"; "%r9"; - "%r10"; "%r11"; "%rbp"; "%r12"; "%r13" |] + match Config.ccomp_type with + | "msvc" -> + [| "rax"; "rbx"; "rdi"; "rsi"; "rdx"; "rcx"; "r8"; "r9"; + "r10"; "r11"; "rbp"; "r12"; "r13" |] + | _ -> + [| "%rax"; "%rbx"; "%rdi"; "%rsi"; "%rdx"; "%rcx"; "%r8"; "%r9"; + "%r10"; "%r11"; "%rbp"; "%r12"; "%r13" |] let float_reg_name = - [| "%xmm0"; "%xmm1"; "%xmm2"; "%xmm3"; "%xmm4"; "%xmm5"; "%xmm6"; "%xmm7"; - "%xmm8"; "%xmm9"; "%xmm10"; "%xmm11"; - "%xmm12"; "%xmm13"; "%xmm14"; "%xmm15" |] + match Config.ccomp_type with + | "msvc" -> + [| "xmm0"; "xmm1"; "xmm2"; "xmm3"; "xmm4"; "xmm5"; "xmm6"; "xmm7"; + "xmm8"; "xmm9"; "xmm10"; "xmm11"; + "xmm12"; "xmm13"; "xmm14"; "xmm15" |] + | _ -> + [| "%xmm0"; "%xmm1"; "%xmm2"; "%xmm3"; "%xmm4"; "%xmm5"; "%xmm6"; "%xmm7"; + "%xmm8"; "%xmm9"; "%xmm10"; "%xmm11"; + "%xmm12"; "%xmm13"; "%xmm14"; "%xmm15" |] let num_register_classes = 2 @@ -141,26 +181,74 @@ let loc_parameters arg = let loc_results res = let (loc, ofs) = calling_conventions 0 0 100 100 not_supported res in loc -(* C calling convention: +(* C calling conventions under Unix: first integer args in rdi, rsi, rdx, rcx, r8, r9 first float args in xmm0 ... xmm7 - remaining args on stack. - Return value in rax or xmm0. *) + remaining args on stack + return value in rax or xmm0. + C calling conventions under Win64: + first integer args in rcx, rdx, r8, r9 + first float args in xmm0 ... xmm3 + each integer arg consumes a float reg, and conversely + remaining args on stack + always 32 bytes reserved at bottom of stack. + Return value in rax or xmm0. *) -let loc_external_arguments arg = - calling_conventions 2 7 100 107 outgoing arg let loc_external_results res = let (loc, ofs) = calling_conventions 0 0 100 100 not_supported res in loc +let unix_loc_external_arguments arg = + calling_conventions 2 7 100 107 outgoing arg + +let win64_int_external_arguments = + [| 5 (*rcx*); 4 (*rdx*); 6 (*r8*); 7 (*r9*) |] +let win64_float_external_arguments = + [| 100 (*xmm0*); 101 (*xmm1*); 102 (*xmm2*); 103 (*xmm3*) |] + +let win64_loc_external_arguments arg = + let loc = Array.create (Array.length arg) Reg.dummy in + let reg = ref 0 + and ofs = ref 32 in + for i = 0 to Array.length arg - 1 do + match arg.(i).typ with + Int | Addr as ty -> + if !reg < 4 then begin + loc.(i) <- phys_reg win64_int_external_arguments.(!reg); + incr reg + end else begin + loc.(i) <- stack_slot (Outgoing !ofs) ty; + ofs := !ofs + size_int + end + | Float -> + if !reg < 4 then begin + loc.(i) <- phys_reg win64_float_external_arguments.(!reg); + incr reg + end else begin + loc.(i) <- stack_slot (Outgoing !ofs) Float; + ofs := !ofs + size_float + end + done; + (loc, Misc.align !ofs 16) (* keep stack 16-aligned *) + +let loc_external_arguments = + if win64 then win64_loc_external_arguments else unix_loc_external_arguments + let loc_exn_bucket = rax (* Registers destroyed by operations *) -let destroyed_at_c_call = (* rbp, rbx, r12-r15 preserved *) - Array.of_list(List.map phys_reg - [0;2;3;4;5;6;7;8;9; - 100;101;102;103;104;105;106;107; - 108;109;110;111;112;113;114;115]) +let destroyed_at_c_call = + if win64 then + (* Win64: rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15 preserved *) + Array.of_list(List.map phys_reg + [0;4;5;6;7;8;9; + 100;101;102;103;104;105]) + else + (* Unix: rbp, rbx, r12-r15 preserved *) + Array.of_list(List.map phys_reg + [0;2;3;4;5;6;7;8;9; + 100;101;102;103;104;105;106;107; + 108;109;110;111;112;113;114;115]) let destroyed_at_oper = function Iop(Icall_ind | Icall_imm _ | Iextcall(_, true)) -> all_phys_regs @@ -177,11 +265,11 @@ let destroyed_at_raise = all_phys_regs (* Maximal register pressure *) let safe_register_pressure = function - Iextcall(_,_) -> 0 + Iextcall(_,_) -> if win64 then 8 else 0 | _ -> 11 let max_register_pressure = function - Iextcall(_, _) -> [| 4; 0 |] + Iextcall(_, _) -> if win64 then [| 8; 10 |] else [| 4; 0 |] | Iintop(Idiv | Imod) -> [| 11; 16 |] | Ialloc _ | Iintop(Icomp _) | Iintop_imm((Idiv|Imod|Icomp _), _) -> [| 12; 16 |] @@ -196,5 +284,10 @@ let contains_calls = ref false (* Calling the assembler *) let assemble_file infile outfile = - Ccomp.command (Config.asm ^ " -o " ^ - Filename.quote outfile ^ " " ^ Filename.quote infile) + if masm then + Ccomp.command (Config.asm ^ + Filename.quote outfile ^ " " ^ Filename.quote infile ^ + (if !Clflags.verbose then "" else ">NUL")) + else + Ccomp.command (Config.asm ^ " -o " ^ + Filename.quote outfile ^ " " ^ Filename.quote infile) diff --git a/asmcomp/amd64/proc_nt.ml b/asmcomp/amd64/proc_nt.ml deleted file mode 100644 index 2130253feb..0000000000 --- a/asmcomp/amd64/proc_nt.ml +++ /dev/null @@ -1,233 +0,0 @@ -(***********************************************************************) -(* *) -(* OCaml *) -(* *) -(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) -(* *) -(* Copyright 2000 Institut National de Recherche en Informatique et *) -(* en Automatique. All rights reserved. This file is distributed *) -(* under the terms of the Q Public License version 1.0. *) -(* *) -(***********************************************************************) - -(* $Id$ *) - -(* Description of the AMD64 processor with Win64 conventions *) - -open Misc -open Arch -open Cmm -open Reg -open Mach - -(* Registers available for register allocation *) - -(* Register map: - rax 0 rax - r11: Caml function arguments - rbx 1 rcx - r9: C function arguments - rdi 2 rax: Caml and C function results - rsi 3 rbx, rbp, rsi, rdi r12-r15 are preserved by C - rdx 4 - rcx 5 - r8 6 - r9 7 - r10 8 - r11 9 - rbp 10 - r12 11 - r13 12 - r14 trap pointer - r15 allocation pointer - - xmm0 - xmm15 100 - 115 xmm0 - xmm9: Caml function arguments - xmm0 - xmm3: C function arguments - xmm0: Caml and C function results - xmm6-xmm15 are preserved by C *) - -let int_reg_name = - [| "rax"; "rbx"; "rdi"; "rsi"; "rdx"; "rcx"; "r8"; "r9"; - "r10"; "r11"; "rbp"; "r12"; "r13" |] - -let float_reg_name = - [| "xmm0"; "xmm1"; "xmm2"; "xmm3"; "xmm4"; "xmm5"; "xmm6"; "xmm7"; - "xmm8"; "xmm9"; "xmm10"; "xmm11"; "xmm12"; "xmm13"; "xmm14"; "xmm15" |] - -let num_register_classes = 2 - -let register_class r = - match r.typ with - Int -> 0 - | Addr -> 0 - | Float -> 1 - -let num_available_registers = [| 13; 16 |] - -let first_available_register = [| 0; 100 |] - -let register_name r = - if r < 100 then int_reg_name.(r) else float_reg_name.(r - 100) - -(* Pack registers starting at %rax so as to reduce the number of REX - prefixes and thus improve code density *) -let rotate_registers = false - -(* Representation of hard registers by pseudo-registers *) - -let hard_int_reg = - let v = Array.create 13 Reg.dummy in - for i = 0 to 12 do v.(i) <- Reg.at_location Int (Reg i) done; - v - -let hard_float_reg = - let v = Array.create 16 Reg.dummy in - for i = 0 to 15 do v.(i) <- Reg.at_location Float (Reg (100 + i)) done; - v - -let all_phys_regs = - Array.append hard_int_reg hard_float_reg - -let phys_reg n = - if n < 100 then hard_int_reg.(n) else hard_float_reg.(n - 100) - -let rax = phys_reg 0 -let rcx = phys_reg 5 -let rdx = phys_reg 4 -let r11 = phys_reg 9 -let rxmm15 = phys_reg 115 - -let stack_slot slot ty = - Reg.at_location ty (Stack slot) - -(* Instruction selection *) - -let word_addressed = false - -(* Calling conventions *) - -let calling_conventions first_int last_int first_float last_float make_stack - arg = - let loc = Array.create (Array.length arg) Reg.dummy in - let int = ref first_int in - let float = ref first_float in - let ofs = ref 0 in - for i = 0 to Array.length arg - 1 do - match arg.(i).typ with - Int | Addr as ty -> - if !int <= last_int then begin - loc.(i) <- phys_reg !int; - incr int - end else begin - loc.(i) <- stack_slot (make_stack !ofs) ty; - ofs := !ofs + size_int - end - | Float -> - if !float <= last_float then begin - loc.(i) <- phys_reg !float; - incr float - end else begin - loc.(i) <- stack_slot (make_stack !ofs) Float; - ofs := !ofs + size_float - end - done; - (loc, Misc.align !ofs 16) (* keep stack 16-aligned *) - -let incoming ofs = Incoming ofs -let outgoing ofs = Outgoing ofs -let not_supported ofs = fatal_error "Proc.loc_results: cannot call" - -let loc_arguments arg = - calling_conventions 0 9 100 109 outgoing arg -let loc_parameters arg = - let (loc, ofs) = calling_conventions 0 9 100 109 incoming arg in loc -let loc_results res = - let (loc, ofs) = calling_conventions 0 0 100 100 not_supported res in loc - -(* C calling conventions (Win64): - first integer args in rcx, rdx, r8, r9 (4 - 7) - first float args in xmm0 ... xmm3 (100 - 103) - each integer arg consumes a float reg, and conversely - remaining args on stack - always 32 bytes reserved at bottom of stack. - Return value in rax or xmm0 -*) - -let loc_external_results res = - let (loc, ofs) = calling_conventions 0 0 100 100 not_supported res in loc - -let int_external_arguments = - [| 5 (*rcx*); 4 (*rdx*); 6 (*r8*); 7 (*r9*) |] -let float_external_arguments = - [| 100 (*xmm0*); 101 (*xmm1*); 102 (*xmm2*); 103 (*xmm3*) |] - -let loc_external_arguments arg = - let loc = Array.create (Array.length arg) Reg.dummy in - let reg = ref 0 - and ofs = ref 32 in - for i = 0 to Array.length arg - 1 do - match arg.(i).typ with - Int | Addr as ty -> - if !reg < 4 then begin - loc.(i) <- phys_reg int_external_arguments.(!reg); - incr reg - end else begin - loc.(i) <- stack_slot (Outgoing !ofs) ty; - ofs := !ofs + size_int - end - | Float -> - if !reg < 4 then begin - loc.(i) <- phys_reg float_external_arguments.(!reg); - incr reg - end else begin - loc.(i) <- stack_slot (Outgoing !ofs) Float; - ofs := !ofs + size_float - end - done; - (loc, Misc.align !ofs 16) (* keep stack 16-aligned *) - -let loc_exn_bucket = rax - -(* Registers destroyed by operations *) - -let destroyed_at_c_call = - (* Win64: rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15 preserved *) - Array.of_list(List.map phys_reg - [0;4;5;6;7;8;9; - 100;101;102;103;104;105]) - -let destroyed_at_oper = function - Iop(Icall_ind | Icall_imm _ | Iextcall(_, true)) -> all_phys_regs - | Iop(Iextcall(_, false)) -> destroyed_at_c_call - | Iop(Iintop(Idiv | Imod)) -> [| rax; rdx |] - | Iop(Istore(Single, _)) -> [| rxmm15 |] - | Iop(Ialloc _ | Iintop(Icomp _) | Iintop_imm((Idiv|Imod|Icomp _), _)) - -> [| rax |] - | Iswitch(_, _) -> [| rax; rdx |] - | _ -> [||] - -let destroyed_at_raise = all_phys_regs - -(* Maximal register pressure *) - -let safe_register_pressure = function - Iextcall(_,_) -> 8 - | _ -> 11 - -let max_register_pressure = function - Iextcall(_, _) -> [| 8; 10 |] - | Iintop(Idiv | Imod) -> [| 11; 16 |] - | Ialloc _ | Iintop(Icomp _) | Iintop_imm((Idiv|Imod|Icomp _), _) - -> [| 12; 16 |] - | Istore(Single, _) -> [| 13; 15 |] - | _ -> [| 13; 16 |] - -(* Layout of the stack frame *) - -let num_stack_slots = [| 0; 0 |] -let contains_calls = ref false - -(* Calling the assembler *) - -let assemble_file infile outfile = - Ccomp.command (Config.asm ^ - Filename.quote outfile ^ " " ^ - Filename.quote infile ^ "> NUL") diff --git a/asmcomp/i386/proc.ml b/asmcomp/i386/proc.ml index 55cb32c9b6..10ac59bfce 100644 --- a/asmcomp/i386/proc.ml +++ b/asmcomp/i386/proc.ml @@ -20,6 +20,12 @@ open Cmm open Reg open Mach +(* Which asm conventions to use *) +let masm = + match Config.ccomp_type with + | "msvc" -> true + | _ -> false + (* Registers available for register allocation *) (* Register map: @@ -34,10 +40,16 @@ open Mach tos 100 top of floating-point stack. *) let int_reg_name = - [| "%eax"; "%ebx"; "%ecx"; "%edx"; "%esi"; "%edi"; "%ebp" |] + if masm then + [| "eax"; "ebx"; "ecx"; "edx"; "esi"; "edi"; "ebp" |] + else + [| "%eax"; "%ebx"; "%ecx"; "%edx"; "%esi"; "%edi"; "%ebp" |] let float_reg_name = - [| "%tos" |] + if masm then + [| "tos" |] + else + [| "%tos" |] let num_register_classes = 2 @@ -181,8 +193,13 @@ let contains_calls = ref false (* Calling the assembler *) let assemble_file infile outfile = - Ccomp.command (Config.asm ^ " -o " ^ - Filename.quote outfile ^ " " ^ Filename.quote infile) + if masm then + Ccomp.command (Config.asm ^ + Filename.quote outfile ^ " " ^ Filename.quote infile ^ + (if !Clflags.verbose then "" else ">NUL")) + else + Ccomp.command (Config.asm ^ " -o " ^ + Filename.quote outfile ^ " " ^ Filename.quote infile) open Clflags;; open Config;; diff --git a/asmcomp/i386/proc_nt.ml b/asmcomp/i386/proc_nt.ml deleted file mode 100644 index ebed8f647a..0000000000 --- a/asmcomp/i386/proc_nt.ml +++ /dev/null @@ -1,186 +0,0 @@ -(***********************************************************************) -(* *) -(* OCaml *) -(* *) -(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) -(* *) -(* Copyright 1996 Institut National de Recherche en Informatique et *) -(* en Automatique. All rights reserved. This file is distributed *) -(* under the terms of the Q Public License version 1.0. *) -(* *) -(***********************************************************************) - -(* $Id$ *) - -(* Description of the Intel 386 processor, for Windows NT *) - -open Misc -open Arch -open Cmm -open Reg -open Mach - -(* Registers available for register allocation *) - -(* Register map: - eax 0 eax - edi: function arguments and results - ebx 1 eax: C function results - ecx 2 ebx, esi, edi, ebp: preserved by C - edx 3 - esi 4 - edi 5 - ebp 6 - - tos 100 top of floating-point stack. *) - -let int_reg_name = - [| "eax"; "ebx"; "ecx"; "edx"; "esi"; "edi"; "ebp" |] - -let float_reg_name = - [| "tos" |] - -let num_register_classes = 2 - -let register_class r = - match r.typ with - Int -> 0 - | Addr -> 0 - | Float -> 1 - -let num_available_registers = [| 7; 0 |] - -let first_available_register = [| 0; 100 |] - -let register_name r = - if r < 100 then int_reg_name.(r) else float_reg_name.(r - 100) - -(* There is little scheduling, and some operations are more compact - when their argument is %eax. *) - -let rotate_registers = false - -(* Representation of hard registers by pseudo-registers *) - -let hard_int_reg = - let v = Array.create 7 Reg.dummy in - for i = 0 to 6 do v.(i) <- Reg.at_location Int (Reg i) done; - v - -let hard_float_reg = [| Reg.at_location Float (Reg 100) |] - -let all_phys_regs = - Array.append hard_int_reg hard_float_reg - -let phys_reg n = - if n < 100 then hard_int_reg.(n) else hard_float_reg.(n - 100) - -let eax = phys_reg 0 -let ecx = phys_reg 2 -let edx = phys_reg 3 -let tos = phys_reg 100 - -let stack_slot slot ty = - Reg.at_location ty (Stack slot) - -(* Instruction selection *) - -let word_addressed = false - -(* Calling conventions *) - -(* To supplement the processor's meagre supply of registers, we also - use some global memory locations to pass arguments beyond the 6th. - These globals are denoted by Incoming and Outgoing stack locations - with negative offsets, starting at -64. - Unlike arguments passed on stack, arguments passed in globals - do not prevent tail-call elimination. The caller stores arguments - in these globals immediately before the call, and the first thing the - callee does is copy them to registers or stack locations. - Neither GC nor thread context switches can occur between these two - times. *) - -let calling_conventions first_int last_int first_float last_float make_stack - arg = - let loc = Array.create (Array.length arg) Reg.dummy in - let int = ref first_int in - let float = ref first_float in - let ofs = ref (-64) in - for i = 0 to Array.length arg - 1 do - match arg.(i).typ with - Int | Addr as ty -> - if !int <= last_int then begin - loc.(i) <- phys_reg !int; - incr int - end else begin - loc.(i) <- stack_slot (make_stack !ofs) ty; - ofs := !ofs + size_int - end - | Float -> - if !float <= last_float then begin - loc.(i) <- phys_reg !float; - incr float - end else begin - loc.(i) <- stack_slot (make_stack !ofs) Float; - ofs := !ofs + size_float - end - done; - (loc, max 0 !ofs) - -let incoming ofs = Incoming ofs -let outgoing ofs = Outgoing ofs -let not_supported ofs = fatal_error "Proc.loc_results: cannot call" - -let loc_arguments arg = - calling_conventions 0 5 100 99 outgoing arg -let loc_parameters arg = - let (loc, ofs) = calling_conventions 0 5 100 99 incoming arg in loc -let loc_results res = - let (loc, ofs) = calling_conventions 0 5 100 100 not_supported res in loc -let extcall_use_push = true -let loc_external_arguments arg = - fatal_error "Proc.loc_external_arguments" -let loc_external_results res = - let (loc, ofs) = calling_conventions 0 0 100 100 not_supported res in loc - -let loc_exn_bucket = eax - -(* Registers destroyed by operations *) - -let destroyed_at_c_call = (* ebx, esi, edi, ebp preserved *) - Array.of_list(List.map phys_reg [0;2;3]) - -let destroyed_at_oper = function - Iop(Icall_ind | Icall_imm _ | Iextcall(_, true)) -> all_phys_regs - | Iop(Iextcall(_, false)) -> destroyed_at_c_call - | Iop(Iintop(Idiv | Imod)) -> [| eax; edx |] - | Iop(Iintop_imm(Imod, _)) -> [| eax |] - | Iop(Ialloc _) -> [| eax |] - | Iop(Iintop(Icomp _) | Iintop_imm(Icomp _, _)) -> [| eax |] - | Iop(Iintoffloat) -> [| eax |] - | Iifthenelse(Ifloattest(_, _), _, _) -> [| eax |] - | _ -> [||] - -let destroyed_at_raise = all_phys_regs - -(* Maximal register pressure *) - -let safe_register_pressure op = 4 - -let max_register_pressure = function - Iextcall(_, _) -> [| 4; max_int |] - | Iintop(Idiv | Imod) -> [| 5; max_int |] - | Ialloc _ | Iintop(Icomp _) | Iintop_imm(Icomp _, _) | - Iintoffloat -> [| 6; max_int |] - | _ -> [|7; max_int |] - -(* Layout of the stack frame *) - -let num_stack_slots = [| 0; 0 |] -let contains_calls = ref false - -(* Calling the assembler *) - -let assemble_file infile outfile = - Ccomp.command (Config.asm ^ - Filename.quote outfile ^ " " ^ Filename.quote infile ^ - (if !Clflags.verbose then "" else ">NUL")) diff --git a/config/Makefile.mingw b/config/Makefile.mingw index 22da3c16b6..e3b794d80f 100644 --- a/config/Makefile.mingw +++ b/config/Makefile.mingw @@ -77,6 +77,7 @@ SYSTHREAD_SUPPORT=true EXTRALIBS= NATDYNLINK=true CMXS=cmxs +RUNTIMED=noruntimed ########## Configuration for the bytecode compiler diff --git a/config/Makefile.msvc b/config/Makefile.msvc index 7006fa6390..0f6eb4cc9f 100644 --- a/config/Makefile.msvc +++ b/config/Makefile.msvc @@ -71,6 +71,7 @@ SYSTHREAD_SUPPORT=true EXTRALIBS= CMXS=cmxs NATDYNLINK=true +RUNTIMED=noruntimed ########## Configuration for the bytecode compiler diff --git a/config/Makefile.msvc64 b/config/Makefile.msvc64 index c62e51a362..64e09d1f76 100644 --- a/config/Makefile.msvc64 +++ b/config/Makefile.msvc64 @@ -71,6 +71,7 @@ CC_PROFILE= SYSTHREAD_SUPPORT=true CMXS=cmxs NATDYNLINK=true +RUNTIMED=noruntimed ########## Configuration for the bytecode compiler diff --git a/utils/config.mli b/utils/config.mli index 102f9b1293..897edb6da2 100644 --- a/utils/config.mli +++ b/utils/config.mli @@ -22,10 +22,9 @@ val standard_library: string val standard_runtime: string (* The full path to the standard bytecode interpreter ocamlrun *) val ccomp_type: string - (* The "kind" of the C compiler: one of + (* The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) - "msvc" (Microsoft Visual C++) - "mrc" (Macintosh MPW) *) + "msvc" (for Microsoft Visual C++ and MASM) *) val bytecomp_c_compiler: string (* The C compiler to use for compiling C files with the bytecode compiler *) |