fn pass_outgoing_args(&mut self, out_locs: &[CCLoc]) {
        // TODO: Do alignment here
        let total_stack_space = out_locs
            .iter()
            .flat_map(|&l| {
                if let CCLoc::Stack(offset) = l {
                    if offset > 0 {
                        Some(offset as u32)
                    } else {
                        None
                    }
                } else {
                    None
                }
            })
            .max()
            .unwrap_or(0);
        let mut depth = self.block_state.depth.0 + total_stack_space;

        if depth & 1 != 0 {
            self.set_stack_depth(StackDepth(self.block_state.depth.0 + 1));
            depth += 1;
        }

        let mut pending = Vec::<(ValueLocation, CCLoc)>::with_capacity(out_locs.len());

        for &loc in out_locs.iter().rev() {
            let val = self.pop();

            pending.push((val, loc));
        }

        while !pending.is_empty() {
            let start_len = pending.len();

            for (src, dst) in mem::replace(&mut pending, vec![]) {
                if src != ValueLocation::from(dst) {
                    if let CCLoc::Reg(r) = dst {
                        if !self.block_state.regs.is_free(r) {
                            pending.push((src, dst));
                            continue;
                        }

                        self.block_state.regs.mark_used(r);
                    }

                    self.copy_value(src, dst);
                    self.free_value(src);
                }
            }

            if pending.len() == start_len {
                let src = *pending
                    .iter()
                    .filter_map(|(src, _)| {
                        if let ValueLocation::Reg(reg) = src {
                            Some(reg)
                        } else {
                            None
                        }
                    })
                    .next()
                    .expect(
                        "Programmer error: We shouldn't need to push \
                         intermediate args if we don't have any argument sources in registers",
                    );
                let new_src = self.push_physical(ValueLocation::Reg(src));
                for (old_src, _) in pending.iter_mut() {
                    if *old_src == ValueLocation::Reg(src) {
                        *old_src = new_src;
                    }
                }
            }
        }

        self.set_stack_depth(StackDepth(depth));
    }
/// Write the arguments to the callee to the registers and the stack using the SystemV
/// calling convention.
Write the arguments to the callee to the registers and the stack using the SystemV
calling convention.
Write the arguments to the callee to the registers and the stack using the SystemV calling convention .
fn pass_outgoing_args(&mut self, out_locs: &[CCLoc]) {
        // TODO: Do alignment here
        let total_stack_space = out_locs
            .iter()
            .flat_map(|&l| {
                if let CCLoc::Stack(offset) = l {
                    if offset > 0 {
                        Some(offset as u32)
                    } else {
                        None
                    }
                } else {
                    None
                }
            })
            .max()
            .unwrap_or(0);
        let mut depth = self.block_state.depth.0 + total_stack_space;
        if depth & 1 != 0 {
            self.set_stack_depth(StackDepth(self.block_state.depth.0 + 1));
            depth += 1;
        }
        let mut pending = Vec::<(ValueLocation, CCLoc)>::with_capacity(out_locs.len());
        for &loc in out_locs.iter().rev() {
            let val = self.pop();
            pending.push((val, loc));
        }
        while !pending.is_empty() {
            let start_len = pending.len();
            for (src, dst) in mem::replace(&mut pending, vec![]) {
                if src != ValueLocation::from(dst) {
                    if let CCLoc::Reg(r) = dst {
                        if !self.block_state.regs.is_free(r) {
                            pending.push((src, dst));
                            continue;
                        }
                        self.block_state.regs.mark_used(r);
                    }
                    self.copy_value(src, dst);
                    self.free_value(src);
                }
            }
            if pending.len() == start_len {
                let src = *pending
                    .iter()
                    .filter_map(|(src, _)| {
                        if let ValueLocation::Reg(reg) = src {
                            Some(reg)
                        } else {
                            None
                        }
                    })
                    .next()
                    .expect(
                        "Programmer error: We shouldn't need to push \
                         intermediate args if we don't have any argument sources in registers",
                    );
                let new_src = self.push_physical(ValueLocation::Reg(src));
                for (old_src, _) in pending.iter_mut() {
                    if *old_src == ValueLocation::Reg(src) {
                        *old_src = new_src;
                    }
                }
            }
        }
        self.set_stack_depth(StackDepth(depth));
    }
fn pass_outgoing_args ( & mut self , out_locs : & [ CCLoc ] ) { // TODO: Do alignment here let total_stack_space = out_locs . iter ( ) . flat_map ( | & l | { if let CCLoc :: Stack ( offset ) = l { if offset > 0 { Some ( offset as u32 ) } else { None } } else { None } } ) . max ( ) . unwrap_or ( 0 ) ; let mut depth = self . block_state . depth . 0 + total_stack_space ; if depth & 1 != 0 { self . set_stack_depth ( StackDepth ( self . block_state . depth . 0 + 1 ) ) ; depth += 1 ; } let mut pending = Vec :: < ( ValueLocation , CCLoc ) > :: with_capacity ( out_locs . len ( ) ) ; for & loc in out_locs . iter ( ) . rev ( ) { let val = self . pop ( ) ; pending . push ( ( val , loc ) ) ; } while ! pending . is_empty ( ) { let start_len = pending . len ( ) ; for ( src , dst ) in mem :: replace ( & mut pending , vec ! [ ] ) { if src != ValueLocation :: from ( dst ) { if let CCLoc :: Reg ( r ) = dst { if ! self . block_state . regs . is_free ( r ) { pending . push ( ( src , dst ) ) ; continue ; } self . block_state . regs . mark_used ( r ) ; } self . copy_value ( src , dst ) ; self . free_value ( src ) ; } } if pending . len ( ) == start_len { let src = * pending . iter ( ) . filter_map ( | ( src , _ ) | { if let ValueLocation :: Reg ( reg ) = src { Some ( reg ) } else { None } } ) . next ( ) . expect ( " \
 " , ) ; let new_src = self . push_physical ( ValueLocation :: Reg ( src ) ) ; for ( old_src , _ ) in pending . iter_mut ( ) { if * old_src == ValueLocation :: Reg ( src ) { * old_src = new_src ; } } } } self . set_stack_depth ( StackDepth ( depth ) ) ; }
Write the arguments to the callee to the registers and the stack using the SystemV
calling convention.
Write the arguments to the callee to the registers and the stack using the SystemV calling convention .
&mut self
out_locs
&[CCLoc]