LLVM  12.0.0git
Go to the documentation of this file.
1 //===-LTOBackend.h - LLVM Link Time Optimizer Backend ---------------------===//
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 // This file implements the "backend" phase of LTO, i.e. it performs
10 // optimization and code generation on a loaded module. It is generally used
11 // internally by the LTO class but can also be used independently, for example
12 // to implement a standalone ThinLTO backend.
13 //
14 //===----------------------------------------------------------------------===//
19 #include "llvm/ADT/MapVector.h"
20 #include "llvm/IR/DiagnosticInfo.h"
22 #include "llvm/LTO/LTO.h"
27 namespace llvm {
29 class BitcodeModule;
30 class Error;
31 class Module;
32 class Target;
34 namespace lto {
36 /// Runs a regular LTO backend. The regular LTO backend can also act as the
37 /// regular LTO phase of ThinLTO, which may need to access the combined index.
38 Error backend(const Config &C, AddStreamFn AddStream,
39  unsigned ParallelCodeGenParallelismLevel,
40  std::unique_ptr<Module> M, ModuleSummaryIndex &CombinedIndex);
42 /// Runs a ThinLTO backend.
43 Error thinBackend(const Config &C, unsigned Task, AddStreamFn AddStream,
44  Module &M, const ModuleSummaryIndex &CombinedIndex,
45  const FunctionImporter::ImportMapTy &ImportList,
46  const GVSummaryMapTy &DefinedGlobals,
47  MapVector<StringRef, BitcodeModule> &ModuleMap);
50  std::unique_ptr<ToolOutputFile> DiagOutputFile);
51 }
52 }
54 #endif
uint64_t CallInst * C
Error finalizeOptimizationRemarks(std::unique_ptr< ToolOutputFile > DiagOutputFile)
Definition: LTOBackend.cpp:474
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Machine Debugify Module
StringMap< FunctionsToImportTy > ImportMapTy
The map contains an entry for every module to import from, the key being the module identifier to pas...
Error backend(const Config &C, AddStreamFn AddStream, unsigned ParallelCodeGenParallelismLevel, std::unique_ptr< Module > M, ModuleSummaryIndex &CombinedIndex)
Runs a regular LTO backend.
Definition: LTOBackend.cpp:485
DenseMap< GlobalValue::GUID, GlobalValueSummary * > GVSummaryMapTy
Map of global value GUID to its summary, used to identify values defined in a particular module...
Error thinBackend(const Config &C, unsigned Task, AddStreamFn AddStream, Module &M, const ModuleSummaryIndex &CombinedIndex, const FunctionImporter::ImportMapTy &ImportList, const GVSummaryMapTy &DefinedGlobals, MapVector< StringRef, BitcodeModule > &ModuleMap)
Runs a ThinLTO backend.
Definition: LTOBackend.cpp:531
std::function< std::unique_ptr< NativeObjectStream >(unsigned Task)> AddStreamFn
This type defines the callback to add a native object that is generated on the fly.
Definition: LTO.h:200
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...