pub struct VCodeBuilder<I: VCodeInst> { /* private fields */ }
Expand description

A builder for a VCode function body. This builder is designed for the lowering approach that we take: we traverse basic blocks in forward (original IR) order, but within each basic block, we generate code from bottom to top; and within each IR instruction that we visit in this reverse order, we emit machine instructions in forward order again.

Hence, to produce the final instructions in proper order, we perform two swaps. First, the machine instructions (I instances) are produced in forward order for an individual IR instruction. Then these are reversed and concatenated to bb_insns at the end of the IR instruction lowering. The bb_insns vec will thus contain all machine instructions for a basic block, in reverse order. Finally, when we’re done with a basic block, we reverse the whole block’s vec of instructions again, and concatenate onto the VCode’s insts.

Implementations

Create a new VCodeBuilder.

Access the ABI object.

Access to the BlockLoweringOrder object.

Set the type of a VReg.

Are there any reference-typed values at all among the vregs?

source

pub fn set_entry(&mut self, block: BlockIndex)

Set the current block as the entry block.

End the current basic block. Must be called after emitting vcode insts for IR insts and prior to ending the function (building the VCode).

Push an instruction for the current BB and current IR inst within the BB.

Get the current source location.

Set the current source location.

Access the constants.

Build the final VCode, returning the vcode itself as well as auxiliary information, such as the stack map request information.

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

Returns the argument unchanged.

Calls U::from(self).

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

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.