pub struct Live { /* private fields */ }Expand description
What is live where.
Implementations§
Source§impl Live
impl Live
Sourcepub fn of(func: &Func, order: &Order) -> Self
pub fn of(func: &Func, order: &Order) -> Self
Works it out for a function laid out in that order.
Sourcepub fn range(&self, reg: Reg) -> Option<Range>
pub fn range(&self, reg: Reg) -> Option<Range>
Where a virtual register is live, or None for one this function never mentions and for
a physical register.
Sourcepub fn live_in(&self, block: Block) -> impl Iterator<Item = Reg> + '_
pub fn live_in(&self, block: Block) -> impl Iterator<Item = Reg> + '_
Every virtual register that arrives in a block already holding a value.
The block’s own parameters are not among them. A parameter is written where it arrives, which makes it a value the block defines rather than one it inherits.
Sourcepub fn live_out(&self, block: Block) -> impl Iterator<Item = Reg> + '_
pub fn live_out(&self, block: Block) -> impl Iterator<Item = Reg> + '_
Every virtual register that is still wanted after a block, which is what its successors and the arguments its terminator carries between them ask for.
Sourcepub fn anywhere_in(&self, reg: Reg, block: Block) -> bool
pub fn anywhere_in(&self, reg: Reg, block: Block) -> bool
Whether a value is live anywhere in a block.
An interval has no holes in it, so a value live in two blocks is treated as live in every block laid out between them, whether or not it reaches them. This answers the question the interval cannot: a value is live somewhere in a block when it arrives live, or leaves live, or is written there, and in no other block.
Which matters wherever the answer decides something rather than describes it. The order the
blocks are in here is the one the function came in, and crate::layout puts them in a
different one afterwards, so a block between two others in this order is not between them in
the code. A call in such a block would otherwise take every register it destroys away from
every value laid out around it, including values whose loop the call is nowhere near.
tamnd/rucc#982.