Skip to main content

Area

Struct Area 

Source
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>

Source

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.

Source

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.

Source

pub fn covers(self, point: Point) -> bool

Whether the value is live at that point.

Source

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.

Source

pub fn pieces(self) -> impl Iterator<Item = Range> + 'a

The pieces themselves, in order.

Trait Implementations§

Source§

impl<'a> Clone for Area<'a>

Source§

fn clone(&self) -> Area<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Area<'a>

Source§

impl<'a> Debug for Area<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Area<'a>

§

impl<'a> RefUnwindSafe for Area<'a>

§

impl<'a> Send for Area<'a>

§

impl<'a> Sync for Area<'a>

§

impl<'a> Unpin for Area<'a>

§

impl<'a> UnsafeUnpin for Area<'a>

§

impl<'a> UnwindSafe for Area<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.