cranelift_isle::sema

Trait ExprVisitor

source
pub trait ExprVisitor {
    type ExprId: Copy;

    // Required methods
    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_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§