Skip to content

Commit b7d7f70

Browse files
committed
Slight shaving on RA, no more optimizing today. It's fast enough for now.
1 parent 1a61fb8 commit b7d7f70

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/boot/be/ra.ml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,14 @@ let calculate_live_bitvectors
190190
let n_quads = Array.length quads in
191191
let n_vregs = cx.ctxt_n_vregs in
192192
let new_bitv _ = Bits.create n_vregs false in
193+
let new_true_bitv _ = Bits.create n_vregs true in
193194
let (live_in_vregs:Bits.t array) = Array.init n_quads new_bitv in
194195
let (live_out_vregs:Bits.t array) = Array.init n_quads new_bitv in
195196

196197
let (quad_used_vrs:Bits.t array) = Array.init n_quads new_bitv in
197-
let (quad_defined_vrs:Bits.t array) = Array.init n_quads new_bitv in
198+
let (quad_not_defined_vrs:Bits.t array) =
199+
Array.init n_quads new_true_bitv
200+
in
198201
let (quad_uncond_jmp:bool array) = Array.make n_quads false in
199202
let (quad_jmp_targs:(Il.label list) array) = Array.make n_quads [] in
200203

@@ -212,8 +215,8 @@ let calculate_live_bitvectors
212215
(fun v -> Bits.set quad_used_vrs.(i) v true)
213216
(quad_used_vregs q);
214217
List.iter
215-
(fun v -> Bits.set quad_defined_vrs.(i) v true)
216-
(quad_defined_vregs q)
218+
(fun v -> Bits.set quad_not_defined_vrs.(i) v false)
219+
(quad_defined_vregs q);
217220
done;
218221

219222
while !changed do
@@ -228,7 +231,7 @@ let calculate_live_bitvectors
228231
let live_in = live_in_vregs.(i) in
229232
let live_out = live_out_vregs.(i) in
230233
let used = quad_used_vrs.(i) in
231-
let defined = quad_defined_vrs.(i) in
234+
let not_defined = quad_not_defined_vrs.(i) in
232235

233236
(* Union in the vregs we use. *)
234237
note_change (Bits.union live_in used);
@@ -243,8 +246,7 @@ let calculate_live_bitvectors
243246
then note_change (Bits.union live_out live_in_vregs.(i+1));
244247

245248
(* Propagate live-out to live-in on anything we don't define. *)
246-
ignore (Bits.copy scratch defined);
247-
Bits.invert scratch;
249+
ignore (Bits.copy scratch not_defined);
248250
ignore (Bits.intersect scratch live_out);
249251
note_change (Bits.union live_in scratch);
250252

@@ -379,8 +381,7 @@ let reg_alloc
379381
let n_pre_spills = convert_pre_spills cx spill_slot in
380382

381383
let (live_in_vregs, live_out_vregs) =
382-
Session.time_inner "RA liveness" sess
383-
(fun _ -> calculate_live_bitvectors cx)
384+
calculate_live_bitvectors cx
384385
in
385386
let (vreg_constraints:Bits.t array) = (* vreg idx -> hreg bits.t *)
386387
calculate_vreg_constraints cx

0 commit comments

Comments
 (0)