[][src]Struct regalloc::Writable

pub struct Writable<R: Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Ord + Debug> { /* fields omitted */ }

A "writable register". This is a zero-cost wrapper that can be used to create a distinction, at the Rust type level, between a plain "register" and a "writable register".

There is nothing that ensures that Writable<..> is only wrapped around Reg and its variants (RealReg, VirtualReg). That however is its intended and currently its only use.

Writable<..> can be used by the client to ensure that, internally, it only generates instructions that write to registers that should be written. The InstRegUses below, which must be implemented for every instruction, requires a Writable<Reg> (not just Reg) in its defined and modified sets. While we cannot hide the constructor for Writable<..> from certain parts of the client while exposing it to others, the client can adopt conventions to e.g. only ever call the Writable<..> constructor from its central vreg-management logic, and decide that any invocation of this constructor in a machine backend (for example) is an error.

Methods

impl<R: Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Ord + Debug> Writable<R>[src]

pub fn from_reg(reg: R) -> Writable<R>[src]

Create a Writable from an R. The client should carefully audit where it calls this constructor to ensure correctness (see Writable<..> struct documentation).

pub fn to_reg(&self) -> R[src]

Get the inner Reg.

pub fn map<F, U>(&self, f: F) -> Writable<U> where
    F: Fn(R) -> U,
    U: Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Ord + Debug
[src]

Trait Implementations

impl<R: Clone + Copy + PartialEq + Eq + Hash + PartialOrd + Ord + Debug> Clone for Writable<R>[src]

impl<R: Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Ord + Debug> Copy for Writable<R>[src]

impl<R: Debug + Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Ord> Debug for Writable<R>[src]

impl<R: Eq + Copy + Clone + PartialEq + Hash + PartialOrd + Ord + Debug> Eq for Writable<R>[src]

impl<R: Hash + Copy + Clone + PartialEq + Eq + PartialOrd + Ord + Debug> Hash for Writable<R>[src]

impl<R: Ord + Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Debug> Ord for Writable<R>[src]

impl<R: PartialEq + Copy + Clone + Eq + Hash + PartialOrd + Ord + Debug> PartialEq<Writable<R>> for Writable<R>[src]

impl<R: PartialOrd + Copy + Clone + PartialEq + Eq + Hash + Ord + Debug> PartialOrd<Writable<R>> for Writable<R>[src]

impl<R: Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Ord + Debug> StructuralEq for Writable<R>[src]

impl<R: Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Ord + Debug> StructuralPartialEq for Writable<R>[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for Writable<R> where
    R: RefUnwindSafe

impl<R> Send for Writable<R> where
    R: Send

impl<R> Sync for Writable<R> where
    R: Sync

impl<R> Unpin for Writable<R> where
    R: Unpin

impl<R> UnwindSafe for Writable<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.