fn new_node(
        &mut self,
        reg_id: MuID,
        ty: NodeType,
        loop_depth: usize,
        context: &FunctionContext
    ) -> MuID {
        let entry = context.get_value(reg_id).unwrap();

        // if it is the first time, create the node
        if !self.nodes.contains_key(&reg_id) {
            let node = Node {
                temp: reg_id,
                color: None,
                group: backend::RegGroup::get_from_ty(entry.ty()),
                spill_cost: 0.0f32,
                freeze_cost: 0f32
            };

            self.nodes.insert(reg_id, node);
            self.adj_list.insert(reg_id, LinkedHashSet::new());
            self.degree.insert(reg_id, 0);
        }

        // get node
        let node_mut = self.nodes.get_mut(&reg_id).unwrap();
        // increase node spill cost
        node_mut.spill_cost += InterferenceGraph::spillcost_heuristic(ty, loop_depth);

        reg_id
    }
/// creates a new node for a temp (if we already created a temp for the temp, returns the node)
/// This function will increase spill cost for the node by 1 each tiem it is called for the temp
creates a new node for a temp (if we already created a temp for the temp, returns the node)
This function will increase spill cost for the node by 1 each tiem it is called for the temp
creates a new node for a temp ( if we already created a temp for the temp returns the node ) This function will increase spill cost for the node by 1 each tiem it is called for the temp
fn new_node(
        &mut self,
        reg_id: MuID,
        ty: NodeType,
        loop_depth: usize,
        context: &FunctionContext
    ) -> MuID {
        let entry = context.get_value(reg_id).unwrap();
        // if it is the first time, create the node
        if !self.nodes.contains_key(&reg_id) {
            let node = Node {
                temp: reg_id,
                color: None,
                group: backend::RegGroup::get_from_ty(entry.ty()),
                spill_cost: 0.0f32,
                freeze_cost: 0f32
            };
            self.nodes.insert(reg_id, node);
            self.adj_list.insert(reg_id, LinkedHashSet::new());
            self.degree.insert(reg_id, 0);
        }
        // get node
        let node_mut = self.nodes.get_mut(&reg_id).unwrap();
        // increase node spill cost
        node_mut.spill_cost += InterferenceGraph::spillcost_heuristic(ty, loop_depth);
        reg_id
    }
fn new_node ( & mut self , reg_id : MuID , ty : NodeType , loop_depth : usize , context : & FunctionContext ) -> MuID { let entry = context . get_value ( reg_id ) . unwrap ( ) ; // if it is the first time, create the node if ! self . nodes . contains_key ( & reg_id ) { let node = Node { temp : reg_id , color : None , group : backend :: RegGroup :: get_from_ty ( entry . ty ( ) ) , spill_cost : 0.0f32 , freeze_cost : 0f32 } ; self . nodes . insert ( reg_id , node ) ; self . adj_list . insert ( reg_id , LinkedHashSet :: new ( ) ) ; self . degree . insert ( reg_id , 0 ) ; } // get node let node_mut = self . nodes . get_mut ( & reg_id ) . unwrap ( ) ; // increase node spill cost node_mut . spill_cost += InterferenceGraph :: spillcost_heuristic ( ty , loop_depth ) ; reg_id }
creates a new node for a temp (if we already created a temp for the temp, returns the node)
This function will increase spill cost for the node by 1 each tiem it is called for the temp
creates a new node for a temp ( if we already created a temp for the temp returns the node ) This function will increase spill cost for the node by 1 each tiem it is called for the temp
&mut self
reg_id
MuID
ty
NodeType
loop_depth
usize
context
&FunctionContext
&mut self
reg_id
MuID
ty
NodeType
loop_depth
usize
context
&FunctionContext