pub enum Expression {
InfixOp {
meta: Meta,
lhe: Box<Expression>,
infix_op: ExpressionInfixOpcode,
rhe: Box<Expression>,
},
PrefixOp {
meta: Meta,
prefix_op: ExpressionPrefixOpcode,
rhe: Box<Expression>,
},
SwitchOp {
meta: Meta,
cond: Box<Expression>,
if_true: Box<Expression>,
if_false: Box<Expression>,
},
Variable {
meta: Meta,
name: VariableName,
},
Number(Meta, BigInt),
Call {
meta: Meta,
name: String,
args: Vec<Expression>,
},
InlineArray {
meta: Meta,
values: Vec<Expression>,
},
Access {
meta: Meta,
var: VariableName,
access: Vec<AccessType>,
},
Update {
meta: Meta,
var: VariableName,
access: Vec<AccessType>,
rhe: Box<Expression>,
},
Phi {
meta: Meta,
args: Vec<VariableName>,
},
}Variants§
InfixOp
An infix operation of the form lhe * rhe.
PrefixOp
A prefix operation of the form * rhe.
SwitchOp
An inline switch operation (or inline if-then-else) of the form cond? if_true: if_false.
Variable
A local variable, signal, or component.
Number(Meta, BigInt)
A constant field element.
Call
A function call node.
InlineArray
An inline array on the form [value, ...].
Access
An Access node represents an array access of the form a[i]...[k].
Update
Updates of the form var[i]...[k] = rhe lift to IR statements of the
form var = update(var, (i, ..., k), rhe). This is needed when we
convert the CFG to SSA. Since arrays are versioned atomically, we need
to track which version of the array that is updated to obtain the new
version. (This is needed to track variable use, dead assignments, and
data flow.)
Note: The type metadata in meta tracks the type of the variable var.
Phi
An SSA phi-expression.
Implementations§
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl DegreeMeta for Expression
impl DegreeMeta for Expression
Source§fn propagate_degrees(&mut self, env: &DegreeEnvironment) -> bool
fn propagate_degrees(&mut self, env: &DegreeEnvironment) -> bool
Source§fn degree(&self) -> Option<&DegreeRange>
fn degree(&self) -> Option<&DegreeRange>
Source§impl Display for Expression
impl Display for Expression
Source§impl Hash for Expression
impl Hash for Expression
Source§impl PartialEq for Expression
Syntactic equality for expressions.
impl PartialEq for Expression
Syntactic equality for expressions.
Source§impl TypeMeta for Expression
impl TypeMeta for Expression
Source§fn propagate_types(&mut self, vars: &Declarations)
fn propagate_types(&mut self, vars: &Declarations)
Source§fn is_component(&self) -> bool
fn is_component(&self) -> bool
Source§fn variable_type(&self) -> Option<&VariableType>
fn variable_type(&self) -> Option<&VariableType>
None.