1 //===--- BackendUtil.h - LLVM Backend Utilities -----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_CODEGEN_BACKENDUTIL_H
11 #define LLVM_CLANG_CODEGEN_BACKENDUTIL_H
13 #include "clang/Basic/LLVM.h"
14 #include "llvm/IR/ModuleSummaryIndex.h"
19 template <typename T> class Expected;
21 class MemoryBufferRef;
25 class DiagnosticsEngine;
26 class HeaderSearchOptions;
32 Backend_EmitAssembly, ///< Emit native assembly files
33 Backend_EmitBC, ///< Emit LLVM bitcode files
34 Backend_EmitLL, ///< Emit human-readable LLVM assembly
35 Backend_EmitNothing, ///< Don't emit anything (benchmarking mode)
36 Backend_EmitMCNull, ///< Run CodeGen, but don't emit anything
37 Backend_EmitObj ///< Emit native object files
40 void EmitBackendOutput(DiagnosticsEngine &Diags, const HeaderSearchOptions &,
41 const CodeGenOptions &CGOpts,
42 const TargetOptions &TOpts, const LangOptions &LOpts,
43 const llvm::DataLayout &TDesc, llvm::Module *M,
45 std::unique_ptr<raw_pwrite_stream> OS);
47 void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
48 llvm::MemoryBufferRef Buf);
50 llvm::Expected<llvm::BitcodeModule>
51 FindThinLTOModule(llvm::MemoryBufferRef MBRef);