[−][src]Struct cranelift_codegen::ir::function::Function
A function.
Functions can be cloned, but it is not a very fast operation. The clone will have all the same entity numbers as the original.
Fields
name: ExternalNameName of this function. Mostly used by .clif files.
signature: SignatureSignature of this function.
old_signature: Option<Signature>The old signature of this function, before the most recent legalization, if any.
stack_slots: StackSlotsStack slots allocated in this function.
global_values: PrimaryMap<GlobalValue, GlobalValueData>Global values referenced.
heaps: PrimaryMap<Heap, HeapData>Heaps referenced.
tables: PrimaryMap<Table, TableData>Tables referenced.
jump_tables: JumpTablesJump tables used in this function.
dfg: DataFlowGraphData flow graph containing the primary definition of all instructions, EBBs and values.
layout: LayoutLayout of EBBs and instructions in the function body.
encodings: InstEncodingsEncoding recipe and bits for the legal instructions.
Illegal instructions have the Encoding::default() value.
locations: ValueLocationsLocation assigned to every value.
entry_diversions: EntryRegDiversionsNon-default locations assigned to value at the entry of basic blocks.
At the entry of each basic block, we might have values which are not in their default ValueLocation. This field records these register-to-register moves as Diversions.
offsets: EbbOffsetsCode offsets of the EBB headers.
This information is only transiently available after the binemit::relax_branches function
computes it, and it can easily be recomputed by calling that function. It is not included
in the textual IR format.
jt_offsets: JumpTableOffsetsCode offsets of Jump Table headers.
srclocs: SourceLocsSource locations.
Track the original source location for each instruction. The source locations are not interpreted by Cranelift, only preserved.
prologue_end: Option<Inst>Instruction that marks the end (inclusive) of the function's prologue.
This is used for some calling conventions to track the end of unwind information.
Methods
impl Function[src]
pub fn with_name_signature(name: ExternalName, sig: Signature) -> Self[src]
Create a function with the given name and signature.
pub fn clear(&mut self)[src]
Clear all data structures in this function.
pub fn new() -> Self[src]
Create a new empty, anonymous function with a Fast calling convention.
pub fn create_jump_table(&mut self, data: JumpTableData) -> JumpTable[src]
Creates a jump table in the function, to be used by br_table instructions.
pub fn create_stack_slot(&mut self, data: StackSlotData) -> StackSlot[src]
Creates a stack slot in the function, to be used by stack_load, stack_store and
stack_addr instructions.
pub fn import_signature(&mut self, signature: Signature) -> SigRef[src]
Adds a signature which can later be used to declare an external function import.
pub fn import_function(&mut self, data: ExtFuncData) -> FuncRef[src]
Declare an external function import.
pub fn create_global_value(&mut self, data: GlobalValueData) -> GlobalValue[src]
Declares a global value accessible to the function.
pub fn create_heap(&mut self, data: HeapData) -> Heap[src]
Declares a heap accessible to the function.
pub fn create_table(&mut self, data: TableData) -> Table[src]
Declares a table accessible to the function.
pub fn display<'a, I: Into<Option<&'a dyn TargetIsa>>>(
&'a self,
isa: I
) -> DisplayFunction<'a>[src]
&'a self,
isa: I
) -> DisplayFunction<'a>
Return an object that can display this function with correct ISA-specific annotations.
pub fn display_with<'a>(
&'a self,
annotations: DisplayFunctionAnnotations<'a>
) -> DisplayFunction<'a>[src]
&'a self,
annotations: DisplayFunctionAnnotations<'a>
) -> DisplayFunction<'a>
Return an object that can display this function with correct ISA-specific annotations.
pub fn special_param(&self, purpose: ArgumentPurpose) -> Option<Value>[src]
Find a presumed unique special-purpose function parameter value.
Returns the value of the last purpose parameter, or None if no such parameter exists.
ⓘImportant traits for InstOffsetIter<'a>pub fn inst_offsets<'a>(
&'a self,
ebb: Ebb,
encinfo: &EncInfo
) -> InstOffsetIter<'a>[src]
&'a self,
ebb: Ebb,
encinfo: &EncInfo
) -> InstOffsetIter<'a>
Get an iterator over the instructions in ebb, including offsets and encoded instruction
sizes.
The iterator returns (offset, inst, size) tuples, where offset if the offset in bytes
from the beginning of the function to the instruction, and size is the size of the
instruction in bytes, or 0 for unencoded instructions.
This function can only be used after the code layout has been computed by the
binemit::relax_branches() function.
pub fn update_encoding(
&mut self,
inst: Inst,
isa: &dyn TargetIsa
) -> Result<(), Legalize>[src]
&mut self,
inst: Inst,
isa: &dyn TargetIsa
) -> Result<(), Legalize>
Wrapper around encode which assigns inst the resulting encoding.
pub fn encode(
&self,
inst: Inst,
isa: &dyn TargetIsa
) -> Result<Encoding, Legalize>[src]
&self,
inst: Inst,
isa: &dyn TargetIsa
) -> Result<Encoding, Legalize>
Wrapper around TargetIsa::encode for encoding an existing instruction
in the Function.
pub fn collect_debug_info(&mut self)[src]
Starts collection of debug information.
pub fn change_branch_destination(&mut self, inst: Inst, new_dest: Ebb)[src]
Changes the destination of a jump or branch instruction. Does nothing if called with a non-jump or non-branch instruction.
pub fn is_ebb_basic(&self, ebb: Ebb) -> Result<(), (Inst, &'static str)>[src]
Checks that the specified EBB can be encoded as a basic block.
On error, returns the first invalid instruction and an error message.
Trait Implementations
Auto Trait Implementations
impl Unpin for Function
impl Send for Function
impl Sync for Function
impl UnwindSafe for Function
impl RefUnwindSafe for Function
Blanket Implementations
impl<T> From<T> for T[src]
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.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,