pub struct Function {
    pub name: UserFuncName,
    pub stencil: FunctionStencil,
    pub params: FunctionParameters,
}
Expand description

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

Name of this function.

Mostly used by .clif files, only there for debugging / naming purposes.

stencil: FunctionStencil

All the fields required for compiling a function, independently of details irrelevant to compilation and that are stored in the FunctionParameters params field instead.

params: FunctionParameters

All the parameters that can be applied onto the function stencil, that is, that don’t matter when caching compilation artifacts.

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.

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

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

Sets an absolute source location for the given instruction.

If no base source location has been set yet, records it at the same time.

Returns an absolute source location for the given instruction.

Declare a user-defined external function import, to be referenced in ExtFuncData::User later.

Declare an external function import.

Methods from Deref<Target = FunctionStencil>

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

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

Creates a dynamic stack slot in the function, to be used by dynamic_stack_load, dynamic_stack_store and dynamic_stack_addr instructions.

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

Declares a global value accessible to the function.

Find the global dyn_scale value associated with given DynamicType

Find the global dyn_scale for the given stack slot.

Get a concrete Type from a user defined DynamicType.

Declares a heap accessible to the function.

Declares a table accessible to the function.

Find a presumed unique special-purpose function parameter value.

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

Starts collection of debug information.

Changes the destination of a jump or branch instruction. Does nothing if called with a non-jump or non-branch instruction.

Note that this method ignores multi-destination branches like br_table.

Rewrite the branch destination to new_dest if the destination matches old_dest. Does nothing if called with a non-jump or non-branch instruction.

Unlike change_branch_destination, this method rewrite the destinations of multi-destination branches like br_table.

Checks that the specified block can be encoded as a basic block.

On error, returns the first invalid instruction and an error message.

Returns true if the function is function that doesn’t call any other functions. This is not to be confused with a “leaf function” in Windows terminology.

Replace the dst instruction’s data with the src instruction’s data and then remove src.

src and its result values should not be used at all, as any uses would be left dangling after calling this method.

src and dst must have the same number of resulting values, and src’s i^th value must have the same type as dst’s i^th value.

Size occupied by all stack slots associated with this function.

Does not include any padding necessary due to offsets

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
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
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.