pub fn map_const(
        &self,
        builder: &mut llhd::ir::UnitBuilder,
        konst: &Const,
    ) -> Result<llhd::ir::Value> {
        Ok(match *konst {
            // TODO: Map this to llhd::const_void once available.
            Const::Null => builder.ins().const_int((0, 0)),
            Const::Int(ref k) => builder.ins().const_int((999, k.value.clone())),
            Const::Enum(ref k) => {
                let size = match self.lazy_hir(k.decl)?.data.as_ref().unwrap().value {
                    hir::TypeData::Enum(ref lits) => lits.len(),
                    _ => unreachable!(),
                };
                builder.ins().const_int((size, k.index))
            }
            Const::Float(ref _k) => panic!("cannot map float constant"),
            Const::IntRange(_) | Const::FloatRange(_) => panic!("cannot map range constant"),
        }
        .into())
    }
/// Map a constant value to the LLHD counterpart.
Map a constant value to the LLHD counterpart.
Map a constant value to the LLHD counterpart .
pub fn map_const(
        &self,
        builder: &mut llhd::ir::UnitBuilder,
        konst: &Const,
    ) -> Result<llhd::ir::Value> {
        Ok(match *konst {
            // TODO: Map this to llhd::const_void once available.
            Const::Null => builder.ins().const_int((0, 0)),
            Const::Int(ref k) => builder.ins().const_int((999, k.value.clone())),
            Const::Enum(ref k) => {
                let size = match self.lazy_hir(k.decl)?.data.as_ref().unwrap().value {
                    hir::TypeData::Enum(ref lits) => lits.len(),
                    _ => unreachable!(),
                };
                builder.ins().const_int((size, k.index))
            }
            Const::Float(ref _k) => panic!("cannot map float constant"),
            Const::IntRange(_) | Const::FloatRange(_) => panic!("cannot map range constant"),
        }
        .into())
    }
pub fn map_const ( & self , builder : & mut llhd :: ir :: UnitBuilder , konst : & Const , ) -> Result < llhd :: ir :: Value > { Ok ( match * konst { // TODO: Map this to llhd::const_void once available. Const :: Null => builder . ins ( ) . const_int ( ( 0 , 0 ) ) , Const :: Int ( ref k ) => builder . ins ( ) . const_int ( ( 999 , k . value . clone ( ) ) ) , Const :: Enum ( ref k ) => { let size = match self . lazy_hir ( k . decl ) ? . data . as_ref ( ) . unwrap ( ) . value { hir :: TypeData :: Enum ( ref lits ) => lits . len ( ) , _ => unreachable ! ( ) , } ; builder . ins ( ) . const_int ( ( size , k . index ) ) } Const :: Float ( ref _k ) => panic ! ( " " ) , Const :: IntRange ( _ ) | Const :: FloatRange ( _ ) => panic ! ( " " ) , } . into ( ) ) }
Map a constant value to the LLHD counterpart.
Map a constant value to the LLHD counterpart .
&self
builder
&mut llhd::ir::UnitBuilder
konst
&Const
&self
builder
&mut llhd::ir::UnitBuilder
konst
&Const