fn emit_zero_for_type_mlir(&mut self, ty: mlir::Type) -> mlir::Value {
        if circt::hw::is_array_type(ty) {
            let inner = self.emit_zero_for_type_mlir(circt::hw::array_type_element(ty));
            circt::hw::ArrayCreateOp::new(
                self.mlir_builder,
                ty,
                (0..circt::hw::array_type_size(ty)).map(|_| inner),
            )
            .into()
        } else if circt::hw::is_struct_type(ty) {
            let inner: Vec<_> = circt::hw::struct_type_fields(ty)
                .map(|(_, ty)| self.emit_zero_for_type_mlir(ty))
                .collect();
            circt::hw::StructCreateOp::new(self.mlir_builder, ty, inner).into()
        } else if circt::llhd::is_pointer_type(ty) {
            let inner = self.emit_zero_for_type_mlir(circt::llhd::pointer_type_element(ty));
            circt::llhd::VariableOp::new(self.mlir_builder, inner).into()
        } else if circt::llhd::is_signal_type(ty) {
            let inner = self.emit_zero_for_type_mlir(circt::llhd::signal_type_element(ty));
            circt::llhd::SignalOp::new(self.mlir_builder, &self.unique_names.add_tmp(), inner)
                .into()
        } else if circt::llhd::is_time_type(ty) {
            circt::llhd::ConstantTimeOp::with_delta(self.mlir_builder, 0).into()
        } else if mlir::is_integer_type(ty) {
            circt::hw::ConstantOp::new(
                self.mlir_builder,
                std::cmp::max(mlir::integer_type_width(ty), 1),
                &BigInt::zero(),
            )
            .into()
        } else {
            panic!("no zero value for type {}", ty)
        }
    }
/// Emit the zero value for an MLIR type.
Emit the zero value for an MLIR type.
Emit the zero value for an MLIR type .
fn emit_zero_for_type_mlir(&mut self, ty: mlir::Type) -> mlir::Value {
        if circt::hw::is_array_type(ty) {
            let inner = self.emit_zero_for_type_mlir(circt::hw::array_type_element(ty));
            circt::hw::ArrayCreateOp::new(
                self.mlir_builder,
                ty,
                (0..circt::hw::array_type_size(ty)).map(|_| inner),
            )
            .into()
        } else if circt::hw::is_struct_type(ty) {
            let inner: Vec<_> = circt::hw::struct_type_fields(ty)
                .map(|(_, ty)| self.emit_zero_for_type_mlir(ty))
                .collect();
            circt::hw::StructCreateOp::new(self.mlir_builder, ty, inner).into()
        } else if circt::llhd::is_pointer_type(ty) {
            let inner = self.emit_zero_for_type_mlir(circt::llhd::pointer_type_element(ty));
            circt::llhd::VariableOp::new(self.mlir_builder, inner).into()
        } else if circt::llhd::is_signal_type(ty) {
            let inner = self.emit_zero_for_type_mlir(circt::llhd::signal_type_element(ty));
            circt::llhd::SignalOp::new(self.mlir_builder, &self.unique_names.add_tmp(), inner)
                .into()
        } else if circt::llhd::is_time_type(ty) {
            circt::llhd::ConstantTimeOp::with_delta(self.mlir_builder, 0).into()
        } else if mlir::is_integer_type(ty) {
            circt::hw::ConstantOp::new(
                self.mlir_builder,
                std::cmp::max(mlir::integer_type_width(ty), 1),
                &BigInt::zero(),
            )
            .into()
        } else {
            panic!("no zero value for type {}", ty)
        }
    }
fn emit_zero_for_type_mlir ( & mut self , ty : mlir :: Type ) -> mlir :: Value { if circt :: hw :: is_array_type ( ty ) { let inner = self . emit_zero_for_type_mlir ( circt :: hw :: array_type_element ( ty ) ) ; circt :: hw :: ArrayCreateOp :: new ( self . mlir_builder , ty , ( 0 .. circt :: hw :: array_type_size ( ty ) ) . map ( | _ | inner ) , ) . into ( ) } else if circt :: hw :: is_struct_type ( ty ) { let inner : Vec < _ > = circt :: hw :: struct_type_fields ( ty ) . map ( | ( _ , ty ) | self . emit_zero_for_type_mlir ( ty ) ) . collect ( ) ; circt :: hw :: StructCreateOp :: new ( self . mlir_builder , ty , inner ) . into ( ) } else if circt :: llhd :: is_pointer_type ( ty ) { let inner = self . emit_zero_for_type_mlir ( circt :: llhd :: pointer_type_element ( ty ) ) ; circt :: llhd :: VariableOp :: new ( self . mlir_builder , inner ) . into ( ) } else if circt :: llhd :: is_signal_type ( ty ) { let inner = self . emit_zero_for_type_mlir ( circt :: llhd :: signal_type_element ( ty ) ) ; circt :: llhd :: SignalOp :: new ( self . mlir_builder , & self . unique_names . add_tmp ( ) , inner ) . into ( ) } else if circt :: llhd :: is_time_type ( ty ) { circt :: llhd :: ConstantTimeOp :: with_delta ( self . mlir_builder , 0 ) . into ( ) } else if mlir :: is_integer_type ( ty ) { circt :: hw :: ConstantOp :: new ( self . mlir_builder , std :: cmp :: max ( mlir :: integer_type_width ( ty ) , 1 ) , & BigInt :: zero ( ) , ) . into ( ) } else { panic ! ( " " ty ) } }
Emit the zero value for an MLIR type.
Emit the zero value for an MLIR type .
&mut self
ty
mlir::Type
&mut self
ty
mlir::Type