[−][src]Struct regalloc::Writable
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 WritableWritable<..>
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]
F: Fn(R) -> U,
U: Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Ord + Debug,
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<R: Ord + Copy + Clone + PartialEq + Eq + Hash + PartialOrd + Debug> Ord for Writable<R>
[src]
fn cmp(&self, other: &Writable<R>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[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]
fn partial_cmp(&self, other: &Writable<R>) -> Option<Ordering>
[src]
fn lt(&self, other: &Writable<R>) -> bool
[src]
fn le(&self, other: &Writable<R>) -> bool
[src]
fn gt(&self, other: &Writable<R>) -> bool
[src]
fn ge(&self, other: &Writable<R>) -> bool
[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,
R: RefUnwindSafe,
impl<R> Send for Writable<R> where
R: Send,
R: Send,
impl<R> Sync for Writable<R> where
R: Sync,
R: Sync,
impl<R> Unpin for Writable<R> where
R: Unpin,
R: Unpin,
impl<R> UnwindSafe for Writable<R> where
R: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,