pub fn add_edge(&mut self, u: MuID, v: MuID) {
        // if one of the node is machine register, we add
        // interference edge to its alias
        // e.g. if we have %a - %edi interfered,
        // we will add %a - %rdi interference

        let u = if is_precolored(u) {
            if is_usable(u) {
                backend::get_color_for_precolored(u)
            } else {
                // if it is not usable, we do not need to add an interference edge
                return;
            }
        } else {
            u
        };
        let v = if is_precolored(v) {
            if is_usable(v) {
                backend::get_color_for_precolored(v)
            } else {
                return;
            }
        } else {
            v
        };

        if !self.adj_set.contains(&(u, v)) && u != v {
            trace!("  add edge ({}, {})", u, v);

            self.adj_set.insert((u, v));
            self.adj_set.insert((v, u));

            if !is_precolored(u) {
                self.adj_list.get_mut(&u).unwrap().insert(v);
                let degree = self.get_degree_of(u);
                self.set_degree_of(u, degree + 1);
                trace!("    increase degree of {} to {}", u, degree + 1);
            }
            if !is_precolored(v) {
                self.adj_list.get_mut(&v).unwrap().insert(u);
                let degree = self.get_degree_of(v);
                self.set_degree_of(v, degree + 1);
                trace!("    increase degree of {} to {}", v, degree + 1);
            }
        }
    }
/// adds an interference edge between two nodes
adds an interference edge between two nodes
adds an interference edge between two nodes
pub fn add_edge(&mut self, u: MuID, v: MuID) {
        // if one of the node is machine register, we add
        // interference edge to its alias
        // e.g. if we have %a - %edi interfered,
        // we will add %a - %rdi interference
        let u = if is_precolored(u) {
            if is_usable(u) {
                backend::get_color_for_precolored(u)
            } else {
                // if it is not usable, we do not need to add an interference edge
                return;
            }
        } else {
            u
        };
        let v = if is_precolored(v) {
            if is_usable(v) {
                backend::get_color_for_precolored(v)
            } else {
                return;
            }
        } else {
            v
        };
        if !self.adj_set.contains(&(u, v)) && u != v {
            trace!("  add edge ({}, {})", u, v);
            self.adj_set.insert((u, v));
            self.adj_set.insert((v, u));
            if !is_precolored(u) {
                self.adj_list.get_mut(&u).unwrap().insert(v);
                let degree = self.get_degree_of(u);
                self.set_degree_of(u, degree + 1);
                trace!("    increase degree of {} to {}", u, degree + 1);
            }
            if !is_precolored(v) {
                self.adj_list.get_mut(&v).unwrap().insert(u);
                let degree = self.get_degree_of(v);
                self.set_degree_of(v, degree + 1);
                trace!("    increase degree of {} to {}", v, degree + 1);
            }
        }
    }
pub fn add_edge ( & mut self , u : MuID , v : MuID ) { // if one of the node is machine register, we add // interference edge to its alias // e.g. if we have %a - %edi interfered, // we will add %a - %rdi interference let u = if is_precolored ( u ) { if is_usable ( u ) { backend :: get_color_for_precolored ( u ) } else { // if it is not usable, we do not need to add an interference edge return ; } } else { u } ; let v = if is_precolored ( v ) { if is_usable ( v ) { backend :: get_color_for_precolored ( v ) } else { return ; } } else { v } ; if ! self . adj_set . contains ( & ( u , v ) ) && u != v { trace ! ( " " u v ) ; self . adj_set . insert ( ( u , v ) ) ; self . adj_set . insert ( ( v , u ) ) ; if ! is_precolored ( u ) { self . adj_list . get_mut ( & u ) . unwrap ( ) . insert ( v ) ; let degree = self . get_degree_of ( u ) ; self . set_degree_of ( u , degree + 1 ) ; trace ! ( " " u degree 1 ) ; } if ! is_precolored ( v ) { self . adj_list . get_mut ( & v ) . unwrap ( ) . insert ( u ) ; let degree = self . get_degree_of ( v ) ; self . set_degree_of ( v , degree + 1 ) ; trace ! ( " " v degree 1 ) ; } } }
adds an interference edge between two nodes
adds an interference edge between two nodes
&mut self
u
MuID
v
MuID
&mut self
u
MuID
v
MuID