pub struct GraphColorAllocator;Expand description
Greedy graph-coloring register allocator (interference graph from live intervals).
Intervals that overlap cannot share a register. Nodes are colored in descending
weight, then descending interference degree to reduce spill pressure.
When no color is available among available_regs, the interval is spilled using the
same slot layout as LinearScanAllocator::allocate.
Implementations§
Source§impl GraphColorAllocator
impl GraphColorAllocator
Sourcepub fn allocate<R: Copy + Eq + Hash>(
intervals: &[LiveInterval],
available_regs: &[R],
) -> HashMap<VirtualReg, Allocation<R>>
pub fn allocate<R: Copy + Eq + Hash>( intervals: &[LiveInterval], available_regs: &[R], ) -> HashMap<VirtualReg, Allocation<R>>
Color intervals using at most available_regs.len() registers.
intervals may be in any order; internally sorted by weight and interference degree.
Sourcepub fn allocate_with_constraints<R: Copy + Eq + Hash>(
intervals: &[LiveInterval],
available_regs: &[R],
allowed: impl Fn(&LiveInterval, R) -> bool,
) -> HashMap<VirtualReg, Allocation<R>>
pub fn allocate_with_constraints<R: Copy + Eq + Hash>( intervals: &[LiveInterval], available_regs: &[R], allowed: impl Fn(&LiveInterval, R) -> bool, ) -> HashMap<VirtualReg, Allocation<R>>
Color intervals using registers permitted by target constraints.
Auto Trait Implementations§
impl Freeze for GraphColorAllocator
impl RefUnwindSafe for GraphColorAllocator
impl Send for GraphColorAllocator
impl Sync for GraphColorAllocator
impl Unpin for GraphColorAllocator
impl UnsafeUnpin for GraphColorAllocator
impl UnwindSafe for GraphColorAllocator
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