]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/clang/CodeGen/BackendUtil.h
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / include / clang / CodeGen / BackendUtil.h
1 //===--- BackendUtil.h - LLVM Backend Utilities -----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_CODEGEN_BACKENDUTIL_H
11 #define LLVM_CLANG_CODEGEN_BACKENDUTIL_H
12
13 #include "clang/Basic/LLVM.h"
14 #include "llvm/IR/ModuleSummaryIndex.h"
15 #include <memory>
16
17 namespace llvm {
18   class BitcodeModule;
19   template <typename T> class Expected;
20   class Module;
21   class MemoryBufferRef;
22 }
23
24 namespace clang {
25   class DiagnosticsEngine;
26   class HeaderSearchOptions;
27   class CodeGenOptions;
28   class TargetOptions;
29   class LangOptions;
30
31   enum BackendAction {
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
38   };
39
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,
44                          BackendAction Action,
45                          std::unique_ptr<raw_pwrite_stream> OS);
46
47   void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
48                     llvm::MemoryBufferRef Buf);
49
50   llvm::Expected<llvm::BitcodeModule>
51   FindThinLTOModule(llvm::MemoryBufferRef MBRef);
52   llvm::BitcodeModule *
53   FindThinLTOModule(llvm::MutableArrayRef<llvm::BitcodeModule> BMs);
54 }
55
56 #endif