# Enum falcon::il::Expression [−][src]

pub enum Expression { Scalar(Scalar), Constant(Constant), Add(Box<Expression>, Box<Expression>), Sub(Box<Expression>, Box<Expression>), Mul(Box<Expression>, Box<Expression>), Divu(Box<Expression>, Box<Expression>), Modu(Box<Expression>, Box<Expression>), Divs(Box<Expression>, Box<Expression>), Mods(Box<Expression>, Box<Expression>), And(Box<Expression>, Box<Expression>), Or(Box<Expression>, Box<Expression>), Xor(Box<Expression>, Box<Expression>), Shl(Box<Expression>, Box<Expression>), Shr(Box<Expression>, Box<Expression>), Cmpeq(Box<Expression>, Box<Expression>), Cmpneq(Box<Expression>, Box<Expression>), Cmplts(Box<Expression>, Box<Expression>), Cmpltu(Box<Expression>, Box<Expression>), Zext(usize, Box<Expression>), Sext(usize, Box<Expression>), Trun(usize, Box<Expression>), Ite(Box<Expression>, Box<Expression>, Box<Expression>), }

An IL Expression.

## Variants

`Scalar(Scalar)`

`Constant(Constant)`

`Add(Box<Expression>, Box<Expression>)`

`Sub(Box<Expression>, Box<Expression>)`

`Mul(Box<Expression>, Box<Expression>)`

`Divu(Box<Expression>, Box<Expression>)`

`Modu(Box<Expression>, Box<Expression>)`

`Divs(Box<Expression>, Box<Expression>)`

`Mods(Box<Expression>, Box<Expression>)`

`And(Box<Expression>, Box<Expression>)`

`Or(Box<Expression>, Box<Expression>)`

`Xor(Box<Expression>, Box<Expression>)`

`Shl(Box<Expression>, Box<Expression>)`

`Shr(Box<Expression>, Box<Expression>)`

`Cmpeq(Box<Expression>, Box<Expression>)`

`Cmpneq(Box<Expression>, Box<Expression>)`

`Cmplts(Box<Expression>, Box<Expression>)`

`Cmpltu(Box<Expression>, Box<Expression>)`

`Zext(usize, Box<Expression>)`

`Sext(usize, Box<Expression>)`

`Trun(usize, Box<Expression>)`

`Ite(Box<Expression>, Box<Expression>, Box<Expression>)`

## Methods

`impl Expression`

[src]

`impl Expression`

`pub fn bits(&self) -> usize`

[src]

`pub fn bits(&self) -> usize`

Return the bitness of this expression.

`pub fn replace_scalar(`

&self,

scalar: &Scalar,

expression: &Expression

) -> Result<Expression>

[src]

`pub fn replace_scalar(`

&self,

scalar: &Scalar,

expression: &Expression

) -> Result<Expression>

Return a clone of this expression, but with every occurrence of the given scalar replaced with the given expression

`pub fn all_constants(&self) -> bool`

[src]

`pub fn all_constants(&self) -> bool`

Return true if all terminals in this expression are Constant

`pub fn scalars(&self) -> Vec<&Scalar>`

[src]

`pub fn scalars(&self) -> Vec<&Scalar>`

Returns all `Scalars`

used in this `Expression`

`pub fn scalars_mut(&mut self) -> Vec<&mut Scalar>`

[src]

`pub fn scalars_mut(&mut self) -> Vec<&mut Scalar>`

Return mutable references to all `Scalars`

in this `Expression`

.

`pub fn get_scalar(&self) -> Option<&Scalar>`

[src]

`pub fn get_scalar(&self) -> Option<&Scalar>`

If this expression is a scalar, return the scalar

`pub fn get_constant(&self) -> Option<&Constant>`

[src]

`pub fn get_constant(&self) -> Option<&Constant>`

If this expression is a constant, return the constant

`pub fn scalar(scalar: Scalar) -> Expression`

[src]

`pub fn scalar(scalar: Scalar) -> Expression`

