Adds support for the following flags: * --thinlto-index-only, --thinlto-index-only= * --thinlto-emit-imports-files * --thinlto-emit-index-files * --thinlto-object-suffix-replace= * --thinlto-prefix-replace= See https://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html for some words on --thinlto-index-only. I don't really need the other flags, but they were in the vicinity and _someone_ might need them, so I figured I'd add them too. `-object_path_lto` now sets `c.AlwaysEmitRegularLTOObj` as in the other ports, which means it can now only point to a filename for non-thin LTO. I think that was the intent of D129705 anyways, so update test/MachO/lto-object-path.ll to use a non-thin bitcode file for that test. Differential Revision: https://reviews.llvm.org/D138451
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
//===- LTO.h ----------------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLD_MACHO_LTO_H
|
|
#define LLD_MACHO_LTO_H
|
|
|
|
#include "lld/Common/LLVM.h"
|
|
#include "llvm/ADT/DenseSet.h"
|
|
#include "llvm/ADT/SmallString.h"
|
|
#include "llvm/Support/MemoryBuffer.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace llvm::lto {
|
|
class LTO;
|
|
} // namespace llvm::lto
|
|
|
|
namespace lld::macho {
|
|
|
|
class BitcodeFile;
|
|
class ObjFile;
|
|
|
|
class BitcodeCompiler {
|
|
public:
|
|
BitcodeCompiler();
|
|
|
|
void add(BitcodeFile &f);
|
|
std::vector<ObjFile *> compile();
|
|
|
|
private:
|
|
std::unique_ptr<llvm::lto::LTO> ltoObj;
|
|
std::vector<llvm::SmallString<0>> buf;
|
|
std::vector<std::unique_ptr<llvm::MemoryBuffer>> files;
|
|
std::unique_ptr<llvm::raw_fd_ostream> indexFile;
|
|
llvm::DenseSet<StringRef> thinIndices;
|
|
};
|
|
|
|
} // namespace lld::macho
|
|
|
|
#endif
|