pub struct Allocation {
pub reg_map: HashMap<LcnfVarId, PhysReg>,
pub spills: Vec<SpillSlot>,
/* private fields */
}Expand description
The result of register allocation.
Fields§
§reg_map: HashMap<LcnfVarId, PhysReg>Maps virtual register IDs to physical registers.
spills: Vec<SpillSlot>Virtual registers that were spilled to the stack.
Implementations§
Source§impl Allocation
impl Allocation
Sourcepub fn assign(&mut self, vreg: LcnfVarId, preg: PhysReg)
pub fn assign(&mut self, vreg: LcnfVarId, preg: PhysReg)
Assign a physical register to a virtual register.
Sourcepub fn spill(&mut self, vreg: LcnfVarId, size: u32) -> SpillSlot
pub fn spill(&mut self, vreg: LcnfVarId, size: u32) -> SpillSlot
Spill a virtual register, returning the slot.
Sourcepub fn lookup(&self, vreg: LcnfVarId) -> Option<&PhysReg>
pub fn lookup(&self, vreg: LcnfVarId) -> Option<&PhysReg>
Look up the physical register for vreg.
Sourcepub fn is_spilled(&self, vreg: LcnfVarId) -> bool
pub fn is_spilled(&self, vreg: LcnfVarId) -> bool
Returns true if vreg was spilled.
Sourcepub fn stack_frame_size(&self) -> u32
pub fn stack_frame_size(&self) -> u32
Total stack frame size needed for spills.
Trait Implementations§
Source§impl Clone for Allocation
impl Clone for Allocation
Source§fn clone(&self) -> Allocation
fn clone(&self) -> Allocation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Allocation
impl Debug for Allocation
Source§impl Default for Allocation
impl Default for Allocation
Source§fn default() -> Allocation
fn default() -> Allocation
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Allocation
impl RefUnwindSafe for Allocation
impl Send for Allocation
impl Sync for Allocation
impl Unpin for Allocation
impl UnsafeUnpin for Allocation
impl UnwindSafe for Allocation
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