pub struct RegAllocPass {
pub phys_regs: Vec<PhysReg>,
pub use_graph_coloring: bool,
pub allocations: HashMap<String, Allocation>,
/* private fields */
}Expand description
Register allocation pass.
Supports both linear scan and graph coloring algorithms.
Fields§
§phys_regs: Vec<PhysReg>Physical register bank.
use_graph_coloring: boolWhether to use graph coloring (Chaitin-Briggs) instead of linear scan.
allocations: HashMap<String, Allocation>Allocation results per function (function name → allocation).
Implementations§
Source§impl RegAllocPass
impl RegAllocPass
Sourcepub fn new(num_regs: u32) -> Self
pub fn new(num_regs: u32) -> Self
Create a new pass with num_regs integer registers using linear scan.
Sourcepub fn graph_coloring(num_regs: u32) -> Self
pub fn graph_coloring(num_regs: u32) -> Self
Create a pass that uses Chaitin-Briggs graph coloring.
Sourcepub fn with_regs(phys_regs: Vec<PhysReg>, use_graph_coloring: bool) -> Self
pub fn with_regs(phys_regs: Vec<PhysReg>, use_graph_coloring: bool) -> Self
Create a pass with an explicit physical register set.
Sourcepub fn run(&mut self, decls: &mut [LcnfFunDecl])
pub fn run(&mut self, decls: &mut [LcnfFunDecl])
Run register allocation on all function declarations.
Sourcepub fn report(&self) -> RegAllocReport
pub fn report(&self) -> RegAllocReport
Return the accumulated allocation report.
Sourcepub fn allocation_for(&self, func: &str) -> Option<&Allocation>
pub fn allocation_for(&self, func: &str) -> Option<&Allocation>
Lookup the allocation for a function by name.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RegAllocPass
impl RefUnwindSafe for RegAllocPass
impl Send for RegAllocPass
impl Sync for RegAllocPass
impl Unpin for RegAllocPass
impl UnsafeUnpin for RegAllocPass
impl UnwindSafe for RegAllocPass
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