cur changes

This commit is contained in:
T0b1
2023-04-18 12:18:44 +02:00
parent a0e2851620
commit a0404ec851
3 changed files with 280 additions and 0 deletions

View File

@@ -909,6 +909,18 @@ fn handle_out_block_params<'a, F: Function>(
let out_params = state.func.branch_blockparams(block, last_inst, 0);
debug_assert_eq!(in_params.len(), out_params.len());
// TODO: need to break cycles
// e.g.
// Move v144 from slot 5 to slot 2 for v135
// Move v145 from slot 6 to slot 3 for v136
// Move v146 from slot 3 to slot 4 for v137
// or
// 6->3
// 3->5
// 5->6
// or
// 3->6
// 6->3
for i in 0..in_params.len() {
let in_vreg = in_params[i];
let out_vreg = out_params[i];
@@ -999,6 +1011,11 @@ fn handle_out_block_params<'a, F: Function>(
vregs_passed.push(out_vreg);
if !state.liveouts[block.index()].get(out_vreg.vreg()) {
trace!(
"{} died at the edge, reuse stack slot for {}",
out_vreg,
in_vreg
);
// we can reuse the stack slot since the variable dies
state.vregs[in_vreg.vreg()].slot_idx =
Some(state.vregs[out_vreg.vreg()].slot_idx.unwrap());
@@ -1207,6 +1224,11 @@ fn calc_live_bitmaps<'a, F: Function>(
for &pred in state.func.block_preds(block) {
if state.liveouts[pred.index()].union_with(&live) {
trace!(
"liveouts of block{} changed to: {:?}",
pred.index(),
state.liveouts[pred.index()]
);
if !workqueue_set.is_set(pred.index()) {
workqueue_set.set(pred.index());
workqueue.push_back(pred);