Regalloc: remove the transient LiveRangeContext data structure;

This commit is contained in:
Benjamin Bouvier
2019-09-12 19:32:43 +02:00
parent b9b1c842e9
commit 5beb10e77a
10 changed files with 108 additions and 143 deletions

View File

@@ -199,7 +199,8 @@ impl<'a> Context<'a> {
if self.liveness[param].reaches_use(
pred_inst,
pred_ebb,
self.liveness.context(&self.func.layout),
self.liveness.forest(),
&self.func.layout,
) {
self.isolate_param(ebb, param);
}
@@ -240,7 +241,6 @@ impl<'a> Context<'a> {
// `ebb`, it can never be used as an EBB argument.
let interference = {
let lr = &self.liveness[arg];
let ctx = self.liveness.context(&self.func.layout);
// There are two ways the argument value can interfere with `ebb`:
//
@@ -255,7 +255,7 @@ impl<'a> Context<'a> {
);
// The only other possibility is that `arg` is live-in to `ebb`.
lr.is_livein(ebb, ctx)
lr.is_livein(ebb, self.liveness.forest(), &self.func.layout)
};
if interference {
@@ -435,8 +435,12 @@ impl<'a> Context<'a> {
// Check for interference between `parent` and `value`. Since `parent` dominates
// `value`, we only have to check if it overlaps the definition.
let ctx = self.liveness.context(&self.func.layout);
if self.liveness[parent.value].overlaps_def(node.def, node.ebb, ctx) {
if self.liveness[parent.value].overlaps_def(
node.def,
node.ebb,
self.liveness.forest(),
&self.func.layout,
) {
// The two values are interfering, so they can't be in the same virtual register.
debug!("-> interference: {} overlaps def of {}", parent, value);
return false;
@@ -593,7 +597,6 @@ impl<'a> Context<'a> {
// This gives us the closest dominating value def for each of the values.
self.forest.clear();
self.values.clear();
let ctx = self.liveness.context(&self.func.layout);
for node in nodes {
// Accumulate ordered values for the new vreg.
if node.is_value() {
@@ -623,7 +626,12 @@ impl<'a> Context<'a> {
// Check if the parent value interferes with the virtual copy.
let inst = node.def.unwrap_inst();
if node.set_id != parent.set_id
&& self.liveness[parent.value].reaches_use(inst, node.ebb, ctx)
&& self.liveness[parent.value].reaches_use(
inst,
node.ebb,
self.liveness.forest(),
&self.func.layout,
)
{
debug!(
" - interference: {} overlaps vcopy at {}:{}",
@@ -647,7 +655,12 @@ impl<'a> Context<'a> {
// Both node and parent are values, so check for interference.
debug_assert!(node.is_value() && parent.is_value());
if node.set_id != parent.set_id
&& self.liveness[parent.value].overlaps_def(node.def, node.ebb, ctx)
&& self.liveness[parent.value].overlaps_def(
node.def,
node.ebb,
self.liveness.forest(),
&self.func.layout,
)
{
// The two values are interfering.
debug!(" - interference: {} overlaps def of {}", parent, node.value);