Propagate a few more LiveRange properties to LiveValue.
The live value tracker goes through the trouble of looking up the live range for each value it tracks. We can cache a few more interesting properties from the live range in the LiveValue struct.
This commit is contained in:
@@ -11,6 +11,7 @@ use ir::{Inst, Ebb, Value, DataFlowGraph, ProgramOrder, ExpandedProgramPoint};
|
|||||||
use partition_slice::partition_slice;
|
use partition_slice::partition_slice;
|
||||||
use regalloc::affinity::Affinity;
|
use regalloc::affinity::Affinity;
|
||||||
use regalloc::liveness::Liveness;
|
use regalloc::liveness::Liveness;
|
||||||
|
use regalloc::liverange::LiveRange;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
@@ -45,6 +46,12 @@ pub struct LiveValue {
|
|||||||
/// This value is simply a copy of the affinity stored in the live range. We copy it because
|
/// This value is simply a copy of the affinity stored in the live range. We copy it because
|
||||||
/// almost all users of `LiveValue` need to look at it.
|
/// almost all users of `LiveValue` need to look at it.
|
||||||
pub affinity: Affinity,
|
pub affinity: Affinity,
|
||||||
|
|
||||||
|
/// The live range for this value never leaves its EBB.
|
||||||
|
pub is_local: bool,
|
||||||
|
|
||||||
|
/// This value is dead - the live range ends immediately.
|
||||||
|
pub is_dead: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LiveValueVec {
|
struct LiveValueVec {
|
||||||
@@ -66,13 +73,15 @@ impl LiveValueVec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a new live value to `values`.
|
/// Add a new live value to `values`. Copy some properties from `lr`.
|
||||||
fn push(&mut self, value: Value, endpoint: Inst, affinity: Affinity) {
|
fn push(&mut self, value: Value, endpoint: Inst, lr: &LiveRange) {
|
||||||
self.values
|
self.values
|
||||||
.push(LiveValue {
|
.push(LiveValue {
|
||||||
value,
|
value,
|
||||||
endpoint,
|
endpoint,
|
||||||
affinity,
|
affinity: lr.affinity,
|
||||||
|
is_local: lr.is_local(),
|
||||||
|
is_dead: lr.is_dead(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +184,7 @@ impl LiveValueTracker {
|
|||||||
|
|
||||||
// Check if this value is live-in here.
|
// Check if this value is live-in here.
|
||||||
if let Some(endpoint) = lr.livein_local_end(ebb, program_order) {
|
if let Some(endpoint) = lr.livein_local_end(ebb, program_order) {
|
||||||
self.live.push(value, endpoint, lr.affinity);
|
self.live.push(value, endpoint, lr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,7 +198,7 @@ impl LiveValueTracker {
|
|||||||
assert_eq!(lr.def(), ebb.into());
|
assert_eq!(lr.def(), ebb.into());
|
||||||
match lr.def_local_end().into() {
|
match lr.def_local_end().into() {
|
||||||
ExpandedProgramPoint::Inst(endpoint) => {
|
ExpandedProgramPoint::Inst(endpoint) => {
|
||||||
self.live.push(value, endpoint, lr.affinity);
|
self.live.push(value, endpoint, lr);
|
||||||
}
|
}
|
||||||
ExpandedProgramPoint::Ebb(local_ebb) => {
|
ExpandedProgramPoint::Ebb(local_ebb) => {
|
||||||
// This is a dead EBB argument which is not even live into the first
|
// This is a dead EBB argument which is not even live into the first
|
||||||
@@ -248,7 +257,7 @@ impl LiveValueTracker {
|
|||||||
assert_eq!(lr.def(), inst.into());
|
assert_eq!(lr.def(), inst.into());
|
||||||
match lr.def_local_end().into() {
|
match lr.def_local_end().into() {
|
||||||
ExpandedProgramPoint::Inst(endpoint) => {
|
ExpandedProgramPoint::Inst(endpoint) => {
|
||||||
self.live.push(value, endpoint, lr.affinity);
|
self.live.push(value, endpoint, lr);
|
||||||
}
|
}
|
||||||
ExpandedProgramPoint::Ebb(ebb) => {
|
ExpandedProgramPoint::Ebb(ebb) => {
|
||||||
panic!("Instruction result live range can't end at {}", ebb);
|
panic!("Instruction result live range can't end at {}", ebb);
|
||||||
|
|||||||
Reference in New Issue
Block a user