Struct cranelift_codegen::machinst::lower::Lower [−][src]
pub struct Lower<'func, I: VCodeInst> { /* fields omitted */ }
Expand description
Machine-independent lowering driver / machine-instruction container. Maintains a correspondence from original Inst to MachInsts.
Implementations
impl<'func, I: VCodeInst> Lower<'func, I>[src]
impl<'func, I: VCodeInst> Lower<'func, I>[src]pub fn new(
f: &'func Function,
abi: Box<dyn ABICallee<I = I>>,
emit_info: I::Info,
block_order: BlockLoweringOrder
) -> CodegenResult<Lower<'func, I>>[src]
pub fn new(
f: &'func Function,
abi: Box<dyn ABICallee<I = I>>,
emit_info: I::Info,
block_order: BlockLoweringOrder
) -> CodegenResult<Lower<'func, I>>[src]Prepare a new lowering context for the given IR function.
pub fn lower<B: LowerBackend<MInst = I>>(
self,
backend: &B
) -> CodegenResult<(VCode<I>, StackmapRequestInfo)>[src]
pub fn lower<B: LowerBackend<MInst = I>>(
self,
backend: &B
) -> CodegenResult<(VCode<I>, StackmapRequestInfo)>[src]Lower the function.
Trait Implementations
impl<'func, I: VCodeInst> LowerCtx for Lower<'func, I>[src]
impl<'func, I: VCodeInst> LowerCtx for Lower<'func, I>[src]type I = I
type I = IThe instruction type for which this lowering framework is instantiated.
fn retval(&self, idx: usize) -> ValueRegs<Writable<Reg>>[src]
fn retval(&self, idx: usize) -> ValueRegs<Writable<Reg>>[src]Get the (virtual) register that receives the return value. A return instruction should lower into a sequence that fills this register. (Why not allow the backend to specify its own result register for the return? Because there may be multiple return points.) Read more
fn get_vm_context(&self) -> Option<Reg>[src]
fn get_vm_context(&self) -> Option<Reg>[src]Returns the vreg containing the VmContext parameter, if there’s one.
fn data(&self, ir_inst: Inst) -> &InstructionData[src]
fn data(&self, ir_inst: Inst) -> &InstructionData[src]Get the instdata for a given IR instruction.
fn call_target<'b>(
&'b self,
ir_inst: Inst
) -> Option<(&'b ExternalName, RelocDistance)>[src]
fn call_target<'b>(
&'b self,
ir_inst: Inst
) -> Option<(&'b ExternalName, RelocDistance)>[src]Get the target for a call instruction, as an ExternalName. Returns a tuple
providing this name and the “relocation distance”, i.e., whether the backend
can assume the target will be “nearby” (within some small offset) or an
arbitrary address. (This comes from the colocated bit in the CLIF.) Read more
fn call_sig<'b>(&'b self, ir_inst: Inst) -> Option<&'b Signature>[src]
fn call_sig<'b>(&'b self, ir_inst: Inst) -> Option<&'b Signature>[src]Get the signature for a call or call-indirect instruction.
fn symbol_value<'b>(
&'b self,
ir_inst: Inst
) -> Option<(&'b ExternalName, RelocDistance, i64)>[src]
fn symbol_value<'b>(
&'b self,
ir_inst: Inst
) -> Option<(&'b ExternalName, RelocDistance, i64)>[src]Get the symbol name, relocation distance estimate, and offset for a symbol_value instruction. Read more
fn memflags(&self, ir_inst: Inst) -> Option<MemFlags>[src]
fn memflags(&self, ir_inst: Inst) -> Option<MemFlags>[src]Returns the memory flags of a given memory access.
fn num_inputs(&self, ir_inst: Inst) -> usize[src]
fn num_inputs(&self, ir_inst: Inst) -> usize[src]Get the number of inputs to the given IR instruction.
fn num_outputs(&self, ir_inst: Inst) -> usize[src]
fn num_outputs(&self, ir_inst: Inst) -> usize[src]Get the number of outputs to the given IR instruction.
fn output_ty(&self, ir_inst: Inst, idx: usize) -> Type[src]
fn output_ty(&self, ir_inst: Inst, idx: usize) -> Type[src]Get the type for an instruction’s output.
fn get_constant(&self, ir_inst: Inst) -> Option<u64>[src]
fn get_constant(&self, ir_inst: Inst) -> Option<u64>[src]Get the value of a constant instruction (iconst, etc.) as a 64-bit
value, if possible. Read more
fn get_input_as_source_or_const(&self, ir_inst: Inst, idx: usize) -> NonRegInput[src]
fn get_input_as_source_or_const(&self, ir_inst: Inst, idx: usize) -> NonRegInput[src]Get the input as one of two options other than a direct register: Read more
fn put_input_in_regs(&mut self, ir_inst: Inst, idx: usize) -> ValueRegs<Reg>[src]
fn put_input_in_regs(&mut self, ir_inst: Inst, idx: usize) -> ValueRegs<Reg>[src]Put the idxth input into register(s) and return the assigned register.
fn get_output(&self, ir_inst: Inst, idx: usize) -> ValueRegs<Writable<Reg>>[src]
fn get_output(&self, ir_inst: Inst, idx: usize) -> ValueRegs<Writable<Reg>>[src]Get the idxth output register(s) of the given IR instruction. When
backend.lower_inst_to_regs(ctx, inst) is called, it is expected that
the backend will write results to these output register(s). This
register will always be “fresh”; it is guaranteed not to overlap with
any of the inputs, and can be freely used as a scratch register within
the lowered instruction sequence, as long as its final value is the
result of the computation. Read more
fn emit_safepoint(&mut self, mach_inst: I)[src]
fn emit_safepoint(&mut self, mach_inst: I)[src]Emit a machine instruction that is a safepoint.
fn sink_inst(&mut self, ir_inst: Inst)[src]
fn sink_inst(&mut self, ir_inst: Inst)[src]Indicate that the side-effect of an instruction has been sunk to the
current scan location. This should only be done with the instruction’s
original results are not used (i.e., put_input_in_regs is not invoked
for the input produced by the sunk instruction), otherwise the
side-effect will occur twice. Read more
fn get_constant_data(&self, constant_handle: Constant) -> &ConstantData[src]
fn get_constant_data(&self, constant_handle: Constant) -> &ConstantData[src]Retrieve constant data given a handle.
fn use_constant(&mut self, constant: VCodeConstantData) -> VCodeConstant[src]
fn use_constant(&mut self, constant: VCodeConstantData) -> VCodeConstant[src]Indicate that a constant should be emitted.
Auto Trait Implementations
impl<'func, I> !RefUnwindSafe for Lower<'func, I>
impl<'func, I> !Send for Lower<'func, I>
impl<'func, I> !Sync for Lower<'func, I>
impl<'func, I> Unpin for Lower<'func, I> where
I: Unpin,
<I as MachInstEmit>::Info: Unpin,
I: Unpin,
<I as MachInstEmit>::Info: Unpin,