]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/COFF/LTO.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / COFF / LTO.h
1 //===- LTO.h ----------------------------------------------------*- C++ -*-===//
2 //
3 //                             The LLVM Linker
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides a way to combine bitcode files into one COFF
11 // file by compiling them using LLVM.
12 //
13 // If LTO is in use, your input files are not in regular COFF files
14 // but instead LLVM bitcode files. In that case, the linker has to
15 // convert bitcode files into the native format so that we can create
16 // a COFF file that contains native code. This file provides that
17 // functionality.
18 //
19 //===----------------------------------------------------------------------===//
20
21 #ifndef LLD_COFF_LTO_H
22 #define LLD_COFF_LTO_H
23
24 #include "lld/Common/LLVM.h"
25 #include "llvm/ADT/SmallString.h"
26 #include <memory>
27 #include <vector>
28
29 namespace llvm {
30 namespace lto {
31 class LTO;
32 }
33 }
34
35 namespace lld {
36 namespace coff {
37
38 class BitcodeFile;
39 class InputFile;
40
41 class BitcodeCompiler {
42 public:
43   BitcodeCompiler();
44   ~BitcodeCompiler();
45
46   void add(BitcodeFile &F);
47   std::vector<StringRef> compile();
48
49 private:
50   std::unique_ptr<llvm::lto::LTO> LTOObj;
51   std::vector<SmallString<0>> Buf;
52   std::vector<std::unique_ptr<MemoryBuffer>> Files;
53 };
54 }
55 }
56
57 #endif