ThinLTOBitcodeWriter.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- ThinLTOBitcodeWriter.h - Bitcode writing pass for ThinLTO ----------===//
  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 pass prepares a module containing type metadata for ThinLTO by splitting
  15. // it into regular and thin LTO parts if possible, and writing both parts to
  16. // a multi-module bitcode file. Modules that do not contain type metadata are
  17. // written unmodified as a single module.
  18. //
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_TRANSFORMS_IPO_THINLTOBITCODEWRITER_H
  21. #define LLVM_TRANSFORMS_IPO_THINLTOBITCODEWRITER_H
  22. #include <llvm/IR/PassManager.h>
  23. namespace llvm {
  24. class Module;
  25. class raw_ostream;
  26. class ThinLTOBitcodeWriterPass
  27. : public PassInfoMixin<ThinLTOBitcodeWriterPass> {
  28. raw_ostream &OS;
  29. raw_ostream *ThinLinkOS;
  30. public:
  31. // Writes bitcode to OS. Also write thin link file to ThinLinkOS, if
  32. // it's not nullptr.
  33. ThinLTOBitcodeWriterPass(raw_ostream &OS, raw_ostream *ThinLinkOS)
  34. : OS(OS), ThinLinkOS(ThinLinkOS) {}
  35. PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
  36. static bool isRequired() { return true; }
  37. };
  38. } // namespace llvm
  39. #endif
  40. #ifdef __GNUC__
  41. #pragma GCC diagnostic pop
  42. #endif