Splits a module into multiple linkable partitions.

Synopsis

Declared in <llvm/Transforms/Utils/SplitModule.h>

void
SplitModule(
    Module& M,
    unsigned int N,
    function_ref<void(std::unique_ptr<Module>)> ModuleCallback,
    bool PreserveLocals = false,
    bool RoundRobin = false);

Description

ModuleCallback is called N times, passing each individual partition as the MPart argument.

FIXME: This function does not deal with the somewhat subtle symbol visibility issues around module splitting, including (but not limited to):

  • Internal symbols should not collide with symbols defined outside the module.

  • Internal symbols defined in module‐level inline asm should be visible to each partition.

Parameters

Name

Description

M

Module to split.

N

Number of linkable partitions to produce.

ModuleCallback

Callback invoked once per partition with that partition.

PreserveLocals

If true, split without externalizing locals.

RoundRobin

If true, use round‐robin distribution of functions to modules instead of the default name‐hash‐based one.

Created with MrDocs