Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:44

0001 //===- SplitModule.h - Split a module into partitions -----------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines the function llvm::SplitModule, which splits a module
0010 // into multiple linkable partitions. It can be used to implement parallel code
0011 // generation for link-time optimization.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
0016 #define LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
0017 
0018 #include "llvm/ADT/STLFunctionalExtras.h"
0019 #include <memory>
0020 
0021 namespace llvm {
0022 
0023 class Module;
0024 
0025 /// Splits the module M into N linkable partitions. The function ModuleCallback
0026 /// is called N times passing each individual partition as the MPart argument.
0027 /// PreserveLocals: Split without externalizing locals.
0028 /// RoundRobin: Use round-robin distribution of functions to modules instead
0029 /// of the default name-hash-based one.
0030 ///
0031 /// FIXME: This function does not deal with the somewhat subtle symbol
0032 /// visibility issues around module splitting, including (but not limited to):
0033 ///
0034 /// - Internal symbols should not collide with symbols defined outside the
0035 ///   module.
0036 /// - Internal symbols defined in module-level inline asm should be visible to
0037 ///   each partition.
0038 void SplitModule(
0039     Module &M, unsigned N,
0040     function_ref<void(std::unique_ptr<Module> MPart)> ModuleCallback,
0041     bool PreserveLocals = false, bool RoundRobin = false);
0042 
0043 } // end namespace llvm
0044 
0045 #endif // LLVM_TRANSFORMS_UTILS_SPLITMODULE_H