pub fn add_const(
        &mut self,
        address: &mut MAddress,
        value: u64,
        vt_option: Option<ValueInfo>,
    ) -> T::ValueRef {
        if vt_option.is_none() {
            return self.ssa.insert_const(value, None).unwrap_or_else(|| {
                radeco_err!("Cannot insert new constants");
                self.ssa.invalid_value().unwrap()
            });
        }
        let vt = vt_option.unwrap();
        let width = vt.width().get_width().unwrap_or(64);
        if width < 64 {
            let val: u64 = value & (1 << (width) - 1);
            let const_node = self.ssa.insert_const(val, Some(width)).unwrap_or_else(|| {
                radeco_err!("Cannot insert new constants");
                self.ssa.invalid_value().unwrap()
            });
            let opcode = MOpcode::OpNarrow(width as u16);
            let narrow_node = self.add_op(&opcode, address, vt);
            self.op_use(&narrow_node, 0, &const_node);
            narrow_node
        } else {
            let const_node = self
                .ssa
                .insert_const(value, Some(width))
                .unwrap_or_else(|| {
                    radeco_err!("Cannot insert new constants");
                    self.ssa.invalid_value().unwrap()
                });
            const_node
        }
    }
// Some constants are generated to operate with other OpCode, which shoud be careful
// about its width. Because we treat all consts are 64 bit.
// Constants need not belong to any block. They are stored as a separate table.
Some constants are generated to operate with other OpCode, which shoud be careful
about its width. Because we treat all consts are 64 bit.
Constants need not belong to any block. They are stored as a separate table.
Some constants are generated to operate with other OpCode which shoud be careful about its width . Because we treat all consts are 64 bit . Constants need not belong to any block . They are stored as a separate table .
pub fn add_const(
        &mut self,
        address: &mut MAddress,
        value: u64,
        vt_option: Option<ValueInfo>,
    ) -> T::ValueRef {
        if vt_option.is_none() {
            return self.ssa.insert_const(value, None).unwrap_or_else(|| {
                radeco_err!("Cannot insert new constants");
                self.ssa.invalid_value().unwrap()
            });
        }
        let vt = vt_option.unwrap();
        let width = vt.width().get_width().unwrap_or(64);
        if width < 64 {
            let val: u64 = value & (1 << (width) - 1);
            let const_node = self.ssa.insert_const(val, Some(width)).unwrap_or_else(|| {
                radeco_err!("Cannot insert new constants");
                self.ssa.invalid_value().unwrap()
            });
            let opcode = MOpcode::OpNarrow(width as u16);
            let narrow_node = self.add_op(&opcode, address, vt);
            self.op_use(&narrow_node, 0, &const_node);
            narrow_node
        } else {
            let const_node = self
                .ssa
                .insert_const(value, Some(width))
                .unwrap_or_else(|| {
                    radeco_err!("Cannot insert new constants");
                    self.ssa.invalid_value().unwrap()
                });
            const_node
        }
    }
pub fn add_const ( & mut self , address : & mut MAddress , value : u64 , vt_option : Option < ValueInfo > , ) -> T :: ValueRef { if vt_option . is_none ( ) { return self . ssa . insert_const ( value , None ) . unwrap_or_else ( | | { radeco_err ! ( " " ) ; self . ssa . invalid_value ( ) . unwrap ( ) } ) ; } let vt = vt_option . unwrap ( ) ; let width = vt . width ( ) . get_width ( ) . unwrap_or ( 64 ) ; if width < 64 { let val : u64 = value & ( 1 << ( width ) - 1 ) ; let const_node = self . ssa . insert_const ( val , Some ( width ) ) . unwrap_or_else ( | | { radeco_err ! ( " " ) ; self . ssa . invalid_value ( ) . unwrap ( ) } ) ; let opcode = MOpcode :: OpNarrow ( width as u16 ) ; let narrow_node = self . add_op ( & opcode , address , vt ) ; self . op_use ( & narrow_node , 0 , & const_node ) ; narrow_node } else { let const_node = self . ssa . insert_const ( value , Some ( width ) ) . unwrap_or_else ( | | { radeco_err ! ( " " ) ; self . ssa . invalid_value ( ) . unwrap ( ) } ) ; const_node } }
Some constants are generated to operate with other OpCode, which shoud be careful
about its width.
Some constants are generated to operate with other OpCode which shoud be careful about its width .
&mut self
address
&mut MAddress
value
u64
vt_option
Option<ValueInfo>
&mut self
address
&mut MAddress
value
u64
vt_option
Option<ValueInfo>