Create a new `Expression`

from a `Scalar`

.

`pub fn constant(constant: Constant) -> Expression`

[src]

`pub fn constant(constant: Constant) -> Expression`

Create a new `Expression`

from a `Constant`

.

`pub fn add(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn add(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn sub(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn sub(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn mul(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn mul(lhs: Expression, rhs: Expression) -> Result<Expression>`

Create an unsigned multiplication `Expression`

.

# Error

The sort of the lhs and the rhs are not the same.

`pub fn divu(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn divu(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn modu(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn modu(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn divs(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn divs(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn mods(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn mods(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn and(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn and(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn or(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn or(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn xor(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn xor(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn shl(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn shl(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn shr(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn shr(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn cmpeq(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn cmpeq(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn cmpneq(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn cmpneq(lhs: Expression, rhs: Expression) -> Result<Expression>`

`pub fn cmpltu(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn cmpltu(lhs: Expression, rhs: Expression) -> Result<Expression>`

Create an unsigned less-than comparison `Expression`

.

# Error

The sort of the lhs and the rhs are not the same.

`pub fn cmplts(lhs: Expression, rhs: Expression) -> Result<Expression>`

[src]

`pub fn cmplts(lhs: Expression, rhs: Expression) -> Result<Expression>`

Create a signed less-than comparison `Expression`

.

# Error

The sort of the lhs and the rhs are not the same.

`pub fn zext(bits: usize, src: Expression) -> Result<Expression>`

[src]

`pub fn zext(bits: usize, src: Expression) -> Result<Expression>`

Create an expression to zero-extend src to the number of bits specified in bits.

# Error

src has more or equal number of bits than bits

`pub fn sext(bits: usize, src: Expression) -> Result<Expression>`

[src]

`pub fn sext(bits: usize, src: Expression) -> Result<Expression>`

Create an expression to sign-extend src to the number of bits specified

# Error

src has more or equal number of bits than bits

`pub fn trun(bits: usize, src: Expression) -> Result<Expression>`

[src]

`pub fn trun(bits: usize, src: Expression) -> Result<Expression>`

Create an expression to truncate the number of bits in src to the number of bits given.

# Error

src has less-than or equal bits than bits

`pub fn ite(`

cond: Expression,

then: Expression,

else_: Expression

) -> Result<Expression>

[src]

`pub fn ite(`

cond: Expression,

then: Expression,

else_: Expression

) -> Result<Expression>

Create an if-than-else expression

# Error

condition is not 1-bit, or bitness of then and else_ do not match.

## Trait Implementations

`impl Into<Expression> for Constant`

[src]

`impl Into<Expression> for Constant`

`fn into(self) -> Expression`

[src]

`fn into(self) -> Expression`

Performs the conversion.

`impl Clone for Expression`

[src]

`impl Clone for Expression`

`fn clone(&self) -> Expression`

[src]

`fn clone(&self) -> Expression`

Returns a copy of the value. Read more

`fn clone_from(&mut self, source: &Self)`

1.0.0[src]

`fn clone_from(&mut self, source: &Self)`

Performs copy-assignment from `source`

. Read more

`impl Debug for Expression`

[src]

`impl Debug for Expression`

`fn fmt(&self, f: &mut Formatter) -> Result`

[src]

`fn fmt(&self, f: &mut Formatter) -> Result`

Formats the value using the given formatter. Read more

`impl Eq for Expression`

[src]

`impl Eq for Expression`

`impl Hash for Expression`

[src]

`impl Hash for Expression`

`fn hash<__H: Hasher>(&self, state: &mut __H)`

[src]

`fn hash<__H: Hasher>(&self, state: &mut __H)`

Feeds this value into the given [`Hasher`

]. Read more

`fn hash_slice<H>(data: &[Self], state: &mut H) where`

H: Hasher,

1.3.0[src]

`fn hash_slice<H>(data: &[Self], state: &mut H) where`

H: Hasher,

Feeds a slice of this type into the given [`Hasher`

]. Read more

