fn extract_bytes(
        &mut self,
        dest: &P<Value>,
        src: &P<Value>,
        offset: i64,
        f_context: &mut FunctionContext,
        vm: &VM
    ) {
        if src.is_mem() {
            let src_loc = match src.v {
                Value_::Memory(ref mem) => {
                    let mem = memory_location_shift(
                        self.backend.as_mut(),
                        mem.clone(),
                        offset,
                        f_context,
                        vm
                    );
                    make_value_from_memory(mem, &dest.ty, vm)
                }
                _ => panic!("Wrong kind of memory value")
            };
            // TODO: what if 'dest is in more than 1 register
            emit_move_value_to_value(self.backend.as_mut(), &dest, &src_loc, f_context, vm);
        } else if is_machine_reg(src) {
            // Repeat this for each 8'bytes of dest

            // Size of each src unit
            let src_size = get_bit_size(&src.ty, vm) as i64;
            let dest_size = get_bit_size(&dest.ty, vm) as i64;

            // How many registers past the first 1 do we need to copy from
            let reg_distance = offset * 8 / src_size;
            let reg_offset = offset * 8 % src_size;

            let src_reg = get_register_from_id(src.id() + 2 * (reg_distance as usize));

            if dest_size + reg_offset > src_size {
                if is_int_ex_reg(dest) {
                    if reg_offset == 0 {
                        let (dest_l, dest_h) = split_int128(dest, f_context, vm);
                        let src_reg_h = get_register_from_id(src_reg.id() + 2);
                        // nothing special needs to be done
                        emit_move_value_to_value(
                            self.backend.as_mut(),
                            &dest_l,
                            &src_reg,
                            f_context,
                            vm
                        );
                        emit_move_value_to_value(
                            self.backend.as_mut(),
                            &dest_h,
                            &src_reg_h,
                            f_context,
                            vm
                        );
                    } else {
                        // This is not possible according the Aaarch64 PCS, since it would involve a
                        // 128-bit integer which starts part way through a register, but a 128-bit
                        // integer must be aligned to 16-bytes, and so must start at the start of an
                        // even register.
                        panic!("A 128-bit integer must start at the start of a register");
                    }
                } else {
                    // We need to copy from multiple registers
                    unimplemented!();
                }
            } else {
                if reg_offset == 0 {
                    // nothing special needs to be done
                    emit_move_value_to_value(self.backend.as_mut(), &dest, &src_reg, f_context, vm);
                } else {
                    let tmp_dest = if is_int_reg(&dest) {
                        dest.clone()
                    } else {
                        make_temporary(f_context, dest.ty.clone(), vm)
                    };

                    if is_int_reg(&src_reg) {
                        // Copy from src_reg, 'dest_size' bits starting at 'reg_offset' and store
                        // in dest (leaving other bits unchanged    )
                        self.backend
                            .emit_bfxil(&tmp_dest, &src_reg, reg_offset as u8, dest_size as u8);
                    } else {
                        // floating point register, need to copy to an int register first
                        self.backend.emit_fmov(&tmp_dest, &src_reg);
                        self.backend
                            .emit_bfxil(&tmp_dest, &tmp_dest, reg_offset as u8, dest_size as u8);
                    }

                    if !(is_int_reg(&dest)) {
                        // A temporary was used, move the value to dest
                        emit_move_value_to_value(
                            self.backend.as_mut(),
                            &dest,
                            &tmp_dest,
                            f_context,
                            vm
                        );
                    }
                }
            }
        } else {
            panic!("This function should only be used to move from a machine register and Memory");
        }
    }
// Copies src+off, to dest src can be a memory location or a machine register
// (in the case of a machine register, sucessivie registers of the same size are considered
// part of src).
// WARNING: It is assumed that dest and src do not overlap
Copies src+off, to dest src can be a memory location or a machine register
(in the case of a machine register, sucessivie registers of the same size are considered
part of src).
WARNING: It is assumed that dest and src do not overlap
Copies src + off to dest src can be a memory location or a machine register ( in the case of a machine register sucessivie registers of the same size are considered part of src ) . WARNING : It is assumed that dest and src do not overlap
fn extract_bytes(
        &mut self,
        dest: &P<Value>,
        src: &P<Value>,
        offset: i64,
        f_context: &mut FunctionContext,
        vm: &VM
    ) {
        if src.is_mem() {
            let src_loc = match src.v {
                Value_::Memory(ref mem) => {
                    let mem = memory_location_shift(
                        self.backend.as_mut(),
                        mem.clone(),
                        offset,
                        f_context,
                        vm
                    );
                    make_value_from_memory(mem, &dest.ty, vm)
                }
                _ => panic!("Wrong kind of memory value")
            };
            // TODO: what if 'dest is in more than 1 register
            emit_move_value_to_value(self.backend.as_mut(), &dest, &src_loc, f_context, vm);
        } else if is_machine_reg(src) {
            // Repeat this for each 8'bytes of dest
            // Size of each src unit
            let src_size = get_bit_size(&src.ty, vm) as i64;
            let dest_size = get_bit_size(&dest.ty, vm) as i64;
            // How many registers past the first 1 do we need to copy from
            let reg_distance = offset * 8 / src_size;
            let reg_offset = offset * 8 % src_size;
            let src_reg = get_register_from_id(src.id() + 2 * (reg_distance as usize));
            if dest_size + reg_offset > src_size {
                if is_int_ex_reg(dest) {
                    if reg_offset == 0 {
                        let (dest_l, dest_h) = split_int128(dest, f_context, vm);
                        let src_reg_h = get_register_from_id(src_reg.id() + 2);
                        // nothing special needs to be done
                        emit_move_value_to_value(
                            self.backend.as_mut(),
                            &dest_l,
                            &src_reg,
                            f_context,
                            vm
                        );
                        emit_move_value_to_value(
                            self.backend.as_mut(),
                            &dest_h,
                            &src_reg_h,
                            f_context,
                            vm
                        );
                    } else {
                        // This is not possible according the Aaarch64 PCS, since it would involve a
                        // 128-bit integer which starts part way through a register, but a 128-bit
                        // integer must be aligned to 16-bytes, and so must start at the start of an
                        // even register.
                        panic!("A 128-bit integer must start at the start of a register");
                    }
                } else {
                    // We need to copy from multiple registers
                    unimplemented!();
                }
            } else {
                if reg_offset == 0 {
                    // nothing special needs to be done
                    emit_move_value_to_value(self.backend.as_mut(), &dest, &src_reg, f_context, vm);
                } else {
                    let tmp_dest = if is_int_reg(&dest) {
                        dest.clone()
                    } else {
                        make_temporary(f_context, dest.ty.clone(), vm)
                    };
                    if is_int_reg(&src_reg) {
                        // Copy from src_reg, 'dest_size' bits starting at 'reg_offset' and store
                        // in dest (leaving other bits unchanged    )
                        self.backend
                            .emit_bfxil(&tmp_dest, &src_reg, reg_offset as u8, dest_size as u8);
                    } else {
                        // floating point register, need to copy to an int register first
                        self.backend.emit_fmov(&tmp_dest, &src_reg);
                        self.backend
                            .emit_bfxil(&tmp_dest, &tmp_dest, reg_offset as u8, dest_size as u8);
                    }
                    if !(is_int_reg(&dest)) {
                        // A temporary was used, move the value to dest
                        emit_move_value_to_value(
                            self.backend.as_mut(),
                            &dest,
                            &tmp_dest,
                            f_context,
                            vm
                        );
                    }
                }
            }
        } else {
            panic!("This function should only be used to move from a machine register and Memory");
        }
    }
