Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Cmm_helpers.Scalar_type #3423

Open
wants to merge 2 commits into
base: cmm-refactor-unboxed-fields
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/arm64/cfg_selection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class selector =
method! insert_move_extcall_arg env ty_arg src dst =
let ty_arg_is_int32 =
match ty_arg with
| XInt32 -> true
| XInt8 | XInt16 | XInt32 -> true
| XInt | XInt64 | XFloat32 | XFloat | XVec128 -> false
in
if macosx && ty_arg_is_int32 && is_stack_slot dst
Expand Down
2 changes: 1 addition & 1 deletion backend/arm64/proc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ let external_calling_conventions
begin match ty_arg with
| XInt | XInt64 ->
loc.(i) <- [| loc_int last_int make_stack int ofs |]
| XInt32 ->
| XInt32 | XInt16 | XInt8 ->
loc.(i) <- [| loc_int32 last_int make_stack int ofs |]
| XFloat ->
loc.(i) <- [| loc_float last_float make_stack float ofs |]
Expand Down
7 changes: 6 additions & 1 deletion backend/arm64/selection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ class selector =
| _ -> super#select_operation op args dbg

method! insert_move_extcall_arg env ty_arg src dst =
if macosx && ty_arg = XInt32 && is_stack_slot dst
let ty_arg_is_int32 =
match ty_arg with
| XInt8 | XInt16 | XInt32 -> true
| XInt | XInt64 | XFloat32 | XFloat | XVec128 -> false
in
if macosx && ty_arg_is_int32 && is_stack_slot dst
then self#insert env (Iop (Ispecific Imove32)) src dst
else self#insert_moves env src dst
end
Expand Down
33 changes: 18 additions & 15 deletions backend/cmm.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# 1 "backend/cmm.ml"
(**************************************************************************)
(* *)
(* OCaml *)
Expand Down Expand Up @@ -107,6 +108,8 @@ let ge_component comp1 comp2 =

type exttype =
| XInt
| XInt8
| XInt16
| XInt32
| XInt64
| XFloat32
Expand All @@ -115,6 +118,8 @@ type exttype =

let machtype_of_exttype = function
| XInt -> typ_int
| XInt8 -> typ_int
| XInt16 -> typ_int
| XInt32 -> typ_int
| XInt64 -> typ_int
| XFloat -> typ_float
Expand Down Expand Up @@ -590,21 +595,19 @@ let equal_machtype_component (left : machtype_component) (right : machtype_compo
| Float32, (Val | Addr | Int | Float | Vec128 | Valx2) ->
false

let equal_exttype left right =
match left, right with
| XInt, XInt -> true
| XInt32, XInt32 -> true
| XInt64, XInt64 -> true
| XFloat32, XFloat32 -> true
| XFloat, XFloat -> true
| XVec128, XVec128 -> true
| XInt, (XInt32 | XInt64 | XFloat | XFloat32 | XVec128)
| XInt32, (XInt | XInt64 | XFloat | XFloat32 | XVec128)
| XInt64, (XInt | XInt32 | XFloat | XFloat32 | XVec128)
| XFloat, (XInt | XInt32 | XFloat32 | XInt64 | XVec128)
| XVec128, (XInt | XInt32 | XInt64 | XFloat | XFloat32)
| XFloat32, (XInt | XInt32 | XInt64 | XFloat | XVec128) ->
false
let equal_exttype
((XInt
| XInt8
| XInt16
| XInt32
| XInt64
| XFloat32
| XFloat
| XVec128) as left)
right
=
(* we can use polymorphic compare as long as exttype is all constant constructors *)
left = right

let equal_vec128_type v1 v2 =
match v1, v2 with
Expand Down
2 changes: 2 additions & 0 deletions backend/cmm.mli
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ val ge_component

type exttype =
| XInt (**r OCaml value, word-sized integer *)
| XInt8 (**r 8-bit integer *)
| XInt16 (**r 16-bit integer *)
| XInt32 (**r 32-bit integer *)
| XInt64 (**r 64-bit integer *)
| XFloat32 (**r single-precision FP number *)
Expand Down
Loading
Loading