SplitModule.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- SplitModule.h - Split a module into partitions -----------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file defines the function llvm::SplitModule, which splits a module
  15. // into multiple linkable partitions. It can be used to implement parallel code
  16. // generation for link-time optimization.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
  20. #define LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
  21. #include "llvm/ADT/STLFunctionalExtras.h"
  22. #include <memory>
  23. namespace llvm {
  24. class Module;
  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.
  27. ///
  28. /// FIXME: This function does not deal with the somewhat subtle symbol
  29. /// visibility issues around module splitting, including (but not limited to):
  30. ///
  31. /// - Internal symbols should not collide with symbols defined outside the
  32. /// module.
  33. /// - Internal symbols defined in module-level inline asm should be visible to
  34. /// each partition.
  35. void SplitModule(
  36. Module &M, unsigned N,
  37. function_ref<void(std::unique_ptr<Module> MPart)> ModuleCallback,
  38. bool PreserveLocals = false);
  39. } // end namespace llvm
  40. #endif // LLVM_TRANSFORMS_UTILS_SPLITMODULE_H
  41. #ifdef __GNUC__
  42. #pragma GCC diagnostic pop
  43. #endif