1 //===--- BackendUtil.h - LLVM Backend Utilities -----------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_CODEGEN_BACKENDUTIL_H
10 #define LLVM_CLANG_CODEGEN_BACKENDUTIL_H
12 #include "clang/Basic/LLVM.h"
13 #include "llvm/IR/ModuleSummaryIndex.h"
18 template <typename T> class Expected;
20 class MemoryBufferRef;
24 class DiagnosticsEngine;
25 class HeaderSearchOptions;
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
39 void EmitBackendOutput(DiagnosticsEngine &Diags, const HeaderSearchOptions &,
40 const CodeGenOptions &CGOpts,
41 const TargetOptions &TOpts, const LangOptions &LOpts,
42 const llvm::DataLayout &TDesc, llvm::Module *M,
44 std::unique_ptr<raw_pwrite_stream> OS);
46 void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
47 llvm::MemoryBufferRef Buf);
49 llvm::Expected<llvm::BitcodeModule>
50 FindThinLTOModule(llvm::MemoryBufferRef MBRef);
52 FindThinLTOModule(llvm::MutableArrayRef<llvm::BitcodeModule> BMs);