ParallelCG.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //===-- llvm/CodeGen/ParallelCG.h - Parallel code generation ----*- C++ -*-===//
  2. //
  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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This header declares functions that can be used for parallel code generation.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_CODEGEN_PARALLELCG_H
  13. #define LLVM_CODEGEN_PARALLELCG_H
  14. #include "llvm/Support/CodeGen.h"
  15. #include <functional>
  16. #include <memory>
  17. namespace llvm {
  18. template <typename T> class ArrayRef;
  19. class Module;
  20. class TargetMachine;
  21. class raw_pwrite_stream;
  22. /// Split M into OSs.size() partitions, and generate code for each. Takes a
  23. /// factory function for the TargetMachine TMFactory. Writes OSs.size() output
  24. /// files to the output streams in OSs. The resulting output files if linked
  25. /// together are intended to be equivalent to the single output file that would
  26. /// have been code generated from M.
  27. ///
  28. /// Writes bitcode for individual partitions into output streams in BCOSs, if
  29. /// BCOSs is not empty.
  30. void splitCodeGen(
  31. Module &M, ArrayRef<raw_pwrite_stream *> OSs,
  32. ArrayRef<llvm::raw_pwrite_stream *> BCOSs,
  33. const std::function<std::unique_ptr<TargetMachine>()> &TMFactory,
  34. CodeGenFileType FileType = CGFT_ObjectFile, bool PreserveLocals = false);
  35. } // namespace llvm
  36. #endif