Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ocamlopt code generator question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Ocamlopt code generator question
> For amd64 we have in asmcomp/amd64/proc_nt.mlp:
> 
> (*  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 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
> 
> What these first_float=100 and last_float=109 for loc_arguments and
> loc_parameters affect? My impression is that floats are always passed
> boxed, so xmm registers are in fact never used to pass parameters. And
> float values are returned as a pointer in eax, not a value in xmm0 as
> loc_results would suggest.

The ocamlopt code generators support unboxed floats as function
parameters and results, as well as returning multiple results in
several registers.  (Except for the x86-32 bits port, because of the
weird floating-point model of this architecture.)  You're right that
the ocamlopt "middle-end" does not currently take advantage of this
possibility, since floats are passed between functions in boxed state.

- Xavier Leroy