pub struct WasmRegAlloc { /* private fields */ }Expand description
WASM “register allocator” for stack-based virtual machine.
Implementations§
Source§impl WasmRegAlloc
impl WasmRegAlloc
pub fn new() -> Self
pub fn get_stack_position(&self, vreg: &VirtualReg) -> Option<u32>
pub fn allocate_stack(&mut self, vreg: VirtualReg) -> u32
Trait Implementations§
Source§impl Default for WasmRegAlloc
impl Default for WasmRegAlloc
Source§impl LocalRegisterAllocator for WasmRegAlloc
impl LocalRegisterAllocator for WasmRegAlloc
Source§type PhysReg = WasmStackSlot
type PhysReg = WasmStackSlot
Architecture-specific physical register handle.
Source§fn alloc_scratch(&mut self) -> Option<Self::PhysReg>
fn alloc_scratch(&mut self) -> Option<Self::PhysReg>
Acquire a short-lived scratch register. Returns
None when the dedicated
pool is exhausted so the caller may spill or choose an alternate path.Source§fn free_scratch(&mut self, _phys: Self::PhysReg)
fn free_scratch(&mut self, _phys: Self::PhysReg)
Release a scratch register obtained through
LocalRegisterAllocator::alloc_scratch.Source§fn get_mapping(&self, vreg: &VirtualReg) -> Option<Self::PhysReg>
fn get_mapping(&self, vreg: &VirtualReg) -> Option<Self::PhysReg>
Look up the physical register currently assigned to the virtual
register, when available.
Source§fn ensure_mapping(&mut self, vreg: VirtualReg) -> Option<Self::PhysReg>
fn ensure_mapping(&mut self, vreg: VirtualReg) -> Option<Self::PhysReg>
Ensure that the virtual register has a permanent mapping. Implementers
can reject unsupported register classes by returning
None, signalling
that the caller should spill.Source§fn mapped_for_register(&self, reg: &Register) -> Option<Self::PhysReg>
fn mapped_for_register(&self, reg: &Register) -> Option<Self::PhysReg>
Resolve the backing physical register for an arbitrary MIR register
(virtual or physical).
Source§fn occupy(&mut self, _phys: Self::PhysReg)
fn occupy(&mut self, _phys: Self::PhysReg)
Mark a physical register as occupied, removing it from the allocator’s
free pool if necessary.
Source§fn release(&mut self, _phys: Self::PhysReg)
fn release(&mut self, _phys: Self::PhysReg)
Release a previously occupied physical register back to the pool.
Source§fn is_occupied(&self, _phys: Self::PhysReg) -> bool
fn is_occupied(&self, _phys: Self::PhysReg) -> bool
Test whether the allocator currently treats the physical register as
occupied.
Auto Trait Implementations§
impl Freeze for WasmRegAlloc
impl RefUnwindSafe for WasmRegAlloc
impl Send for WasmRegAlloc
impl Sync for WasmRegAlloc
impl Unpin for WasmRegAlloc
impl UnsafeUnpin for WasmRegAlloc
impl UnwindSafe for WasmRegAlloc
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