cranelift_isle::sema

Trait ExprVisitor

Source
pub trait ExprVisitor {
    type ExprId: Copy;

    // Required methods
    fn add_const_bool(&mut self, ty: TypeId, val: bool) -> Self::ExprId;
    fn add_const_int(&mut self, ty: TypeId, val: i128) -> Self::ExprId;
    fn add_const_prim(&mut self, ty: TypeId, val: Sym) -> Self::ExprId;
    fn add_create_variant(
        &mut self,
        inputs: Vec<(Self::ExprId, TypeId)>,
        ty: TypeId,
        variant: VariantId,
    ) -> Self::ExprId;
    fn add_construct(
        &mut self,
        inputs: Vec<(Self::ExprId, TypeId)>,
        ty: TypeId,
        term: TermId,
        pure: bool,
        infallible: bool,
        multi: bool,
    ) -> Self::ExprId;
}
Expand description

Visitor interface for Exprs. Visitors can return an arbitrary identifier for each subexpression, which is threaded through to subsequent calls into the visitor.

Required Associated Types§

Source

type ExprId: Copy

The type of subexpression identifiers.

Required Methods§

Source

fn add_const_bool(&mut self, ty: TypeId, val: bool) -> Self::ExprId

Construct a constant boolean.

Source

fn add_const_int(&mut self, ty: TypeId, val: i128) -> Self::ExprId

Construct a constant integer.

Source

fn add_const_prim(&mut self, ty: TypeId, val: Sym) -> Self::ExprId

Construct a primitive constant.

Source

fn add_create_variant( &mut self, inputs: Vec<(Self::ExprId, TypeId)>, ty: TypeId, variant: VariantId, ) -> Self::ExprId

Construct an enum variant with the given inputs assigned to the variant’s fields in order.

Source

fn add_construct( &mut self, inputs: Vec<(Self::ExprId, TypeId)>, ty: TypeId, term: TermId, pure: bool, infallible: bool, multi: bool, ) -> Self::ExprId

Call an external constructor with the given inputs as arguments.

Implementors§