Skip to main content

Changes

Struct Changes 

Source
pub struct Changes { /* private fields */ }
Expand description

A set of changes to one function, proposed together and taken together.

The order proposals are added in is the order they are applied in, which matters only for the reading of a commit that both rewrites and removes: nothing here depends on it, since a plan says what an instruction becomes rather than what to do to what it is.

Implementations§

Source§

impl Changes

Source

pub fn new() -> Self

A set with nothing in it.

Source

pub fn len(&self) -> usize

How many changes the set is about, counting the edges along with the instructions.

Source

pub fn is_empty(&self) -> bool

Whether the set is about nothing, which commits and changes nothing.

Source

pub fn rewrite(&mut self, inst: Inst, plan: Plan)

Proposes that the instruction become that.

Source

pub fn rename(&mut self, inst: Inst, from: Reg, into: Reg)

Proposes that the instruction read the second register wherever it reads the first.

Only where it reads it. What an instruction writes is what the rest of the function knows it by, and changing that is a different proposal from this one.

Source

pub fn carry(&mut self, from: Block, at: usize, args: Vec<Reg>)

Proposes that the edge leaving that block carry those registers.

Which edge is its position in the block’s own list of them, which is what mir::Func::succs_mut hands back and what the terminator’s conditions are written against.

Source

pub fn remove(&mut self, inst: Inst)

Proposes that the instruction go.

Source

pub fn refused( &self, func: &Func, reads: &Reads, names: &Interner, machine: &MachineInsts, ) -> Option<Refusal>

Why the set would not be taken, or None if it would.

Asked of the function as it stands and of the target’s description of itself. Nothing here changes anything, so a pass may ask, decide the answer is not worth having, and drop the set.

Source

pub fn commit( self, func: &mut Func, reads: &mut Reads, names: &Interner, machine: &MachineInsts, ) -> Result<usize, Refusal>

Takes the set if the target and the function will have it, and gives back how many changes it made.

§Errors

The first Refusal the set earns, with nothing written. A refused set leaves the function exactly as it was.

Trait Implementations§

Source§

impl Clone for Changes

Source§

fn clone(&self) -> Changes

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 Debug for Changes

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Changes

Source§

fn default() -> Changes

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.