Refactor out an append helper function for SideEffects.
This commit is contained in:
@@ -66,6 +66,13 @@ impl SideEffects {
|
|||||||
instructions_added_to_ebbs: Vec::new(),
|
instructions_added_to_ebbs: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn append(&mut self, mut more: SideEffects) {
|
||||||
|
self.split_ebbs_created.append(&mut more.split_ebbs_created);
|
||||||
|
self.instructions_added_to_ebbs.append(
|
||||||
|
&mut more.instructions_added_to_ebbs,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Describes the current position of a basic block in the control flow graph.
|
// Describes the current position of a basic block in the control flow graph.
|
||||||
@@ -374,15 +381,8 @@ where
|
|||||||
// For each undef var we look up values in the predecessors and create an Ebb argument
|
// For each undef var we look up values in the predecessors and create an Ebb argument
|
||||||
// only if necessary.
|
// only if necessary.
|
||||||
for (var, val) in undef_vars {
|
for (var, val) in undef_vars {
|
||||||
let (_, mut local_side_effects) =
|
let (_, local_side_effects) = self.predecessors_lookup(dfg, layout, jts, val, var, ebb);
|
||||||
self.predecessors_lookup(dfg, layout, jts, val, var, ebb);
|
side_effects.append(local_side_effects);
|
||||||
side_effects.split_ebbs_created.append(
|
|
||||||
&mut local_side_effects
|
|
||||||
.split_ebbs_created,
|
|
||||||
);
|
|
||||||
side_effects.instructions_added_to_ebbs.append(
|
|
||||||
&mut local_side_effects.instructions_added_to_ebbs,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then we mark the block as sealed.
|
// Then we mark the block as sealed.
|
||||||
@@ -421,7 +421,7 @@ where
|
|||||||
for &(pred, last_inst) in &preds {
|
for &(pred, last_inst) in &preds {
|
||||||
// For each predecessor, we query what is the local SSA value corresponding
|
// For each predecessor, we query what is the local SSA value corresponding
|
||||||
// to var and we put it as an argument of the branch instruction.
|
// to var and we put it as an argument of the branch instruction.
|
||||||
let (pred_val, mut local_side_effects) =
|
let (pred_val, local_side_effects) =
|
||||||
self.use_var(dfg, layout, jts, temp_arg_var, ty, pred);
|
self.use_var(dfg, layout, jts, temp_arg_var, ty, pred);
|
||||||
match pred_values {
|
match pred_values {
|
||||||
ZeroOneOrMore::Zero() => {
|
ZeroOneOrMore::Zero() => {
|
||||||
@@ -442,13 +442,7 @@ where
|
|||||||
jump_args_to_append.push((pred, last_inst, pred_val));
|
jump_args_to_append.push((pred, last_inst, pred_val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
side_effects.split_ebbs_created.append(
|
side_effects.append(local_side_effects);
|
||||||
&mut local_side_effects
|
|
||||||
.split_ebbs_created,
|
|
||||||
);
|
|
||||||
side_effects.instructions_added_to_ebbs.append(
|
|
||||||
&mut local_side_effects.instructions_added_to_ebbs,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// Now that we're done iterating, move the predecessors list back.
|
// Now that we're done iterating, move the predecessors list back.
|
||||||
debug_assert!(self.predecessors(dest_ebb).is_empty());
|
debug_assert!(self.predecessors(dest_ebb).is_empty());
|
||||||
|
|||||||
Reference in New Issue
Block a user