Struct cranelift_isle::ir::PatternSequence
source · pub struct PatternSequence {
pub insts: Vec<PatternInst>,
}
Expand description
A linear sequence of instructions that match on and destructure an
argument. A pattern is fallible (may not match). If it does not fail, its
result consists of the values produced by the PatternInst
s, which may be
used by a subsequent Expr
.
Fields
insts: Vec<PatternInst>
Instruction sequence for pattern.
InstId
indexes into this sequence for Value::Pattern
values.
Trait Implementations
sourceimpl Clone for PatternSequence
impl Clone for PatternSequence
sourcefn clone(&self) -> PatternSequence
fn clone(&self) -> PatternSequence
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for PatternSequence
impl Debug for PatternSequence
sourceimpl Default for PatternSequence
impl Default for PatternSequence
sourcefn default() -> PatternSequence
fn default() -> PatternSequence
Returns the “default value” for a type. Read more
sourceimpl Hash for PatternSequence
impl Hash for PatternSequence
sourceimpl PartialEq<PatternSequence> for PatternSequence
impl PartialEq<PatternSequence> for PatternSequence
sourcefn eq(&self, other: &PatternSequence) -> bool
fn eq(&self, other: &PatternSequence) -> bool
sourceimpl PatternVisitor for PatternSequence
impl PatternVisitor for PatternSequence
sourcefn add_match_equal(&mut self, a: Value, b: Value, ty: TypeId)
fn add_match_equal(&mut self, a: Value, b: Value, ty: TypeId)
Match if
a
and b
have equal values.sourcefn add_match_int(&mut self, input: Value, ty: TypeId, int_val: i128)
fn add_match_int(&mut self, input: Value, ty: TypeId, int_val: i128)
Match if
input
is the given integer constant.sourcefn add_match_prim(&mut self, input: Value, ty: TypeId, val: Sym)
fn add_match_prim(&mut self, input: Value, ty: TypeId, val: Sym)
Match if
input
is the given primitive constant.sourcefn add_match_variant(
&mut self,
input: Value,
input_ty: TypeId,
arg_tys: &[TypeId],
variant: VariantId
) -> Vec<Value>
fn add_match_variant(
&mut self,
input: Value,
input_ty: TypeId,
arg_tys: &[TypeId],
variant: VariantId
) -> Vec<Value>
Match if
input
is the given enum variant. Returns an identifier for each field within the
enum variant. The length of the return list must equal the length of arg_tys
. Read moresourcefn add_extract(
&mut self,
input: Value,
input_ty: TypeId,
output_tys: Vec<TypeId>,
term: TermId,
infallible: bool,
multi: bool
) -> Vec<Value>
fn add_extract(
&mut self,
input: Value,
input_ty: TypeId,
output_tys: Vec<TypeId>,
term: TermId,
infallible: bool,
multi: bool
) -> Vec<Value>
Match if the given external extractor succeeds on
input
. Returns an identifier for each
return value from the external extractor. The length of the return list must equal the
length of output_tys
. Read moresourceimpl RuleVisitor for PatternSequence
impl RuleVisitor for PatternSequence
type PatternVisitor = PatternSequence
type PatternVisitor = PatternSequence
The type of pattern visitors constructed by RuleVisitor::add_pattern.
type ExprVisitor = ExprSequence
type ExprVisitor = ExprSequence
The type of expression visitors constructed by RuleVisitor::add_expr.
type Expr = ReturnExpr
type Expr = ReturnExpr
The type returned from RuleVisitor::add_expr, which may be exchanged for a subpattern
identifier using RuleVisitor::expr_as_pattern. Read more
sourcefn add_arg(&mut self, index: usize, ty: TypeId) -> Value
fn add_arg(&mut self, index: usize, ty: TypeId) -> Value
Visit one of the arguments to the top-level pattern.
sourcefn add_pattern<F: FnOnce(&mut Self)>(&mut self, visitor: F)
fn add_pattern<F: FnOnce(&mut Self)>(&mut self, visitor: F)
Visit a pattern, used once for the rule’s left-hand side and once for each if-let. You can
determine which part of the rule the pattern comes from based on whether the
PatternId
passed to the first call to this visitor came from add_arg
or expr_as_pattern
. Read moresourcefn add_expr<F>(&mut self, visitor: F) -> ReturnExprwhere
F: FnOnce(&mut ExprSequence) -> VisitedExpr<ExprSequence>,
fn add_expr<F>(&mut self, visitor: F) -> ReturnExprwhere
F: FnOnce(&mut ExprSequence) -> VisitedExpr<ExprSequence>,
Visit an expression, used once for each if-let and once for the rule’s right-hand side.
sourcefn expr_as_pattern(&mut self, expr: ReturnExpr) -> Value
fn expr_as_pattern(&mut self, expr: ReturnExpr) -> Value
Given an expression from RuleVisitor::add_expr, return an identifier that can be used with
a pattern visitor in RuleVisitor::add_pattern. Read more
sourcefn pattern_as_expr(&mut self, pattern: Value) -> Value
fn pattern_as_expr(&mut self, pattern: Value) -> Value
Given an identifier from the pattern visitor, return an identifier that can be used with
the expression visitor. Read more
impl Eq for PatternSequence
impl StructuralEq for PatternSequence
impl StructuralPartialEq for PatternSequence
Auto Trait Implementations
impl RefUnwindSafe for PatternSequence
impl Send for PatternSequence
impl Sync for PatternSequence
impl Unpin for PatternSequence
impl UnwindSafe for PatternSequence
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more