Skip to content

Commit e0b8691

Browse files
committed
removed small int parts
1 parent 1470516 commit e0b8691

File tree

8 files changed

+22
-51
lines changed

8 files changed

+22
-51
lines changed

backend/arm64/cfg_selection.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class selector =
171171
method! insert_move_extcall_arg env ty_arg src dst =
172172
let ty_arg_is_int32 =
173173
match ty_arg with
174-
| XInt8 | XInt16 | XInt32 -> true
174+
| XInt32 -> true
175175
| XInt | XInt64 | XFloat32 | XFloat | XVec128 -> false
176176
in
177177
if macosx && ty_arg_is_int32 && is_stack_slot dst

backend/arm64/proc.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ let external_calling_conventions
297297
begin match ty_arg with
298298
| XInt | XInt64 ->
299299
loc.(i) <- [| loc_int last_int make_stack int ofs |]
300-
| XInt32 | XInt16 | XInt8 ->
300+
| XInt32 ->
301301
loc.(i) <- [| loc_int32 last_int make_stack int ofs |]
302302
| XFloat ->
303303
loc.(i) <- [| loc_float last_float make_stack float ofs |]

backend/arm64/selection.ml

+1-6
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,7 @@ class selector =
157157
| _ -> super#select_operation op args dbg
158158

159159
method! insert_move_extcall_arg env ty_arg src dst =
160-
let ty_arg_is_int32 =
161-
match ty_arg with
162-
| XInt8 | XInt16 | XInt32 -> true
163-
| XInt | XInt64 | XFloat32 | XFloat | XVec128 -> false
164-
in
165-
if macosx && ty_arg_is_int32 && is_stack_slot dst
160+
if macosx && ty_arg = XInt32 && is_stack_slot dst
166161
then self#insert env (Iop (Ispecific Imove32)) src dst
167162
else self#insert_moves env src dst
168163
end

backend/cmm.ml

+15-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# 1 "backend/cmm.ml"
21
(**************************************************************************)
32
(* *)
43
(* OCaml *)
@@ -108,8 +107,6 @@ let ge_component comp1 comp2 =
108107

109108
type exttype =
110109
| XInt
111-
| XInt8
112-
| XInt16
113110
| XInt32
114111
| XInt64
115112
| XFloat32
@@ -118,8 +115,6 @@ type exttype =
118115

