pub fn simd_shuffle_indices(
        &mut self,
        bx: &Builder<'a, 'll, 'tcx>,
        span: Span,
        ty: Ty<'tcx>,
        constant: Result<&'tcx ty::Const<'tcx>, Lrc<ConstEvalErr<'tcx>>>,
    ) -> (&'ll Value, Ty<'tcx>) {
        constant
            .and_then(|c| {
                let field_ty = c.ty.builtin_index().unwrap();
                let fields = match c.ty.sty {
                    ty::Array(_, n) => n.unwrap_usize(bx.tcx()),
                    ref other => bug!("invalid simd shuffle type: {}", other),
                };
                let values: Result<Vec<_>, Lrc<_>> = (0..fields).map(|field| {
                    let field = const_field(
                        bx.tcx(),
                        ty::ParamEnv::reveal_all(),
                        self.instance,
                        None,
                        mir::Field::new(field as usize),
                        c,
                    )?;
                    if let Some(prim) = field.val.try_to_scalar() {
                        let layout = bx.cx.layout_of(field_ty);
                        let scalar = match layout.abi {
                            layout::Abi::Scalar(ref x) => x,
                            _ => bug!("from_const: invalid ByVal layout: {:#?}", layout)
                        };
                        Ok(scalar_to_llvm(
                            bx.cx, prim, scalar,
                            layout.immediate_llvm_type(bx.cx),
                        ))
                    } else {
                        bug!("simd shuffle field {:?}", field)
                    }
                }).collect();
                let llval = C_struct(bx.cx, &values?, false);
                Ok((llval, c.ty))
            })
            .unwrap_or_else(|e| {
                e.report_as_error(
                    bx.tcx().at(span),
                    "could not evaluate shuffle_indices at compile time",
                );
                // We've errored, so we don't have to produce working code.
                let ty = self.monomorphize(&ty);
                let llty = bx.cx.layout_of(ty).llvm_type(bx.cx);
                (C_undef(llty), ty)
            })
    }
/// process constant containing SIMD shuffle indices
process constant containing SIMD shuffle indices
process constant containing SIMD shuffle indices
pub fn simd_shuffle_indices(
        &mut self,
        bx: &Builder<'a, 'll, 'tcx>,
        span: Span,
        ty: Ty<'tcx>,
        constant: Result<&'tcx ty::Const<'tcx>, Lrc<ConstEvalErr<'tcx>>>,
    ) -> (&'ll Value, Ty<'tcx>) {
        constant
            .and_then(|c| {
                let field_ty = c.ty.builtin_index().unwrap();
                let fields = match c.ty.sty {
                    ty::Array(_, n) => n.unwrap_usize(bx.tcx()),
                    ref other => bug!("invalid simd shuffle type: {}", other),
                };
                let values: Result<Vec<_>, Lrc<_>> = (0..fields).map(|field| {
                    let field = const_field(
                        bx.tcx(),
                        ty::ParamEnv::reveal_all(),
                        self.instance,
                        None,
                        mir::Field::new(field as usize),
                        c,
                    )?;
                    if let Some(prim) = field.val.try_to_scalar() {
                        let layout = bx.cx.layout_of(field_ty);
                        let scalar = match layout.abi {
                            layout::Abi::Scalar(ref x) => x,
                            _ => bug!("from_const: invalid ByVal layout: {:#?}", layout)
                        };
                        Ok(scalar_to_llvm(
                            bx.cx, prim, scalar,
                            layout.immediate_llvm_type(bx.cx),
                        ))
                    } else {
                        bug!("simd shuffle field {:?}", field)
                    }
                }).collect();
                let llval = C_struct(bx.cx, &values?, false);
                Ok((llval, c.ty))
            })
            .unwrap_or_else(|e| {
                e.report_as_error(
                    bx.tcx().at(span),
                    "could not evaluate shuffle_indices at compile time",
                );
                // We've errored, so we don't have to produce working code.
                let ty = self.monomorphize(&ty);
                let llty = bx.cx.layout_of(ty).llvm_type(bx.cx);
                (C_undef(llty), ty)
            })
    }
pub fn simd_shuffle_indices ( & mut self , bx : & Builder < ' a , ' ll , ' tcx > , span : Span , ty : Ty < ' tcx > , constant : Result < & ' tcx ty :: Const < ' tcx > , Lrc < ConstEvalErr < ' tcx > > > , ) -> ( & ' ll Value , Ty < ' tcx > ) { constant . and_then ( | c | { let field_ty = c . ty . builtin_index ( ) . unwrap ( ) ; let fields = match c . ty . sty { ty :: Array ( _ , n ) => n . unwrap_usize ( bx . tcx ( ) ) , ref other => bug ! ( " " other ) , } ; let values : Result < Vec < _ > , Lrc < _ > > = ( 0 .. fields ) . map ( | field | { let field = const_field ( bx . tcx ( ) , ty :: ParamEnv :: reveal_all ( ) , self . instance , None , mir :: Field :: new ( field as usize ) , c , ) ? ; if let Some ( prim ) = field . val . try_to_scalar ( ) { let layout = bx . cx . layout_of ( field_ty ) ; let scalar = match layout . abi { layout :: Abi :: Scalar ( ref x ) => x , _ => bug ! ( " " layout ) } ; Ok ( scalar_to_llvm ( bx . cx , prim , scalar , layout . immediate_llvm_type ( bx . cx ) , ) ) } else { bug ! ( " " field ) } } ) . collect ( ) ; let llval = C_struct ( bx . cx , & values ? , false ) ; Ok ( ( llval , c . ty ) ) } ) . unwrap_or_else ( | e | { e . report_as_error ( bx . tcx ( ) . at ( span ) , " " , ) ; // We've errored, so we don't have to produce working code. let ty = self . monomorphize ( & ty ) ; let llty = bx . cx . layout_of ( ty ) . llvm_type ( bx . cx ) ; ( C_undef ( llty ) , ty ) } ) }
process constant containing SIMD shuffle indices
process constant containing SIMD shuffle indices
&mut self
bx
&Builder<'a, 'll, 'tcx>
span
Span
ty
Ty<'tcx>
constant
Result<&'tcx ty::Const<'tcx>, Lrc<ConstEvalErr<'tcx>>>
&mut self
bx
&Builder<'a, 'll, 'tcx>
span
Span
ty
Ty<'tcx>
constant
Result<&'tcx ty::Const<'tcx>, Lrc<ConstEvalErr<'tcx>>>