Struct cranelift_codegen::machinst::vcode::VCodeBuilder [−][src]
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
impl<I: VCodeInst> VCodeBuilder<I>
[src]
pub fn new(
abi: Box<dyn ABICallee<I = I>>,
emit_info: I::Info,
block_order: BlockLoweringOrder,
constants: VCodeConstants
) -> VCodeBuilder<I>
[src]
abi: Box<dyn ABICallee<I = I>>,
emit_info: I::Info,
block_order: BlockLoweringOrder,
constants: VCodeConstants
) -> VCodeBuilder<I>
Create a new VCodeBuilder.
pub fn abi(&mut self) -> &mut dyn ABICallee<I = I>
[src]
Access the ABI object.
pub fn block_order(&self) -> &BlockLoweringOrder
[src]
Access to the BlockLoweringOrder object.
pub fn set_vreg_type(&mut self, vreg: VirtualReg, ty: Type)
[src]
Set the type of a VReg.
pub fn have_ref_values(&self) -> bool
[src]
Are there any reference-typed values at all among the vregs?
pub fn set_entry(&mut self, block: BlockIndex)
[src]
Set the current block as the entry block.
pub fn end_bb(&mut self)
[src]
End the current basic block. Must be called after emitting vcode insts for IR insts and prior to ending the function (building the VCode).
pub fn push(&mut self, insn: I, is_safepoint: bool)
[src]
Push an instruction for the current BB and current IR inst within the BB.
pub fn get_srcloc(&self) -> SourceLoc
[src]
Get the current source location.
pub fn set_srcloc(&mut self, srcloc: SourceLoc)
[src]
Set the current source location.
pub fn constants(&mut self) -> &mut VCodeConstants
[src]
Access the constants.
pub fn build(self) -> (VCode<I>, StackmapRequestInfo)
[src]
Build the final VCode, returning the vcode itself as well as auxiliary information, such as the stack map request information.
Auto Trait Implementations
impl<I> !RefUnwindSafe for VCodeBuilder<I>
impl<I> !Send for VCodeBuilder<I>
impl<I> !Sync for VCodeBuilder<I>
impl<I> Unpin for VCodeBuilder<I> where
I: Unpin,
<I as MachInstEmit>::Info: Unpin,
I: Unpin,
<I as MachInstEmit>::Info: Unpin,
impl<I> !UnwindSafe for VCodeBuilder<I>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,