pub struct Writable<R: WritableBase> { /* private fields */ }
Expand description
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”.
Only structs that implement the WritableBase
trait can be wrapped with
Writable
. These are the Reg, RealReg and VirtualReg data structures only,
since WritableBase
is not exposed to end users.
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.
Implementations
sourceimpl<R: WritableBase> Writable<R>
impl<R: WritableBase> Writable<R>
Trait Implementations
sourceimpl<R: Ord + WritableBase> Ord for Writable<R>
impl<R: Ord + WritableBase> Ord for Writable<R>
sourceimpl<R: PartialOrd + WritableBase> PartialOrd<Writable<R>> for Writable<R>
impl<R: PartialOrd + WritableBase> PartialOrd<Writable<R>> for Writable<R>
sourcefn partial_cmp(&self, other: &Writable<R>) -> Option<Ordering>
fn partial_cmp(&self, other: &Writable<R>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<R: PrettyPrint + WritableBase> PrettyPrint for Writable<R>
impl<R: PrettyPrint + WritableBase> PrettyPrint for Writable<R>
sourceimpl<R: PrettyPrintSized + WritableBase> PrettyPrintSized for Writable<R>
impl<R: PrettyPrintSized + WritableBase> PrettyPrintSized for Writable<R>
sourcefn show_rru_sized(
&self,
maybe_reg_universe: Option<&RealRegUniverse>,
size: u8
) -> String
fn show_rru_sized(
&self,
maybe_reg_universe: Option<&RealRegUniverse>,
size: u8
) -> String
The same as |show_rru|, but with an optional hint giving a size in bytes. Its interpretation is object-dependent, and it is intended to pass around enough information to facilitate printing sub-parts of real registers correctly. Objects may ignore size hints that are irrelevant to them. Read more
impl<R: Copy + WritableBase> Copy for Writable<R>
impl<R: Eq + WritableBase> Eq for Writable<R>
impl<R: WritableBase> StructuralEq for Writable<R>
impl<R: WritableBase> StructuralPartialEq for Writable<R>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more