`impl Ord for Expression`

[src]

`impl Ord for Expression`

`fn cmp(&self, other: &Expression) -> Ordering`

[src]

`fn cmp(&self, other: &Expression) -> Ordering`

This method returns an `Ordering`

between `self`

and `other`

. Read more

`fn max(self, other: Self) -> Self`

1.21.0[src]

`fn max(self, other: Self) -> Self`

Compares and returns the maximum of two values. Read more

`fn min(self, other: Self) -> Self`

1.21.0[src]

`fn min(self, other: Self) -> Self`

Compares and returns the minimum of two values. Read more

`impl PartialEq for Expression`

[src]

`impl PartialEq for Expression`

`fn eq(&self, other: &Expression) -> bool`

[src]

`fn eq(&self, other: &Expression) -> bool`

This method tests for `self`

and `other`

values to be equal, and is used by `==`

. Read more

`fn ne(&self, other: &Expression) -> bool`

[src]

`fn ne(&self, other: &Expression) -> bool`

This method tests for `!=`

.

`impl PartialOrd for Expression`

[src]

`impl PartialOrd for Expression`

`fn partial_cmp(&self, other: &Expression) -> Option<Ordering>`

[src]

`fn partial_cmp(&self, other: &Expression) -> Option<Ordering>`

This method returns an ordering between `self`

and `other`

values if one exists. Read more

`fn lt(&self, other: &Expression) -> bool`

[src]

`fn lt(&self, other: &Expression) -> bool`

This method tests less than (for `self`

and `other`

) and is used by the `<`

operator. Read more

`fn le(&self, other: &Expression) -> bool`

[src]

`fn le(&self, other: &Expression) -> bool`

This method tests less than or equal to (for `self`

and `other`

) and is used by the `<=`

operator. Read more

`fn gt(&self, other: &Expression) -> bool`

[src]

`fn gt(&self, other: &Expression) -> bool`

This method tests greater than (for `self`

and `other`

) and is used by the `>`

operator. Read more

`fn ge(&self, other: &Expression) -> bool`

[src]

`fn ge(&self, other: &Expression) -> bool`

This method tests greater than or equal to (for `self`

and `other`

) and is used by the `>=`

operator. Read more

`impl Display for Expression`

[src]

`impl Display for Expression`

`fn fmt(&self, f: &mut Formatter) -> Result`

[src]

`fn fmt(&self, f: &mut Formatter) -> Result`

Formats the value using the given formatter. Read more

`impl Into<Expression> for Scalar`

[src]

`impl Into<Expression> for Scalar`

`fn into(self) -> Expression`

[src]

`fn into(self) -> Expression`

Performs the conversion.

`impl Value for Expression`

[src]

`impl Value for Expression`

`fn constant(constant: Constant) -> Self`

[src]

`fn constant(constant: Constant) -> Self`

Turn an il::Constant into a representation of this Value

`fn bits(&self) -> usize`

[src]

`fn bits(&self) -> usize`

Return the number of bits contained in this value

`fn shl(&self, bits: usize) -> Result<Self>`

[src]

`fn shl(&self, bits: usize) -> Result<Self>`

Shift the value left by the given number of bits

`fn shr(&self, bits: usize) -> Result<Self>`

[src]

`fn shr(&self, bits: usize) -> Result<Self>`

Shift the value right by the given number of bits

`fn trun(&self, bits: usize) -> Result<Self>`

[src]

`fn trun(&self, bits: usize) -> Result<Self>`

Truncate the value to the given number of bits

`fn zext(&self, bits: usize) -> Result<Self>`

[src]

`fn zext(&self, bits: usize) -> Result<Self>`

Zero-extend the value to the given number of bits

`fn or(&self, other: &Self) -> Result<Self>`

[src]

`fn or(&self, other: &Self) -> Result<Self>`

Or this value with the given value

## Auto Trait Implementations

`impl Send for Expression`

`impl Send for Expression`

`impl Sync for Expression`

`impl Sync for Expression`