Trait cranelift_codegen::machinst::MachInst[][src]

pub trait MachInst: Clone + Debug {
    type LabelUse: MachInstLabelUse;
    fn get_regs(&self, collector: &mut RegUsageCollector<'_>);
fn map_regs<RUM: RegUsageMapper>(&mut self, maps: &RUM);
fn is_move(&self) -> Option<(Writable<Reg>, Reg)>;
fn is_term<'a>(&'a self) -> MachTerminator<'a>;
fn is_epilogue_placeholder(&self) -> bool;
fn gen_move(to_reg: Writable<Reg>, from_reg: Reg, ty: Type) -> Self;
fn gen_constant<F: FnMut(Type) -> Writable<Reg>>(
        to_regs: ValueRegs<Writable<Reg>>,
        value: u128,
        ty: Type,
        alloc_tmp: F
    ) -> SmallVec<[Self; 4]>;
fn gen_zero_len_nop() -> Self;
fn maybe_direct_reload(
        &self,
        reg: VirtualReg,
        slot: SpillSlot
    ) -> Option<Self>;
fn rc_for_type(
        ty: Type
    ) -> CodegenResult<(&'static [RegClass], &'static [Type])>;
fn gen_jump(target: MachLabel) -> Self;
fn gen_nop(preferred_size: usize) -> Self;
fn reg_universe(flags: &Flags) -> RealRegUniverse;
fn worst_case_size() -> CodeOffset;
fn ref_type_regclass(_flags: &Flags) -> RegClass; fn is_included_in_clobbers(&self) -> bool { ... }
fn align_basic_block(offset: CodeOffset) -> CodeOffset { ... } }

A machine instruction.

Associated Types

type LabelUse: MachInstLabelUse[src]

A label-use kind: a type that describes the types of label references that can occur in an instruction.

Loading content...

Required methods

fn get_regs(&self, collector: &mut RegUsageCollector<'_>)[src]

Return the registers referenced by this machine instruction along with the modes of reference (use, def, modify).

fn map_regs<RUM: RegUsageMapper>(&mut self, maps: &RUM)[src]

Map virtual registers to physical registers using the given virt->phys maps corresponding to the program points prior to, and after, this instruction.

fn is_move(&self) -> Option<(Writable<Reg>, Reg)>[src]

If this is a simple move, return the (source, destination) tuple of registers.

fn is_term<'a>(&'a self) -> MachTerminator<'a>[src]

Is this a terminator (branch or ret)? If so, return its type (ret/uncond/cond) and target if applicable.

fn is_epilogue_placeholder(&self) -> bool[src]

Returns true if the instruction is an epilogue placeholder.

fn gen_move(to_reg: Writable<Reg>, from_reg: Reg, ty: Type) -> Self[src]

Generate a move.

fn gen_constant<F: FnMut(Type) -> Writable<Reg>>(
    to_regs: ValueRegs<Writable<Reg>>,
    value: u128,
    ty: Type,
    alloc_tmp: F
) -> SmallVec<[Self; 4]>
[src]

Generate a constant into a reg.

fn gen_zero_len_nop() -> Self[src]

Generate a zero-length no-op.

fn maybe_direct_reload(&self, reg: VirtualReg, slot: SpillSlot) -> Option<Self>[src]

Possibly operate on a value directly in a spill-slot rather than a register. Useful if the machine has register-memory instruction forms (e.g., add directly from or directly to memory), like x86.

fn rc_for_type(
    ty: Type
) -> CodegenResult<(&'static [RegClass], &'static [Type])>
[src]

Determine register class(es) to store the given Cranelift type, and the Cranelift type actually stored in the underlying register(s). May return an error if the type isn’t supported by this backend.

If the type requires multiple registers, then the list of registers is returned in little-endian order.

Note that the type actually stored in the register(s) may differ in the case that a value is split across registers: for example, on a 32-bit target, an I64 may be stored in two registers, each of which holds an I32. The actually-stored types are used only to inform the backend when generating spills and reloads for individual registers.

fn gen_jump(target: MachLabel) -> Self[src]

Generate a jump to another target. Used during lowering of control flow.

fn gen_nop(preferred_size: usize) -> Self[src]

Generate a NOP. The preferred_size parameter allows the caller to request a NOP of that size, or as close to it as possible. The machine backend may return a NOP whose binary encoding is smaller than the preferred size, but must not return a NOP that is larger. However, the instruction must have a nonzero size.

fn reg_universe(flags: &Flags) -> RealRegUniverse[src]

Get the register universe for this backend.

fn worst_case_size() -> CodeOffset[src]

What is the worst-case instruction size emitted by this instruction type?

fn ref_type_regclass(_flags: &Flags) -> RegClass[src]

What is the register class used for reference types (GC-observable pointers)? Can be dependent on compilation flags.

Loading content...

Provided methods

fn is_included_in_clobbers(&self) -> bool[src]

Should this instruction be included in the clobber-set?

fn align_basic_block(offset: CodeOffset) -> CodeOffset[src]

Align a basic block offset (from start of function). By default, no alignment occurs.

Loading content...

Implementors

Loading content...