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]
pub fn bits(&self) -> usize
[src]
Return the bitness of this expression.
pub fn replace_scalar(
&self,
scalar: &Scalar,
expression: &Expression
) -> Result<Expression>
[src]
&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]
Return true if all terminals in this expression are Constant
pub fn scalars(&self) -> Vec<&Scalar>
[src]
Returns all Scalars
used in this Expression
pub fn scalars_mut(&mut self) -> Vec<&mut Scalar>
[src]
Return mutable references to all Scalars
in this Expression
.
pub fn get_scalar(&self) -> Option<&Scalar>
[src]
If this expression is a scalar, return the scalar
pub fn get_constant(&self) -> Option<&Constant>
[src]
If this expression is a constant, return the constant
pub fn scalar(scalar: Scalar) -> Expression
[src]
Create a new Expression
from a Scalar
.
pub fn constant(constant: Constant) -> Expression
[src]
Create a new Expression
from a Constant
.
pub fn add(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn sub(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn mul(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
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 modu(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn divs(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn mods(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn and(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn or(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn xor(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn shl(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn shr(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn cmpeq(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn cmpneq(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
pub fn cmpltu(lhs: Expression, rhs: Expression) -> Result<Expression>
[src]
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]
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]
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]
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]
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]
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]
fn into(self) -> Expression
[src]
Performs the conversion.
impl Clone for Expression
[src]
fn clone(&self) -> Expression
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Expression
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Eq for Expression
[src]
impl Hash for Expression
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
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]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for Expression
[src]
fn cmp(&self, __arg_0: &Expression) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl PartialEq for Expression
[src]
fn eq(&self, __arg_0: &Expression) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Expression) -> bool
[src]
This method tests for !=
.
impl PartialOrd for Expression
[src]
fn partial_cmp(&self, __arg_0: &Expression) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Expression) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Expression) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Expression) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Expression) -> bool
[src]
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]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Into<Expression> for Scalar
[src]
fn into(self) -> Expression
[src]
Performs the conversion.
impl Value for Expression
[src]
fn constant(constant: Constant) -> Self
[src]
Turn an il::Constant into a representation of this Value
fn bits(&self) -> usize
[src]
Return the number of bits contained in this value
fn shl(&self, bits: usize) -> Result<Self>
[src]
Shift the value left by the given number of bits
fn shr(&self, bits: usize) -> Result<Self>
[src]
Shift the value right by the given number of bits
fn trun(&self, bits: usize) -> Result<Self>
[src]
Truncate the value to the given number of bits
fn zext(&self, bits: usize) -> Result<Self>
[src]
Zero-extend the value to the given number of bits
fn or(&self, other: &Self) -> Result<Self>
[src]
Or this value with the given value