pub struct Reg(pub u32);Expand description
A virtual register: a numbered slot that holds one value while a program runs.
The bytecode is register-based rather than stack-based. Every value the source
function defines is given its own register, so an Op names its operands and its
result by register instead of by a position on an operand stack. Registers are dense
from zero; Program::register_count is one past the highest in use. A function’s
parameters occupy the first registers — read them from Program::params.
§Examples
use codegen_lang::Reg;
let r = Reg(2);
assert_eq!(r.0, 2);
assert_eq!(r.to_string(), "r2");Tuple Fields§
§0: u32Trait Implementations§
impl Copy for Reg
Source§impl<'de> Deserialize<'de> for Reg
impl<'de> Deserialize<'de> for Reg
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Reg
Source§impl Ord for Reg
impl Ord for Reg
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Reg
impl PartialOrd for Reg
impl StructuralPartialEq for Reg
Auto Trait Implementations§
impl Freeze for Reg
impl RefUnwindSafe for Reg
impl Send for Reg
impl Sync for Reg
impl Unpin for Reg
impl UnsafeUnpin for Reg
impl UnwindSafe for Reg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more