Skip to main content

Statement

Enum Statement 

Source
pub enum Statement {
Show 15 variants LocalDecl { name: String, name_span: SourceSpan, display_name: String, size_bytes: usize, span: SourceSpan, }, Assign { name: String, name_span: SourceSpan, expr: ExprNode, decl_struct_ptr: Option<String>, span: SourceSpan, }, Expr(ExprNode), LabelDecl { label: Label, span: SourceSpan, }, Branch { target: Label, args: BlockArgs, span: SourceSpan, }, BranchInd { ptr: TypedAtom, targets: Vec<Label>, span: SourceSpan, }, Switch { scrutinee: TypedAtom, cases: Vec<SwitchCase>, default: Option<(Label, BlockArgs)>, span: SourceSpan, }, CBranch { condition: TypedAtom, target: Label, target_args: BlockArgs, fallthrough: Label, fallthrough_args: BlockArgs, span: SourceSpan, }, Call { target: Callee, tail: bool, args: BlockArgs, targets: Vec<Label>, span: SourceSpan, }, CallInd { ptr: TypedAtom, args: Vec<TypedAtom>, targets: Vec<Label>, span: SourceSpan, }, Return { ptr: TypedAtom, value: Option<TypedAtom>, span: SourceSpan, }, ReturnValue { value: TypedAtom, span: SourceSpan, }, BadInsn { span: SourceSpan, }, Assert { condition: TypedAtom, span: SourceSpan, }, Commented { comment: String, inner: Box<Statement>, },
}

Variants§

§

LocalDecl

Fields

§name: String
§name_span: SourceSpan
§display_name: String
§size_bytes: usize
§

Assign

Fields

§name: String
§name_span: SourceSpan
§decl_struct_ptr: Option<String>

A Foo* struct-pointer type declared on the assignment, if any. When present, the result value is retyped to that struct pointer (used to seed struct typing in tests). A plain iN/fN declared type is not recorded here — it only drives size coercion of the rhs.

§

Expr(ExprNode)

§

LabelDecl

Fields

§label: Label
§

Branch

Fields

§target: Label
§args: BlockArgs

Per-parameter arguments: (param_name, value) in declaration order. Non-empty when the branch was written as goto <block @v1=e1 @v2=e2>.

§

BranchInd

Fields

§targets: Vec<Label>

Resolved jump targets, from a // -> <a>, <b> edge hint. The indirect jump’s own syntax encodes no successors, so without this the block has no out-edges.

§

Switch

Multi-way dispatch: switch %idx { 0x0 => <a>, default => <d> }.

Fields

§scrutinee: TypedAtom
§cases: Vec<SwitchCase>

(case value, target, per-parameter arguments) in written order.

§default: Option<(Label, BlockArgs)>

The default => <block> arm, when written.

§

CBranch

Fields

§condition: TypedAtom
§target: Label
§target_args: BlockArgs
§fallthrough: Label
§fallthrough_args: BlockArgs
§

Call

Fields

§target: Callee
§tail: bool

true for tailcall fn ..., which has no return-edge hint.

§args: BlockArgs

Arguments passed to the callee, one per inferred callee input, in order. The name in each pair is the callee’s parameter name as printed (@r0, @arg1, …); it is decorative and discarded on lowering, where only the positional atoms matter.

§targets: Vec<Label>

The call’s return (fall-through) block(s), from a // -> <ret> edge hint. A call terminates its block; this records where control resumes after the callee returns. Empty for a non-returning call.

§

CallInd

Fields

§args: Vec<TypedAtom>

Positional arguments passed to the indirect callee.

§targets: Vec<Label>

The call’s return (fall-through) block(s), from a // -> <ret> edge hint. See Statement::Call.

§

Return

§

ReturnValue

Fields

§

BadInsn

Bytes that did not decode to a valid instruction; a terminator with no successors and no operands.

Fields

§

Assert

Fields

§condition: TypedAtom
§

Commented

A comment attached to this statement, written as # text on the preceding line.

Fields

§comment: String

Implementations§

Source§

impl Statement

Source

pub fn inner(&self) -> &Statement

Strips any wrapping Commented variant and returns the inner statement.

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Statement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Statement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.