fn eliminate_lower_bits(bits: usize, e: il::Expression) -> Result<il::Expression> {
        fn zext_eliminate(bits: usize, e: il::Expression) -> il::Expression {
            let e_bits = e.bits();
            if let il::Expression::Zext(_, ref ze) = e {
                if ze.bits() <= bits {
                    return il::expr_const(0, e_bits);
                }
            };
            e
        }

        match e {
            il::Expression::Or(lhs, rhs) => {
                let lhs = zext_eliminate(bits, *lhs);
                let rhs = zext_eliminate(bits, *rhs);
                Ok(il::Expression::or(lhs, rhs)?)
            }
            _ => Ok(e.clone()),
        }
    }
// We have reached an optimization that allows us to safely eliminate lower
// bits in some circumstances. For example (0xFFFFFF00:32 & zext.32(e:8))
// can be simplified to 0:32
We have reached an optimization that allows us to safely eliminate lower
bits in some circumstances. For example (0xFFFFFF00:32 & zext.32(e:8))
can be simplified to 0:32
We have reached an optimization that allows us to safely eliminate lower bits in some circumstances . For example ( 0xFFFFFF00 : 32 & zext . 32 ( e : 8 )) can be simplified to 0 : 32
fn eliminate_lower_bits(bits: usize, e: il::Expression) -> Result<il::Expression> {
        fn zext_eliminate(bits: usize, e: il::Expression) -> il::Expression {
            let e_bits = e.bits();
            if let il::Expression::Zext(_, ref ze) = e {
                if ze.bits() <= bits {
                    return il::expr_const(0, e_bits);
                }
            };
            e
        }
        match e {
            il::Expression::Or(lhs, rhs) => {
                let lhs = zext_eliminate(bits, *lhs);
                let rhs = zext_eliminate(bits, *rhs);
                Ok(il::Expression::or(lhs, rhs)?)
            }
            _ => Ok(e.clone()),
        }
    }
fn eliminate_lower_bits ( bits : usize , e : il :: Expression ) -> Result < il :: Expression > { fn zext_eliminate ( bits : usize , e : il :: Expression ) -> il :: Expression { let e_bits = e . bits ( ) ; if let il :: Expression :: Zext ( _ , ref ze ) = e { if ze . bits ( ) <= bits { return il :: expr_const ( 0 , e_bits ) ; } } ; e } match e { il :: Expression :: Or ( lhs , rhs ) => { let lhs = zext_eliminate ( bits , * lhs ) ; let rhs = zext_eliminate ( bits , * rhs ) ; Ok ( il :: Expression :: or ( lhs , rhs ) ? ) } _ => Ok ( e . clone ( ) ) , } }
We have reached an optimization that allows us to safely eliminate lower
bits in some circumstances.
We have reached an optimization that allows us to safely eliminate lower bits in some circumstances .
bits
usize
e
il::Expression