1 //===- SplitModule.h - Split a module into partitions -----------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file defines the function llvm::SplitModule, which splits a module 11 // into multiple linkable partitions. It can be used to implement parallel code 12 // generation for link-time optimization. 13 // 14 //===----------------------------------------------------------------------===// 15 16 #ifndef LLVM_TRANSFORMS_UTILS_SPLITMODULE_H 17 #define LLVM_TRANSFORMS_UTILS_SPLITMODULE_H 18 19 #include <functional> 20 #include <memory> 21 22 namespace llvm { 23 24 class Module; 25 class StringRef; 26 27 /// Splits the module M into N linkable partitions. The function ModuleCallback 28 /// is called N times passing each individual partition as the MPart argument. 29 /// 30 /// FIXME: This function does not deal with the somewhat subtle symbol 31 /// visibility issues around module splitting, including (but not limited to): 32 /// 33 /// - Internal symbols should not collide with symbols defined outside the 34 /// module. 35 /// - Internal symbols defined in module-level inline asm should be visible to 36 /// each partition. 37 void SplitModule( 38 std::unique_ptr<Module> M, unsigned N, 39 std::function<void(std::unique_ptr<Module> MPart)> ModuleCallback); 40 41 } // End llvm namespace 42 43 #endif 44