1292915Sdim//===- SplitModule.h - Split a module into partitions -----------*- C++ -*-===//
2292915Sdim//
3292915Sdim//                     The LLVM Compiler Infrastructure
4292915Sdim//
5292915Sdim// This file is distributed under the University of Illinois Open Source
6292915Sdim// License. See LICENSE.TXT for details.
7292915Sdim//
8292915Sdim//===----------------------------------------------------------------------===//
9292915Sdim//
10292915Sdim// This file defines the function llvm::SplitModule, which splits a module
11292915Sdim// into multiple linkable partitions. It can be used to implement parallel code
12292915Sdim// generation for link-time optimization.
13292915Sdim//
14292915Sdim//===----------------------------------------------------------------------===//
15292915Sdim
16292915Sdim#ifndef LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
17292915Sdim#define LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
18292915Sdim
19292915Sdim#include <functional>
20292915Sdim#include <memory>
21292915Sdim
22292915Sdimnamespace llvm {
23292915Sdim
24292915Sdimclass Module;
25292915Sdimclass StringRef;
26292915Sdim
27292915Sdim/// Splits the module M into N linkable partitions. The function ModuleCallback
28292915Sdim/// is called N times passing each individual partition as the MPart argument.
29292915Sdim///
30292915Sdim/// FIXME: This function does not deal with the somewhat subtle symbol
31292915Sdim/// visibility issues around module splitting, including (but not limited to):
32292915Sdim///
33292915Sdim/// - Internal symbols should not collide with symbols defined outside the
34292915Sdim///   module.
35292915Sdim/// - Internal symbols defined in module-level inline asm should be visible to
36292915Sdim///   each partition.
37292915Sdimvoid SplitModule(
38292915Sdim    std::unique_ptr<Module> M, unsigned N,
39292915Sdim    std::function<void(std::unique_ptr<Module> MPart)> ModuleCallback);
40292915Sdim
41292915Sdim} // End llvm namespace
42292915Sdim
43292915Sdim#endif
44