pub struct Expr {
pub kind: Kind,
pub children: SmallVec<[Arc<Expr>; 2]>,
}Expand description
Expression tree node. Owns its children via Box in a SmallVec so that
the common binary-op case stays inline (no heap allocation for the vector
std::unique_ptr<Expr> semantics).
Fields§
§kind: Kind§children: SmallVec<[Arc<Expr>; 2]>Implementations§
Source§impl Expr
impl Expr
pub fn constant(val: u64) -> Arc<Self> ⓘ
pub fn variable(index: u32) -> Arc<Self> ⓘ
pub fn add(lhs: Arc<Self>, rhs: Arc<Self>) -> Arc<Self> ⓘ
pub fn mul(lhs: Arc<Self>, rhs: Arc<Self>) -> Arc<Self> ⓘ
pub fn and(lhs: Arc<Self>, rhs: Arc<Self>) -> Arc<Self> ⓘ
pub fn or(lhs: Arc<Self>, rhs: Arc<Self>) -> Arc<Self> ⓘ
pub fn xor(lhs: Arc<Self>, rhs: Arc<Self>) -> Arc<Self> ⓘ
pub fn not(operand: Arc<Self>) -> Arc<Self> ⓘ
pub fn neg(operand: Arc<Self>) -> Arc<Self> ⓘ
Sourcepub fn shr(operand: Arc<Self>, amount: u64) -> Arc<Self> ⓘ
pub fn shr(operand: Arc<Self>, amount: u64) -> Arc<Self> ⓘ
Logical right shift. amount >= 64 is accepted and will evaluate to 0
Sourcepub fn zext(child: Arc<Self>, w: u32) -> Arc<Self> ⓘ
pub fn zext(child: Arc<Self>, w: u32) -> Arc<Self> ⓘ
Zero-extend child to width w. Result width is w.
Sourcepub fn sext(child: Arc<Self>, w: u32) -> Arc<Self> ⓘ
pub fn sext(child: Arc<Self>, w: u32) -> Arc<Self> ⓘ
Sign-extend child to width w. Result width is w.
Sourcepub fn trunc(child: Arc<Self>, w: u32) -> Arc<Self> ⓘ
pub fn trunc(child: Arc<Self>, w: u32) -> Arc<Self> ⓘ
Truncate child to its low w bits. Result width is w.
Sourcepub fn concat(lhs: Arc<Self>, rhs: Arc<Self>) -> Arc<Self> ⓘ
pub fn concat(lhs: Arc<Self>, rhs: Arc<Self>) -> Arc<Self> ⓘ
Concatenate lhs (high part) with rhs (low part). Result width is
the sum of the two child widths.
Sourcepub fn clone_tree(&self) -> Arc<Self> ⓘ
pub fn clone_tree(&self) -> Arc<Self> ⓘ
deep copy. Clone already does this via derive(Clone); this is
Trait Implementations§
impl Eq for Expr
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more