pub struct Block(pub Index);
Expand description

A wrapper around an ECS handle into the Context.

Tuple Fields

0: Index

Implementations

Return a new block handle.

Creates a new Block belonging to function in the context and returns its handle. label is optional and is used only when printing the IR.

Get the parent function for this block.

Create a new InstructionIterator to more easily append instructions to this block.

Get the label of this block. If it wasn’t given one upon creation it will be a generated label.

Get the phi instruction for this block.

Add a new phi entry to this block.

This indicates that if control flow comes from from_block then the phi instruction should use phi_value.

Get the value from the phi instruction which correlates to from_block.

Returns None if from_block isn’t found.

Replace a block reference in the phi instruction.

Any reference to old_source will be replace with new_source in the list of phi values.

Get a reference to the block terminator.

Returns None if block is empty.

Replace a value within this block.

For every instruction within the block, any reference to old_val is replaced with new_val.

Remove an instruction from this block.

NOTE: We must be very careful! We mustn’t remove the phi or the terminator. Some extra checks should probably be performed here to avoid corruption! Using Vec::remove() is also O(n) which we may want to avoid someday.

Split the block into two.

This will create a new block and move the instructions at and following split_idx to it. Returns both blocks.

Return an instruction iterator for each instruction in this block.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.