fn remove_unnecessary_callee_saved(&mut self, used_callee_saved: Vec<MuID>) -> HashSet<MuID> {
        // we always save rbp
        let rbp = x86_64::RBP.extract_ssa_id().unwrap();

        let find_op_other_than_rbp = |inst: &ASMInst| -> MuID {
            for id in inst.defines.keys() {
                if *id != rbp {
                    return *id;
                }
            }
            for id in inst.uses.keys() {
                if *id != rbp {
                    return *id;
                }
            }
            panic!("Expected to find a used register other than the rbp");
        };

        let mut inst_to_remove = vec![];
        let mut regs_to_remove = HashSet::new();

        for i in 0..self.number_of_insts() {
            let ref inst = self.code[i];
            match inst.spill_info {
                Some(SpillMemInfo::CalleeSaved) => {
                    let reg = find_op_other_than_rbp(inst);
                    if !used_callee_saved.contains(&reg) {
                        trace!(
                            "removing instruction {:?} for save/restore \
                             unnecessary callee saved regs",
                            inst
                        );
                        regs_to_remove.insert(reg);
                        inst_to_remove.push(i);
                    }
                }
                _ => {}
            }
        }

        for i in inst_to_remove {
            self.set_inst_nop(i);
        }

        regs_to_remove
    }
/// remove unnecessary push/pop if the callee saved register is not used
/// returns what registers push/pop have been deleted, and the number of callee saved registers
/// that weren't deleted
remove unnecessary push/pop if the callee saved register is not used
returns what registers push/pop have been deleted, and the number of callee saved registers
that weren't deleted
remove unnecessary push / pop if the callee saved register is not used returns what registers push / pop have been deleted and the number of callee saved registers that weren ' t deleted
fn remove_unnecessary_callee_saved(&mut self, used_callee_saved: Vec<MuID>) -> HashSet<MuID> {
        // we always save rbp
        let rbp = x86_64::RBP.extract_ssa_id().unwrap();
        let find_op_other_than_rbp = |inst: &ASMInst| -> MuID {
            for id in inst.defines.keys() {
                if *id != rbp {
                    return *id;
                }
            }
            for id in inst.uses.keys() {
                if *id != rbp {
                    return *id;
                }
            }
            panic!("Expected to find a used register other than the rbp");
        };
        let mut inst_to_remove = vec![];
        let mut regs_to_remove = HashSet::new();
        for i in 0..self.number_of_insts() {
            let ref inst = self.code[i];
            match inst.spill_info {
                Some(SpillMemInfo::CalleeSaved) => {
                    let reg = find_op_other_than_rbp(inst);
                    if !used_callee_saved.contains(&reg) {
                        trace!(
                            "removing instruction {:?} for save/restore \
                             unnecessary callee saved regs",
                            inst
                        );
                        regs_to_remove.insert(reg);
                        inst_to_remove.push(i);
                    }
                }
                _ => {}
            }
        }
        for i in inst_to_remove {
            self.set_inst_nop(i);
        }
        regs_to_remove
    }
fn remove_unnecessary_callee_saved ( & mut self , used_callee_saved : Vec < MuID > ) -> HashSet < MuID > { // we always save rbp let rbp = x86_64 :: RBP . extract_ssa_id ( ) . unwrap ( ) ; let find_op_other_than_rbp = | inst : & ASMInst | -> MuID { for id in inst . defines . keys ( ) { if * id != rbp { return * id ; } } for id in inst . uses . keys ( ) { if * id != rbp { return * id ; } } panic ! ( " " ) ; } ; let mut inst_to_remove = vec ! [ ] ; let mut regs_to_remove = HashSet :: new ( ) ; for i in 0 .. self . number_of_insts ( ) { let ref inst = self . code [ i ] ; match inst . spill_info { Some ( SpillMemInfo :: CalleeSaved ) => { let reg = find_op_other_than_rbp ( inst ) ; if ! used_callee_saved . contains ( & reg ) { trace ! ( " \
 " inst ) ; regs_to_remove . insert ( reg ) ; inst_to_remove . push ( i ) ; } } _ => { } } } for i in inst_to_remove { self . set_inst_nop ( i ) ; } regs_to_remove }
remove unnecessary push/pop if the callee saved register is not used
returns what registers push/pop have been deleted, and the number of callee saved registers
that weren't deleted
remove unnecessary push / pop if the callee saved register is not used returns what registers push / pop have been deleted and the number of callee saved registers that weren ' t deleted
&mut self
used_callee_saved
Vec<MuID>
&mut self
used_callee_saved
Vec<MuID>