119116
let machtype_of_exttype = function
120117
| XInt -> typ_int
121-
| XInt8 -> typ_int
122-
| XInt16 -> typ_int
123118
| XInt32 -> typ_int
124119
| XInt64 -> typ_int
125120
| XFloat -> typ_float
@@ -616,19 +611,21 @@ let equal_machtype_component (left : machtype_component) (right : machtype_compo
616611
| Float32, (Val | Addr | Int | Float | Vec128 | Valx2) ->
617612
false
618613

619-
let equal_exttype
620-
((XInt
621-
| XInt8
622-
| XInt16
623-
| XInt32
624-
| XInt64
625-
| XFloat32
626-
| XFloat
627-
| XVec128) as left)
628-
right
629-
=
630-
(* we can use polymorphic compare as long as exttype is all constant constructors *)
631-
left = right
614+
let equal_exttype left right =
615+
match left, right with
616+
| XInt, XInt -> true
617+
| XInt32, XInt32 -> true
618+
| XInt64, XInt64 -> true
619+
| XFloat32, XFloat32 -> true
620+
| XFloat, XFloat -> true
621+
| XVec128, XVec128 -> true
622+
| XInt, (XInt32 | XInt64 | XFloat | XFloat32 | XVec128)
623+
| XInt32, (XInt | XInt64 | XFloat | XFloat32 | XVec128)
624+
| XInt64, (XInt | XInt32 | XFloat | XFloat32 | XVec128)
625+
| XFloat, (XInt | XInt32 | XFloat32 | XInt64 | XVec128)
626+
| XVec128, (XInt | XInt32 | XInt64 | XFloat | XFloat32)
627+
| XFloat32, (XInt | XInt32 | XInt64 | XFloat | XVec128) ->
628+
false
632629

633630
let equal_vec128_type v1 v2 =
634631
match v1, v2 with

backend/cmm.mli

-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ val ge_component
7575

7676
type exttype =
7777
| XInt (**r OCaml value, word-sized integer *)
78-
| XInt8 (**r 8-bit integer *)
79-
| XInt16 (**r 16-bit integer *)
8078
| XInt32 (**r 32-bit integer *)
8179
| XInt64 (**r 64-bit integer *)
8280
| XFloat32 (**r single-precision FP number *)

backend/printcmm.ml

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ let machtype ppf mty =
4949

5050
let exttype ppf = function
5151
| XInt -> fprintf ppf "int"
52-
| XInt8 -> fprintf ppf "int8"
53-
| XInt16 -> fprintf ppf "int16"
5452
| XInt32 -> fprintf ppf "int32"
5553
| XInt64 -> fprintf ppf "int64"
5654
| XFloat -> fprintf ppf "float"

middle_end/flambda2/to_cmm/to_cmm_shared.ml

+4-15
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,6 @@ module Update_kind = struct
306306
type kind =
307307
| Pointer
308308
| Immediate
309-
| Naked_int8
310-
| Naked_int16
311309
| Naked_int32
312310
| Naked_int64
313311
| Naked_float
@@ -331,8 +329,8 @@ module Update_kind = struct
331329

332330
let field_size_in_words t =
333331
match t.kind with
334-
| Pointer | Immediate | Naked_int8 | Naked_int16 | Naked_int32 | Naked_int64
335-
| Naked_float | Naked_float32 ->
332+
| Pointer | Immediate | Naked_int32 | Naked_int64 | Naked_float
333+
| Naked_float32 ->
336334
1
337335
| Naked_vec128 -> 2
338336

@@ -350,10 +348,6 @@ module Update_kind = struct
350348

351349
let naked_vec128s = { kind = Naked_vec128; stride = 16 }
352350

353-
let naked_int8_fields = { kind = Naked_int8; stride = Arch.size_addr }
354-
355-
let naked_int16_fields = { kind = Naked_int16; stride = Arch.size_addr }
356-
357351
let naked_int32_fields = { kind = Naked_int32; stride = Arch.size_addr }
358352

359353
let naked_float32_fields = { kind = Naked_float32; stride = Arch.size_addr }
@@ -378,8 +372,8 @@ let make_update env res dbg ({ kind; stride } : Update_kind.t) ~symbol var
378372
| Immediate ->
379373
(* See [caml_initialize]; we can avoid this function in this case. *)
380374
None
381-
| Naked_int8 | Naked_int16 | Naked_int32 | Naked_int64 | Naked_float
382-
| Naked_float32 | Naked_vec128 ->
375+
| Naked_int32 | Naked_int64 | Naked_float | Naked_float32 | Naked_vec128
376+
->
383377
(* The GC never sees these fields, so we can avoid using
384378
[caml_initialize]. This is important as it significantly reduces
385379
the complexity of the statically-allocated inconstant unboxed int32
@@ -395,11 +389,6 @@ let make_update env res dbg ({ kind; stride } : Update_kind.t) ~symbol var
395389
match kind with
396390
| Pointer -> Word_val
397391
| Immediate -> Word_int
398-
| Naked_int8 | Naked_int16 ->
399-
(* CR layouts v5.1: we only support small integers in being
400-
sign-extended in word fields *)
401-
assert (stride = Arch.size_addr);
402-
Word_int
403392
| Naked_int32 ->
404393
(* Cmm expressions representing int32 values are always sign extended.
405394
By using [Word_int] in the "fields" cases (see [Update_kind],

middle_end/flambda2/to_cmm/to_cmm_shared.mli

-6
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ module Update_kind : sig
113113

114114
val tagged_immediates : t
115115

116-
(** Assumes each field is a word; the byte offset is [index * size_addr]. *)
117-
val naked_int8_fields : t
118-
119-
(** Assumes each field is a word; the byte offset is [index * size_addr]. *)
120-
val naked_int16_fields : t
121-
122116
(** Tightly packed; the byte offset is [index * 4]. ([index] is as for
123117
[make_update], below.) *)
124118
val naked_int32s : t

0 commit comments

Comments
 (0)