pub struct InterferenceGraph {
pub edges: HashMap<LcnfVarId, HashSet<LcnfVarId>>,
pub nodes: HashSet<LcnfVarId>,
pub move_pairs: Vec<(LcnfVarId, LcnfVarId)>,
}Expand description
An undirected interference graph for register allocation.
Nodes are virtual registers; an edge (u, v) means u and v have overlapping live ranges and therefore cannot share a physical register.
Fields§
§edges: HashMap<LcnfVarId, HashSet<LcnfVarId>>Adjacency lists.
nodes: HashSet<LcnfVarId>All nodes (vregs) in the graph.
move_pairs: Vec<(LcnfVarId, LcnfVarId)>Move-related pairs: pairs of vregs connected by copy instructions that are candidates for coalescing.
Implementations§
Source§impl InterferenceGraph
impl InterferenceGraph
Sourcepub fn add_edge(&mut self, u: LcnfVarId, v: LcnfVarId)
pub fn add_edge(&mut self, u: LcnfVarId, v: LcnfVarId)
Add an interference edge between u and v.
Sourcepub fn interferes(&self, u: LcnfVarId, v: LcnfVarId) -> bool
pub fn interferes(&self, u: LcnfVarId, v: LcnfVarId) -> bool
Returns true if u and v interfere.
Sourcepub fn remove_node(&mut self, vreg: LcnfVarId)
pub fn remove_node(&mut self, vreg: LcnfVarId)
Remove a node and all its edges.
Sourcepub fn add_move_pair(&mut self, u: LcnfVarId, v: LcnfVarId)
pub fn add_move_pair(&mut self, u: LcnfVarId, v: LcnfVarId)
Record a move-related pair (candidate for coalescing).
Sourcepub fn build_from_intervals(intervals: &[LiveInterval]) -> Self
pub fn build_from_intervals(intervals: &[LiveInterval]) -> Self
Build an interference graph from a set of live intervals.
Trait Implementations§
Source§impl Clone for InterferenceGraph
impl Clone for InterferenceGraph
Source§fn clone(&self) -> InterferenceGraph
fn clone(&self) -> InterferenceGraph
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 InterferenceGraph
impl Debug for InterferenceGraph
Source§impl Default for InterferenceGraph
impl Default for InterferenceGraph
Source§fn default() -> InterferenceGraph
fn default() -> InterferenceGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InterferenceGraph
impl RefUnwindSafe for InterferenceGraph
impl Send for InterferenceGraph
impl Sync for InterferenceGraph
impl Unpin for InterferenceGraph
impl UnsafeUnpin for InterferenceGraph
impl UnwindSafe for InterferenceGraph
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