@@ -59,53 +59,50 @@ let float_reg_name =
59
59
" d16" ; " d17" ; " d18" ; " d19" ; " d20" ; " d21" ; " d22" ; " d23" ;
60
60
" d24" ; " d25" ; " d26" ; " d27" ; " d28" ; " d29" ; " d30" ; " d31" |]
61
61
62
+ let float32_reg_name =
63
+ [| " s0" ; " s1" ; " s2" ; " s3" ; " s4" ; " s5" ; " s6" ; " s7" ;
64
+ " s8" ; " s9" ; " s10" ; " s11" ; " s12" ; " s13" ; " s14" ; " s15" ;
65
+ " s16" ; " s17" ; " s18" ; " s19" ; " s20" ; " s21" ; " s22" ; " s23" ;
66
+ " s24" ; " s25" ; " s26" ; " s27" ; " s28" ; " s29" ; " s30" ; " s31" |]
67
+
62
68
let num_register_classes = 2
63
69
64
70
let register_class r =
65
71
match (r.typ : Cmm.machtype_component ) with
66
72
| Val | Int | Addr -> 0
67
- | Float -> 1
68
73
| Vec128 ->
69
74
(* CR mslater: (SIMD) arm64 *)
70
75
fatal_error " arm64: got vec128 register"
71
- | Float32 ->
72
- (* CR mslater: (float32) arm64 *)
73
- fatal_error " arm64: got float32 register"
74
76
| Valx2 ->
75
77
(* CR mslater: (SIMD) arm64 *)
76
78
fatal_error " arm64: got valx2 register"
79
+ | Float | Float32 -> 1
77
80
78
81
let num_stack_slot_classes = 2
79
82
80
83
let stack_slot_class typ =
81
84
match (typ : Cmm.machtype_component ) with
82
85
| Val | Int | Addr -> 0
83
- | Float -> 1
84
86
| Vec128 ->
85
87
(* CR mslater: (SIMD) arm64 *)
86
88
fatal_error " arm64: got vec128 register"
87
- | Float32 ->
88
- (* CR mslater: (float32) arm64 *)
89
- fatal_error " arm64: got float32 register"
90
89
| Valx2 ->
91
90
(* CR mslater: (SIMD) arm64 *)
92
91
fatal_error " arm64: got valx2 register"
92
+ | Float | Float32 -> 1
93
93
94
94
let types_are_compatible left right =
95
95
match left.typ, right.typ with
96
96
| (Int | Val | Addr ), (Int | Val | Addr )
97
- | Float , Float ->
98
- true
99
- | Float32 , _ | _ , Float32 ->
100
- (* CR mslater: (float32) arm64 *)
101
- fatal_error " arm64: got float32 register"
97
+ | Float , Float -> true
98
+ | Float32 , Float32 -> true
102
99
| Vec128 , _ | _ , Vec128 ->
103
100
(* CR mslater: (SIMD) arm64 *)
104
101
fatal_error " arm64: got vec128 register"
105
102
| Valx2 , _ | _ , Valx2 ->
106
103
(* CR mslater: (SIMD) arm64 *)
107
104
fatal_error " arm64: got valx2 register"
108
- | (Int | Val | Addr | Float ), _ -> false
105
+ | (Int | Val | Addr | Float | Float32 ), _ -> false
109
106
110
107
let stack_class_tag c =
111
108
match c with
@@ -129,12 +126,13 @@ let register_name ty r =
129
126
(* CR mslater: (SIMD) arm64 *)
130
127
fatal_error " arm64: got vec128 register"
131
128
| Float32 ->
132
- (* CR mslater: (float32) arm64 *)
133
- fatal_error " arm64: got float32 register"
129
+ float32_reg_name.(r - first_available_register.(1 ))
134
130
| Valx2 ->
135
131
(* CR mslater: (SIMD) arm64 *)
136
132
fatal_error " arm64: got valx2 register"
137
133
134
+ (* CR gyorsh for xclerc: [rotate_registers] used in [coloring] on Mach,
135
+ but not in IRC on CFG. Are we dropping an optimization here? *)
138
136
let rotate_registers = true
139
137
140
138
(* Representation of hard registers by pseudo-registers *)
@@ -146,15 +144,17 @@ let hard_int_reg =
146
144
done ;
147
145
v
148
146
149
- let hard_float_reg =
147
+ let hard_float_reg_gen kind =
150
148
let v = Array. make 32 Reg. dummy in
151
149
for i = 0 to 31 do
152
- v.(i) < - Reg. at_location Float (Reg (100 + i))
150
+ v.(i) < - Reg. at_location kind (Reg (100 + i))
153
151
done ;
154
152
v
155
153
154
+ let hard_float_reg = hard_float_reg_gen Float
155
+ let hard_float32_reg = hard_float_reg_gen Float32
156
156
let all_phys_regs =
157
- Array. append hard_int_reg hard_float_reg
157
+ Array. concat [ hard_int_reg; hard_float_reg; hard_float32_reg; ]
158
158
159
159
let precolored_regs =
160
160
let phys_regs = Reg. set_of_array all_phys_regs in
@@ -167,19 +167,15 @@ let phys_reg ty n =
167
167
| Vec128 ->
168
168
(* CR mslater: (SIMD) arm64 *)
169
169
fatal_error " arm64: got vec128 register"
170
- | Float32 ->
171
- (* CR mslater: (float32) arm64 *)
172
- fatal_error " arm64: got float32 register"
173
170
| Valx2 ->
174
171
(* CR mslater: (SIMD) arm64 *)
175
172
fatal_error " arm64: got valx2 register"
173
+ | Float32 -> hard_float32_reg.(n - 100 )
176
174
177
175
let gc_regs_offset _ =
178
- (* CR mslater: (SIMD) arm64 *)
179
176
fatal_error " arm64: gc_reg_offset unreachable"
180
177
181
178
let reg_x8 = phys_reg Int 8
182
- let reg_d7 = phys_reg Float 107
183
179
184
180
let stack_slot slot ty =
185
181
Reg. at_location ty (Stack slot)
@@ -198,16 +194,19 @@ let loc_int last_int make_stack int ofs =
198
194
ofs := ! ofs + size_int; l
199
195
end
200
196
201
- let loc_float last_float make_stack float ofs =
197
+ let loc_float_gen kind size last_float make_stack float ofs =
202
198
if ! float < = last_float then begin
203
- let l = phys_reg Float ! float in
199
+ let l = phys_reg kind ! float in
204
200
incr float ; l
205
201
end else begin
206
- ofs := Misc. align ! ofs size_float ;
207
- let l = stack_slot (make_stack ! ofs) Float in
208
- ofs := ! ofs + size_float ; l
202
+ ofs := Misc. align ! ofs size ;
203
+ let l = stack_slot (make_stack ! ofs) kind in
204
+ ofs := ! ofs + size ; l
209
205
end
210
206
207
+ let loc_float = loc_float_gen Float Arch. size_float
208
+ (* float32 slots still take up a full word *)
209
+ let loc_float32 = loc_float_gen Float32 Arch. size_float
211
210
let loc_int32 last_int make_stack int ofs =
212
211
if ! int < = last_int then begin
213
212
let l = phys_reg Int ! int in
@@ -234,8 +233,7 @@ let calling_conventions
234
233
(* CR mslater: (SIMD) arm64 *)
235
234
fatal_error " arm64: got vec128 register"
236
235
| Float32 ->
237
- (* CR mslater: (float32) arm64 *)
238
- fatal_error " arm64: got float32 register"
236
+ loc.(i) < - loc_float32 last_float make_stack float ofs
239
237
| Valx2 ->
240
238
(* CR mslater: (SIMD) arm64 *)
241
239
fatal_error " arm64: got valx2 register"
@@ -305,8 +303,7 @@ let external_calling_conventions
305
303
(* CR mslater: (SIMD) arm64 *)
306
304
fatal_error " arm64: got vec128 register"
307
305
| XFloat32 ->
308
- (* CR mslater: (float32) arm64 *)
309
- fatal_error " arm64: got float32 register"
306
+ loc.(i) < - [| loc_float32 last_float make_stack float ofs |]
310
307
end )
311
308
ty_args;
312
309
(loc, Misc. align ! ofs 16 ) (* keep stack 16-aligned *)
@@ -350,13 +347,25 @@ let domainstate_ptr_dwarf_register_number = 28
350
347
351
348
let destroyed_at_c_noalloc_call =
352
349
(* x19-x28, d8-d15 preserved *)
353
- Array. append
354
- (Array. of_list (List. map (phys_reg Int )
355
- [0 ;1 ;2 ;3 ;4 ;5 ;6 ;7 ;8 ;9 ;10 ;11 ;12 ;13 ;14 ;15 ]))
356
- (Array. of_list (List. map (phys_reg Float )
357
- [100 ;101 ;102 ;103 ;104 ;105 ;106 ;107 ;
358
- 116 ;117 ;118 ;119 ;120 ;121 ;122 ;123 ;
359
- 124 ;125 ;126 ;127 ;128 ;129 ;130 ;131 ]))
350
+ let int_regs_destroyed_at_c_noalloc_call =
351
+ [| 0 ;1 ;2 ;3 ;4 ;5 ;6 ;7 ;8 ;9 ;10 ;11 ;12 ;13 ;14 ;15 |]
352
+ in
353
+ let float_regs_destroyed_at_c_noalloc_call =
354
+ [|100 ;101 ;102 ;103 ;104 ;105 ;106 ;107 ;
355
+ 116 ;117 ;118 ;119 ;120 ;121 ;122 ;123 ;
356
+ 124 ;125 ;126 ;127 ;128 ;129 ;130 ;131 |]
357
+ in
358
+ Array. concat [
359
+ Array. map (phys_reg Int ) int_regs_destroyed_at_c_noalloc_call;
360
+ Array. map (phys_reg Float ) float_regs_destroyed_at_c_noalloc_call;
361
+ Array. map (phys_reg Float32 ) float_regs_destroyed_at_c_noalloc_call;
362
+ ]
363
+
364
+ (* CSE needs to know that all versions of neon are destroyed. *)
365
+ let destroy_neon_reg n =
366
+ [| phys_reg Float (100 + n); phys_reg Float32 (100 + n); |]
367
+
368
+ let destroy_neon_reg7 = destroy_neon_reg 7
360
369
361
370
let destroyed_at_raise = all_phys_regs
362
371
@@ -366,8 +375,6 @@ let destroyed_at_pushtrap = [| |]
366
375
367
376
let destroyed_at_alloc_or_poll = [| reg_x8 |]
368
377
369
- let destroy_neon_reg7 = [| reg_d7 |]
370
-
371
378
let destroyed_at_basic (basic : Cfg_intf.S.basic ) =
372
379
match basic with
373
380
| Reloadretaddr ->
0 commit comments