pub struct Module<B>where
    B: Backend,
{ /* private fields */ }
Expand description

A Module is a utility for collecting functions and data objects, and linking them together.

Implementations

Create a new Module.

Get the module identifier for a given name, if that name has been declared.

Return the target information needed by frontends to produce Cranelift IR for the current target.

Create a new Context initialized for use with this Module.

This ensures that the Context is initialized with the default calling convention for the TargetIsa.

Clear the given Context and reset it for use with a new function.

This ensures that the Context is initialized with the default calling convention for the TargetIsa.

Create a new empty Signature with the default calling convention for the TargetIsa, to which parameter and return types can be added for declaring a function to be called by this Module.

Clear the given Signature and reset for use with a new function.

This ensures that the Signature is initialized with the default calling convention for the TargetIsa.

Declare a function in this module.

Declare a data object in this module.

Use this when you’re building the IR of a function to reference a function.

TODO: Coalesce redundant decls and signatures. TODO: Look into ways to reduce the risk of using a FuncRef in the wrong function.

Use this when you’re building the IR of a function to reference a data object.

TODO: Same as above.

TODO: Same as above.

TODO: Same as above.

Define a function, producing the function body from the given Context.

Define a function, producing the data contents from the given DataContext.

Write the address of what into the data for data at offset. data must refer to a defined data object.

Write the address of what plus addend into the data for data at offset. data must refer to a defined data object.

Finalize all functions and data objects that are defined but not yet finalized. All symbols referenced in their bodies that are declared as needing a definition must be defined by this point.

Use get_finalized_function and get_finalized_data to obtain the final artifacts.

Return the finalized artifact from the backend, if it provides one.

Return the finalized artifact from the backend, if it provides one.

Consume the module and return the resulting Product. Some Backend implementations may provide additional functionality available after a Module is complete.

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 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.