LLVM 22.0.0git
SplitModule.h
Go to the documentation of this file.
1//===- SplitModule.h - Split a module into partitions -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the function llvm::SplitModule, which splits a module
10// into multiple linkable partitions. It can be used to implement parallel code
11// generation for link-time optimization.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
16#define LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
17
20#include <memory>
21
22namespace llvm {
23
24class Module;
25
26/// Splits the module M into N linkable partitions. The function ModuleCallback
27/// is called N times passing each individual partition as the MPart argument.
28/// PreserveLocals: Split without externalizing locals.
29/// RoundRobin: Use round-robin distribution of functions to modules instead
30/// of the default name-hash-based one.
31///
32/// FIXME: This function does not deal with the somewhat subtle symbol
33/// visibility issues around module splitting, including (but not limited to):
34///
35/// - Internal symbols should not collide with symbols defined outside the
36/// module.
37/// - Internal symbols defined in module-level inline asm should be visible to
38/// each partition.
39LLVM_ABI void
40SplitModule(Module &M, unsigned N,
41 function_ref<void(std::unique_ptr<Module> MPart)> ModuleCallback,
42 bool PreserveLocals = false, bool RoundRobin = false);
43
44} // end namespace llvm
45
46#endif // LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
#define LLVM_ABI
Definition Compiler.h:213
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
An efficient, type-erasing, non-owning reference to a callable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void SplitModule(Module &M, unsigned N, function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback, bool PreserveLocals=false, bool RoundRobin=false)
Splits the module M into N linkable partitions.
#define N