fn emit_mir_lvalue_inner(
        &mut self,
        mir: &mir::Lvalue<'gcx>,
    ) -> Result<(HybridValue, Option<HybridValue>)> {
        match mir.kind {
            // Transmutes are no-ops in code generation.
            mir::LvalueKind::Transmute(value) => self.emit_mir_lvalue(value),

            // Variables and ports trivially return their declaration value.
            // This is either the `var` or `sig` instruction which introduced
            // them.
            mir::LvalueKind::Var(id) | mir::LvalueKind::Port(id) | mir::LvalueKind::Arg(id) => {
                Ok((
                    self.emitted_value(id).clone(),
                    self.shadows.get(&id.into()).cloned(),
                ))
            }

            // Interface signals require special care, because they are emitted
            // in a transposed fashion.
            mir::LvalueKind::IntfSignal(value, signal) => self.emit_lvalue_interface(value, signal),

            // Member accesses simply look up their inner lvalue and extract the
            // signal or pointer to the respective subfield.
            mir::LvalueKind::Member { value, field } => {
                let target = self.emit_mir_lvalue(value)?;
                let value_real = self.mk_ext_field(target.0, field);
                let value_shadow = target.1.map(|target| self.mk_ext_field(target, field));
                Ok((value_real, value_shadow))
            }

            // Index accesses shift and extract the accessed slice as a signal
            // or pointer.
            mir::LvalueKind::Index {
                value,
                base,
                length,
            } => {
                let inner = self.emit_mir_lvalue(value)?;
                self.emit_lvalue_index(value.ty, inner, base, length)
            }

            mir::LvalueKind::Repeat(..)
            | mir::LvalueKind::Concat(..)
            | mir::LvalueKind::DestructArray(..)
            | mir::LvalueKind::DestructStruct(..) => {
                bug_span!(
                    mir.span,
                    self.cx,
                    "mir lvalue should have been simplified by its parent assignment; {:#?}",
                    mir
                );
            }

            // Errors from MIR lowering have already been reported. Just abort.
            mir::LvalueKind::Error => Err(()),

            mir::LvalueKind::Genvar(..) | mir::LvalueKind::Intf(..) => {
                bug_span!(
                    mir.span,
                    self.cx,
                    "cannot codegen assignment to interface or genvar; {:#?}",
                    mir
                );
            }
        }
    }
/// Emit the code for an MIR lvalue.
///
/// The first returned value is the actually targeted lvalue. The second is
/// a potential shadow variable that must be kept up-to-date.
Emit the code for an MIR lvalue.
The first returned value is the actually targeted lvalue. The second is
a potential shadow variable that must be kept up-to-date.
Emit the code for an MIR lvalue . The first returned value is the actually targeted lvalue . The second is a potential shadow variable that must be kept up - to - date .
fn emit_mir_lvalue_inner(
        &mut self,
        mir: &mir::Lvalue<'gcx>,
    ) -> Result<(HybridValue, Option<HybridValue>)> {
        match mir.kind {
            // Transmutes are no-ops in code generation.
            mir::LvalueKind::Transmute(value) => self.emit_mir_lvalue(value),
            // Variables and ports trivially return their declaration value.
            // This is either the `var` or `sig` instruction which introduced
            // them.
            mir::LvalueKind::Var(id) | mir::LvalueKind::Port(id) | mir::LvalueKind::Arg(id) => {
                Ok((
                    self.emitted_value(id).clone(),
                    self.shadows.get(&id.into()).cloned(),
                ))
            }
            // Interface signals require special care, because they are emitted
            // in a transposed fashion.
            mir::LvalueKind::IntfSignal(value, signal) => self.emit_lvalue_interface(value, signal),
            // Member accesses simply look up their inner lvalue and extract the
            // signal or pointer to the respective subfield.
            mir::LvalueKind::Member { value, field } => {
                let target = self.emit_mir_lvalue(value)?;
                let value_real = self.mk_ext_field(target.0, field);
                let value_shadow = target.1.map(|target| self.mk_ext_field(target, field));
                Ok((value_real, value_shadow))
            }
            // Index accesses shift and extract the accessed slice as a signal
            // or pointer.
            mir::LvalueKind::Index {
                value,
                base,
                length,
            } => {
                let inner = self.emit_mir_lvalue(value)?;
                self.emit_lvalue_index(value.ty, inner, base, length)
            }
            mir::LvalueKind::Repeat(..)
            | mir::LvalueKind::Concat(..)
            | mir::LvalueKind::DestructArray(..)
            | mir::LvalueKind::DestructStruct(..) => {
                bug_span!(
                    mir.span,
                    self.cx,
                    "mir lvalue should have been simplified by its parent assignment; {:#?}",
                    mir
                );
            }
            // Errors from MIR lowering have already been reported. Just abort.
            mir::LvalueKind::Error => Err(()),
            mir::LvalueKind::Genvar(..) | mir::LvalueKind::Intf(..) => {
                bug_span!(
                    mir.span,
                    self.cx,
                    "cannot codegen assignment to interface or genvar; {:#?}",
                    mir
                );
            }
        }
    }
fn emit_mir_lvalue_inner ( & mut self , mir : & mir :: Lvalue < ' gcx > , ) -> Result < ( HybridValue , Option < HybridValue > ) > { match mir . kind { // Transmutes are no-ops in code generation. mir :: LvalueKind :: Transmute ( value ) => self . emit_mir_lvalue ( value ) , // Variables and ports trivially return their declaration value. // This is either the `var` or `sig` instruction which introduced // them. mir :: LvalueKind :: Var ( id ) | mir :: LvalueKind :: Port ( id ) | mir :: LvalueKind :: Arg ( id ) => { Ok ( ( self . emitted_value ( id ) . clone ( ) , self . shadows . get ( & id . into ( ) ) . cloned ( ) , ) ) } // Interface signals require special care, because they are emitted // in a transposed fashion. mir :: LvalueKind :: IntfSignal ( value , signal ) => self . emit_lvalue_interface ( value , signal ) , // Member accesses simply look up their inner lvalue and extract the // signal or pointer to the respective subfield. mir :: LvalueKind :: Member { value , field } => { let target = self . emit_mir_lvalue ( value ) ? ; let value_real = self . mk_ext_field ( target . 0 , field ) ; let value_shadow = target . 1 . map ( | target | self . mk_ext_field ( target , field ) ) ; Ok ( ( value_real , value_shadow ) ) } // Index accesses shift and extract the accessed slice as a signal // or pointer. mir :: LvalueKind :: Index { value , base , length , } => { let inner = self . emit_mir_lvalue ( value ) ? ; self . emit_lvalue_index ( value . ty , inner , base , length ) } mir :: LvalueKind :: Repeat ( .. ) | mir :: LvalueKind :: Concat ( .. ) | mir :: LvalueKind :: DestructArray ( .. ) | mir :: LvalueKind :: DestructStruct ( .. ) => { bug_span ! ( mir span self cx " " mir ) ; } // Errors from MIR lowering have already been reported. Just abort. mir :: LvalueKind :: Error => Err ( ( ) ) , mir :: LvalueKind :: Genvar ( .. ) | mir :: LvalueKind :: Intf ( .. ) => { bug_span ! ( mir span self cx " " mir ) ; } } }
Emit the code for an MIR lvalue.
Emit the code for an MIR lvalue .
&mut self
mir
&mir::Lvalue<'gcx>
&mut self
mir
&mir::Lvalue<'gcx>