Add a liveness verifier.
The liveness verifier will check that the live ranges are consistent with the function. It runs as part of the register allocation pipeline when enable_verifier is set. The initial implementation checks the live ranges, but not the ISA-specific constraints and affinities.
This commit is contained in:
@@ -174,12 +174,12 @@ pub struct LiveRange {
|
||||
/// for contiguous EBBs where all but the last live-in interval covers the whole EBB.
|
||||
///
|
||||
#[derive(Copy, Clone)]
|
||||
struct Interval {
|
||||
pub struct Interval {
|
||||
/// Interval starting point.
|
||||
///
|
||||
/// Since this interval does not represent the def of the value, it must begin at an EBB header
|
||||
/// where the value is live-in.
|
||||
begin: Ebb,
|
||||
pub begin: Ebb,
|
||||
|
||||
/// Interval end point.
|
||||
///
|
||||
@@ -190,7 +190,7 @@ struct Interval {
|
||||
/// When this represents multiple contiguous live-in intervals, this is the end point of the
|
||||
/// last interval. The other intervals end at the terminator instructions of their respective
|
||||
/// EBB.
|
||||
end: Inst,
|
||||
pub end: Inst,
|
||||
}
|
||||
|
||||
impl Interval {
|
||||
@@ -368,6 +368,11 @@ impl LiveRange {
|
||||
.ok()
|
||||
.map(|n| self.liveins[n].end)
|
||||
}
|
||||
|
||||
/// Get all the live-in intervals.
|
||||
pub fn liveins(&self) -> &[Interval] {
|
||||
&self.liveins
|
||||
}
|
||||
}
|
||||
|
||||
/// Allow a `LiveRange` to be stored in a `SparseMap` indexed by values.
|
||||
|
||||
Reference in New Issue
Block a user