BackendUtil.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- BackendUtil.h - LLVM Backend Utilities -----------------*- 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. #ifndef LLVM_CLANG_CODEGEN_BACKENDUTIL_H
  14. #define LLVM_CLANG_CODEGEN_BACKENDUTIL_H
  15. #include "clang/Basic/LLVM.h"
  16. #include "llvm/IR/ModuleSummaryIndex.h"
  17. #include <memory>
  18. namespace llvm {
  19. class BitcodeModule;
  20. template <typename T> class Expected;
  21. class Module;
  22. class MemoryBufferRef;
  23. }
  24. namespace clang {
  25. class DiagnosticsEngine;
  26. class HeaderSearchOptions;
  27. class CodeGenOptions;
  28. class TargetOptions;
  29. class LangOptions;
  30. enum BackendAction {
  31. Backend_EmitAssembly, ///< Emit native assembly files
  32. Backend_EmitBC, ///< Emit LLVM bitcode files
  33. Backend_EmitLL, ///< Emit human-readable LLVM assembly
  34. Backend_EmitNothing, ///< Don't emit anything (benchmarking mode)
  35. Backend_EmitMCNull, ///< Run CodeGen, but don't emit anything
  36. Backend_EmitObj ///< Emit native object files
  37. };
  38. void EmitBackendOutput(DiagnosticsEngine &Diags, const HeaderSearchOptions &,
  39. const CodeGenOptions &CGOpts,
  40. const TargetOptions &TOpts, const LangOptions &LOpts,
  41. StringRef TDesc, llvm::Module *M, BackendAction Action,
  42. std::unique_ptr<raw_pwrite_stream> OS);
  43. void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
  44. llvm::MemoryBufferRef Buf);
  45. void EmbedObject(llvm::Module *M, const CodeGenOptions &CGOpts,
  46. DiagnosticsEngine &Diags);
  47. }
  48. #endif
  49. #ifdef __GNUC__
  50. #pragma GCC diagnostic pop
  51. #endif