fn extract_bytes ( & mut self , dest : & P < Value > , src : & P < Value > , offset : i64 , f_context : & mut FunctionContext , vm : & VM ) { if src . is_mem ( ) { let src_loc = match src . v { Value_ :: Memory ( ref mem ) => { let mem = memory_location_shift ( self . backend . as_mut ( ) , mem . clone ( ) , offset , f_context , vm ) ; make_value_from_memory ( mem , & dest . ty , vm ) } _ => panic ! ( " " ) } ; // TODO: what if 'dest is in more than 1 register emit_move_value_to_value ( self . backend . as_mut ( ) , & dest , & src_loc , f_context , vm ) ; } else if is_machine_reg ( src ) { // Repeat this for each 8'bytes of dest // Size of each src unit let src_size = get_bit_size ( & src . ty , vm ) as i64 ; let dest_size = get_bit_size ( & dest . ty , vm ) as i64 ; // How many registers past the first 1 do we need to copy from let reg_distance = offset * 8 / src_size ; let reg_offset = offset * 8 % src_size ; let src_reg = get_register_from_id ( src . id ( ) + 2 * ( reg_distance as usize ) ) ; if dest_size + reg_offset > src_size { if is_int_ex_reg ( dest ) { if reg_offset == 0 { let ( dest_l , dest_h ) = split_int128 ( dest , f_context , vm ) ; let src_reg_h = get_register_from_id ( src_reg . id ( ) + 2 ) ; // nothing special needs to be done emit_move_value_to_value ( self . backend . as_mut ( ) , & dest_l , & src_reg , f_context , vm ) ; emit_move_value_to_value ( self . backend . as_mut ( ) , & dest_h , & src_reg_h , f_context , vm ) ; } else { // This is not possible according the Aaarch64 PCS, since it would involve a // 128-bit integer which starts part way through a register, but a 128-bit // integer must be aligned to 16-bytes, and so must start at the start of an // even register. panic ! ( " " ) ; } } else { // We need to copy from multiple registers unimplemented ! ( ) ; } } else { if reg_offset == 0 { // nothing special needs to be done emit_move_value_to_value ( self . backend . as_mut ( ) , & dest , & src_reg , f_context , vm ) ; } else { let tmp_dest = if is_int_reg ( & dest ) { dest . clone ( ) } else { make_temporary ( f_context , dest . ty . clone ( ) , vm ) } ; if is_int_reg ( & src_reg ) { // Copy from src_reg, 'dest_size' bits starting at 'reg_offset' and store // in dest (leaving other bits unchanged    ) self . backend . emit_bfxil ( & tmp_dest , & src_reg , reg_offset as u8 , dest_size as u8 ) ; } else { // floating point register, need to copy to an int register first self . backend . emit_fmov ( & tmp_dest , & src_reg ) ; self . backend . emit_bfxil ( & tmp_dest , & tmp_dest , reg_offset as u8 , dest_size as u8 ) ; } if ! ( is_int_reg ( & dest ) ) { // A temporary was used, move the value to dest emit_move_value_to_value ( self . backend . as_mut ( ) , & dest , & tmp_dest , f_context , vm ) ; } } } } else { panic ! ( " " ) ; } }
Copies src+off, to dest src can be a memory location or a machine register
(in the case of a machine register, sucessivie registers of the same size are considered
part of src).
Copies src + off to dest src can be a memory location or a machine register ( in the case of a machine register sucessivie registers of the same size are considered part of src ) .
&mut self
dest
&P<Value>
src
&P<Value>
offset
i64
f_context
&mut FunctionContext
vm
&VM
&mut self
dest
&P<Value>
src
&P<Value>
offset
i64
f_context
&mut FunctionContext
vm
&VM