xref: /openbsd/gnu/llvm/lld/MachO/LTO.h (revision dfe94b16)
11cf9926bSpatrick //===- LTO.h ----------------------------------------------------*- C++ -*-===//
21cf9926bSpatrick //
31cf9926bSpatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
41cf9926bSpatrick // See https://llvm.org/LICENSE.txt for license information.
51cf9926bSpatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
61cf9926bSpatrick //
71cf9926bSpatrick //===----------------------------------------------------------------------===//
81cf9926bSpatrick 
91cf9926bSpatrick #ifndef LLD_MACHO_LTO_H
101cf9926bSpatrick #define LLD_MACHO_LTO_H
111cf9926bSpatrick 
12*dfe94b16Srobert #include "lld/Common/LLVM.h"
13*dfe94b16Srobert #include "llvm/ADT/DenseSet.h"
141cf9926bSpatrick #include "llvm/ADT/SmallString.h"
151cf9926bSpatrick #include "llvm/Support/MemoryBuffer.h"
16*dfe94b16Srobert #include "llvm/Support/raw_ostream.h"
171cf9926bSpatrick #include <memory>
181cf9926bSpatrick #include <vector>
191cf9926bSpatrick 
20*dfe94b16Srobert namespace llvm::lto {
211cf9926bSpatrick class LTO;
22*dfe94b16Srobert } // namespace llvm::lto
231cf9926bSpatrick 
24*dfe94b16Srobert namespace lld::macho {
251cf9926bSpatrick 
261cf9926bSpatrick class BitcodeFile;
271cf9926bSpatrick class ObjFile;
281cf9926bSpatrick 
291cf9926bSpatrick class BitcodeCompiler {
301cf9926bSpatrick public:
311cf9926bSpatrick   BitcodeCompiler();
321cf9926bSpatrick 
331cf9926bSpatrick   void add(BitcodeFile &f);
341cf9926bSpatrick   std::vector<ObjFile *> compile();
351cf9926bSpatrick 
361cf9926bSpatrick private:
371cf9926bSpatrick   std::unique_ptr<llvm::lto::LTO> ltoObj;
381cf9926bSpatrick   std::vector<llvm::SmallString<0>> buf;
391cf9926bSpatrick   std::vector<std::unique_ptr<llvm::MemoryBuffer>> files;
40*dfe94b16Srobert   std::unique_ptr<llvm::raw_fd_ostream> indexFile;
41*dfe94b16Srobert   llvm::DenseSet<StringRef> thinIndices;
421cf9926bSpatrick };
431cf9926bSpatrick 
44*dfe94b16Srobert } // namespace lld::macho
451cf9926bSpatrick 
461cf9926bSpatrick #endif
47