1 //===- SplitModule.h - Split a module into partitions -----------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
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.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
16 #define LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
18 #include "llvm/ADT/STLExtras.h"
25 /// Splits the module M into N linkable partitions. The function ModuleCallback
26 /// is called N times passing each individual partition as the MPart argument.
28 /// FIXME: This function does not deal with the somewhat subtle symbol
29 /// visibility issues around module splitting, including (but not limited to):
31 /// - Internal symbols should not collide with symbols defined outside the
33 /// - Internal symbols defined in module-level inline asm should be visible to
36 std::unique_ptr
<Module
> M
, unsigned N
,
37 function_ref
<void(std::unique_ptr
<Module
> MPart
)> ModuleCallback
,
38 bool PreserveLocals
= false);
40 } // end namespace llvm
42 #endif // LLVM_TRANSFORMS_UTILS_SPLITMODULE_H