workflow::preprocess

Function inline_functions

Source
pub fn inline_functions(
    wir: Workflow,
    calls: &mut HashMap<ProgramCounter, usize>,
) -> Workflow
Expand description

Attempts to inline functions in the WIR as much as possible.

The only moment when we don’t is if the function call is:

  • Recursive
  • A builtin
  • Undecidable

§Arguments

  • wir: The input WIR to simply.
  • calls: The map of call indices to which function is actually called.

§Returns

The same wir as given, but then optimized.

§Errors

This function may error if the input workflow is incoherent.