pub struct Function {
Show 14 fields pub name: ExternalName, pub signature: Signature, pub stack_slots: StackSlots, pub global_values: PrimaryMap<GlobalValue, GlobalValueData>, pub heaps: PrimaryMap<Heap, HeapData>, pub tables: PrimaryMap<Table, TableData>, pub jump_tables: JumpTables, pub dfg: DataFlowGraph, pub layout: Layout, pub encodings: InstEncodings, pub locations: ValueLocations, pub offsets: EbbOffsets, pub jt_offsets: JumpTableOffsets, pub srclocs: SourceLocs,
}
Expand description

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: ExternalName

Name of this function. Mostly used by .clif files.

§signature: Signature

Signature of this function.

§stack_slots: StackSlots

Stack 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: JumpTables

Jump tables used in this function.

§dfg: DataFlowGraph

Data flow graph containing the primary definition of all instructions, EBBs and values.

§layout: Layout

Layout of EBBs and instructions in the function body.

§encodings: InstEncodings

Encoding recipe and bits for the legal instructions. Illegal instructions have the Encoding::default() value.

§locations: ValueLocations

Location assigned to every value.

§offsets: EbbOffsets

Code 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: JumpTableOffsets

Code offsets of Jump Table headers.

§srclocs: SourceLocs

Source locations.

Track the original source location for each instruction. The source locations are not interpreted by Cranelift, only preserved.

Implementations§

Create a function with the given name and signature.

Clear all data structures in this function.

Create a new empty, anonymous function with a Fast calling convention.

Creates a jump table in the function, to be used by br_table instructions.

Creates a stack slot in the function, to be used by stack_load, stack_store and stack_addr instructions.

Adds a signature which can later be used to declare an external function import.

Declare an external function import.

Declares a global value accessible to the function.

Declares a heap accessible to the function.

Declares a table accessible to the function.

Return an object that can display this function with correct ISA-specific annotations.

Find a presumed unique special-purpose function parameter value.

Returns the value of the last purpose parameter, or None if no such parameter exists.

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.

Wrapper around encode which assigns inst the resulting encoding.

Wrapper around TargetIsa::encode for encoding an existing instruction in the Function.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
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.