blob: 86c39b145070344b6da2100e6062d623d024e9bf [file] [log] [blame]
Jez Ng21f83112020-10-27 02:18:291//===- LTO.h ----------------------------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLD_MACHO_LTO_H
10#define LLD_MACHO_LTO_H
11
Nico Weberaa0883b2022-11-20 16:59:1612#include "lld/Common/LLVM.h"
13#include "llvm/ADT/DenseSet.h"
Jez Ng21f83112020-10-27 02:18:2914#include "llvm/ADT/SmallString.h"
Leonard Greyc931ff72021-07-15 16:56:1315#include "llvm/Support/MemoryBuffer.h"
Nico Weberaa0883b2022-11-20 16:59:1616#include "llvm/Support/raw_ostream.h"
Jez Ng21f83112020-10-27 02:18:2917#include <memory>
18#include <vector>
19
Nico Weberbf20d432022-08-07 14:37:4920namespace llvm::lto {
Jez Ng21f83112020-10-27 02:18:2921class LTO;
Nico Weberbf20d432022-08-07 14:37:4922} // namespace llvm::lto
Jez Ng21f83112020-10-27 02:18:2923
Nico Weberbf20d432022-08-07 14:37:4924namespace lld::macho {
Jez Ng21f83112020-10-27 02:18:2925
26class BitcodeFile;
27class ObjFile;
28
29class BitcodeCompiler {
30public:
31 BitcodeCompiler();
32
33 void add(BitcodeFile &f);
34 std::vector<ObjFile *> compile();
35
36private:
37 std::unique_ptr<llvm::lto::LTO> ltoObj;
38 std::vector<llvm::SmallString<0>> buf;
Leonard Greyc931ff72021-07-15 16:56:1339 std::vector<std::unique_ptr<llvm::MemoryBuffer>> files;
Nico Weberaa0883b2022-11-20 16:59:1640 std::unique_ptr<llvm::raw_fd_ostream> indexFile;
41 llvm::DenseSet<StringRef> thinIndices;
Keith Smileya65678b2023-03-03 21:27:0342 bool hasFiles = false;
Jez Ng21f83112020-10-27 02:18:2943};
44
Nico Weberbf20d432022-08-07 14:37:4945} // namespace lld::macho
Jez Ng21f83112020-10-27 02:18:2946
47#endif