fn emit_lvalue_index(
        &mut self,
        ty: &'gcx UnpackedType<'gcx>,
        value: (HybridValue, Option<HybridValue>),
        base: &'gcx mir::Rvalue<'gcx>,
        length: usize,
    ) -> Result<(HybridValue, Option<HybridValue>)> {
        let (target_real, target_shadow) = value;
        let base = self.emit_mir_rvalue(base)?;
        let shifted_real = {
            let hidden = self.emit_zero_for_type_both(self.value_type(target_real));
            self.mk_shr(target_real, hidden, base)
        };
        let shifted_shadow = target_shadow.map(|target| {
            let hidden = self.emit_zero_for_type_both(self.value_type(target));
            self.mk_shr(target, hidden, base)
        });
        if ty.coalesces_to_llhd_scalar() {
            let length = std::cmp::max(1, length);
            Ok((
                self.mk_ext_slice(shifted_real, 0, length),
                shifted_shadow.map(|s| self.mk_ext_slice(s, 0, length)),
            ))
        } else {
            if length == 0 {
                Ok((
                    self.mk_ext_field(shifted_real, 0),
                    shifted_shadow.map(|s| self.mk_ext_field(s, 0)),
                ))
            } else {
                Ok((
                    self.mk_ext_slice(shifted_real, 0, length),
                    shifted_shadow.map(|s| self.mk_ext_slice(s, 0, length)),
                ))
            }
        }
    }
/// Emit the code for an indexing operation on an already emitted lvalue.
Emit the code for an indexing operation on an already emitted lvalue.
Emit the code for an indexing operation on an already emitted lvalue .
fn emit_lvalue_index(
        &mut self,
        ty: &'gcx UnpackedType<'gcx>,
        value: (HybridValue, Option<HybridValue>),
        base: &'gcx mir::Rvalue<'gcx>,
        length: usize,
    ) -> Result<(HybridValue, Option<HybridValue>)> {
        let (target_real, target_shadow) = value;
        let base = self.emit_mir_rvalue(base)?;
        let shifted_real = {
            let hidden = self.emit_zero_for_type_both(self.value_type(target_real));
            self.mk_shr(target_real, hidden, base)
        };
        let shifted_shadow = target_shadow.map(|target| {
            let hidden = self.emit_zero_for_type_both(self.value_type(target));
            self.mk_shr(target, hidden, base)
        });
        if ty.coalesces_to_llhd_scalar() {
            let length = std::cmp::max(1, length);
            Ok((
                self.mk_ext_slice(shifted_real, 0, length),
                shifted_shadow.map(|s| self.mk_ext_slice(s, 0, length)),
            ))
        } else {
            if length == 0 {
                Ok((
                    self.mk_ext_field(shifted_real, 0),
                    shifted_shadow.map(|s| self.mk_ext_field(s, 0)),
                ))
            } else {
                Ok((
                    self.mk_ext_slice(shifted_real, 0, length),
                    shifted_shadow.map(|s| self.mk_ext_slice(s, 0, length)),
                ))
            }
        }
    }
fn emit_lvalue_index ( & mut self , ty : & ' gcx UnpackedType < ' gcx > , value : ( HybridValue , Option < HybridValue > ) , base : & ' gcx mir :: Rvalue < ' gcx > , length : usize , ) -> Result < ( HybridValue , Option < HybridValue > ) > { let ( target_real , target_shadow ) = value ; let base = self . emit_mir_rvalue ( base ) ? ; let shifted_real = { let hidden = self . emit_zero_for_type_both ( self . value_type ( target_real ) ) ; self . mk_shr ( target_real , hidden , base ) } ; let shifted_shadow = target_shadow . map ( | target | { let hidden = self . emit_zero_for_type_both ( self . value_type ( target ) ) ; self . mk_shr ( target , hidden , base ) } ) ; if ty . coalesces_to_llhd_scalar ( ) { let length = std :: cmp :: max ( 1 , length ) ; Ok ( ( self . mk_ext_slice ( shifted_real , 0 , length ) , shifted_shadow . map ( | s | self . mk_ext_slice ( s , 0 , length ) ) , ) ) } else { if length == 0 { Ok ( ( self . mk_ext_field ( shifted_real , 0 ) , shifted_shadow . map ( | s | self . mk_ext_field ( s , 0 ) ) , ) ) } else { Ok ( ( self . mk_ext_slice ( shifted_real , 0 , length ) , shifted_shadow . map ( | s | self . mk_ext_slice ( s , 0 , length ) ) , ) ) } } }
Emit the code for an indexing operation on an already emitted lvalue.
Emit the code for an indexing operation on an already emitted lvalue .
&mut self
ty
&'gcx UnpackedType<'gcx>
value
(HybridValue, Option<HybridValue>)
base
&'gcx mir::Rvalue<'gcx>
length
usize
&mut self
ty
&'gcx UnpackedType<'gcx>
value
(HybridValue, Option<HybridValue>)
base
&'gcx mir::Rvalue<'gcx>
length
usize