sway_ir::optimize::inline

Function is_small_fn

Source
pub fn is_small_fn(
    max_blocks: Option<usize>,
    max_instrs: Option<usize>,
    max_stack_size: Option<usize>,
) -> impl Fn(&Context<'_>, &Function, &Value) -> bool
Expand description

A utility to get a predicate which can be passed to inline_some_function_calls() based on certain sizes of the function. If a constraint is None then any size is assumed to be acceptable.

The max_stack_size is a bit tricky, as the IR doesn’t really know (or care) about the size of types. See the source code for how it works.