Enum cranelift_isle::trie_again::Binding
source · pub enum Binding {
ConstInt {
val: i128,
ty: TypeId,
},
ConstPrim {
val: Sym,
},
Argument {
index: TupleIndex,
},
Extractor {
term: TermId,
parameter: BindingId,
},
Constructor {
term: TermId,
parameters: Box<[BindingId]>,
instance: u32,
},
Iterator {
source: BindingId,
},
MakeVariant {
ty: TypeId,
variant: VariantId,
fields: Box<[BindingId]>,
},
MatchVariant {
source: BindingId,
variant: VariantId,
field: TupleIndex,
},
MatchSome {
source: BindingId,
},
MatchTuple {
source: BindingId,
field: TupleIndex,
},
}
Expand description
Bindings are anything which can be bound to a variable name in Rust. This includes expressions, such as constants or function calls; but it also includes names bound in pattern matches.
Variants§
ConstInt
Fields
Evaluates to the given integer literal.
ConstPrim
Evaluates to the given primitive Rust value.
Argument
Fields
index: TupleIndex
Which of the function’s arguments is this?
One of the arguments to the top-level function.
Extractor
Fields
The result of calling an external extractor.
Constructor
Fields
The result of calling an external constructor.
Iterator
The result of getting one value from a multi-constructor or multi-extractor.
MakeVariant
Fields
The result of constructing an enum variant.
MatchVariant
Fields
variant: VariantId
Which enum variant are we pulling binding sites from? This is somewhat redundant with information in a corresponding Constraint. However, it must be here so that different enum variants aren’t hash-consed into the same binding site.
field: TupleIndex
Which field of this enum variant are we projecting out? Although ISLE uses named fields, we track them by index for constant-time comparisons. The sema::TypeEnv can be used to get the field names.
Pattern-match one of the previous bindings against an enum variant and produce a new binding
from one of its fields. There must be a corresponding Constraint::Variant for each
source
/variant
pair that appears in some MatchVariant
binding.
MatchSome
Pattern-match one of the previous bindings against Option::Some
and produce a new binding
from its contents. There must be a corresponding Constraint::Some for each source
that
appears in a MatchSome
binding. (This currently only happens with external extractors.)
MatchTuple
Fields
field: TupleIndex
Which tuple field are we projecting out?
Pattern-match one of the previous bindings against a tuple and produce a new binding from one of its fields. This is an irrefutable pattern match so there is no corresponding Constraint. (This currently only happens with external extractors.)