pub struct Area<'a> { /* private fields */ }Expand description
Everywhere one value is live, which is one or more pieces and at most one more point in front of the piece that follows it.
That one extra point is the only thing about a live area anybody adjusts. A value a two address instruction writes into a register it read is really live from where that instruction reads its operands, which is one point in front of where it is written, and both the allocator and the checker add that point before asking anything. It is one point rather than a new start because a value can be live in several pieces and the one to stretch is the piece the instruction writes, which is not always the first. Reading an area this way only ever makes it bigger, so it is still an area and every answer below still holds of it.
Implementations§
Source§impl<'a> Area<'a>
impl<'a> Area<'a>
Sourcepub fn with(self, point: Point) -> Self
pub fn with(self, point: Point) -> Self
The same area with one more point in it, joined to the piece that starts just after it.
A point already inside a piece changes nothing, which is what a value a loop carries round looks like: it is live on the way into the instruction that writes it anyway.
Sourcepub fn hull(self) -> Range
pub fn hull(self) -> Range
The interval around the whole area, holes and all, which is what a sweep in the order values start reads.
Sourcepub fn overlaps(self, other: Self) -> bool
pub fn overlaps(self, other: Self) -> bool
Whether two values are both live somewhere, which is what stops them sharing a register.
Both lists are in order and neither is long, so this walks them together and stops at the first pair that touches rather than comparing every piece with every other.