LLVM 23.0.0git
DTLTO.h
Go to the documentation of this file.
1//===- DTLTO.h - Distributed ThinLTO functions and classes ----*- 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 LLVM_DTLTO_H
10#define LLVM_DTLTO_H
11
12#include "llvm/LTO/LTO.h"
14
15namespace llvm {
16namespace lto {
17
18class DTLTO : public LTO {
19 using Base = LTO;
20
21public:
22 // Inherit constructors.
23 using Base::Base;
24 ~DTLTO() override = default;
25
26 // Add an input file and prepare it for distribution.
28 addInput(std::unique_ptr<InputFile> InputPtr) override;
29
30protected:
32
33 LLVM_ABI void cleanup() override;
34
35private:
36 // Bump allocator for a purpose of saving updated module IDs.
37 BumpPtrAllocator PtrAlloc;
38 StringSaver Saver{PtrAlloc};
39
40 // Determines if a file at the given path is a thin archive file.
41 Expected<bool> isThinArchive(const StringRef ArchivePath);
42
43 // Write the archive member content to a file named after the module ID.
44 Error saveInputArchiveMember(lto::InputFile *Input);
45
46 // Iterates through all input files and saves their content
47 // to files if they are regular archive members.
48 Error saveInputArchiveMembers();
49
50 // Array of input bitcode files for LTO.
51 std::vector<std::shared_ptr<lto::InputFile>> InputFiles;
52
53 // A cache to avoid repeatedly reading the same archive file.
54 StringMap<bool> ArchiveFiles;
55};
56
57} // namespace lto
58} // namespace llvm
59
60#endif // LLVM_DTLTO_H
#define LLVM_ABI
Definition Compiler.h:213
The Input class is used to parse a yaml document into in-memory structs and vectors.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:133
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Definition StringSaver.h:22
LLVM_ABI void cleanup() override
Definition DTLTO.cpp:209
LLVM_ABI llvm::Error handleArchiveInputs() override
Definition DTLTO.cpp:200
~DTLTO() override=default
LLVM_ABI Expected< std::shared_ptr< InputFile > > addInput(std::unique_ptr< InputFile > InputPtr) override
Definition DTLTO.cpp:127
An input file.
Definition LTO.h:113
LLVM_ABI LTO(Config Conf, ThinBackend Backend={}, unsigned ParallelCodeGenParallelismLevel=1, LTOKind LTOMode=LTOK_Default)
Create an LTO object.
Definition LTO.cpp:624
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383