Module inline

Source
Expand description

Function inlining infrastructure.

This module provides “inlining as a library” to Cranelift users; it does not provide a complete, off-the-shelf inlining solution. Cranelift’s compilation context is per-function and does not encompass the full call graph. It does not know which functions are hot and which are cold, which have been marked the equivalent of #[inline(never)], etc… Only the Cranelift user can understand these aspects of the full compilation pipeline, and these things can be very different between (say) Wasmtime and cg_clif. Therefore, this module does not attempt to define hueristics for when inlining a particular call is likely beneficial. This module only provides hooks for the Cranelift user to define whether a given call should be inlined or not, and the mechanics to inline a callee into a particular call site when directed to do so by the Cranelift user.

The top-level inlining entry point during Cranelift compilation is Context::inline. It takes an Inline trait implementation, which is authored by the Cranelift user and directs Cranelift whether to inline a particular call, and, when inlining, gives Cranelift the body of the callee that is to be inlined.

Enums§

InlineCommand
A command directing Cranelift whether or not to inline a particular call.

Traits§

Inline
A trait for directing Cranelift whether to inline a particular call or not.