blob: d4743f6940ff931c471f2b7c01c7f159247a7536 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-LTOBackend.h - LLVM Link Time Optimizer Backend ---------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the "backend" phase of LTO, i.e. it performs
11// optimization and code generation on a loaded module. It is generally used
12// internally by the LTO class but can also be used independently, for example
13// to implement a standalone ThinLTO backend.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_LTO_LTOBACKEND_H
18#define LLVM_LTO_LTOBACKEND_H
19
20#include "llvm/ADT/MapVector.h"
21#include "llvm/IR/DiagnosticInfo.h"
22#include "llvm/IR/ModuleSummaryIndex.h"
23#include "llvm/LTO/LTO.h"
24#include "llvm/Support/MemoryBuffer.h"
25#include "llvm/Target/TargetOptions.h"
26#include "llvm/Transforms/IPO/FunctionImport.h"
27
28namespace llvm {
29
30class BitcodeModule;
31class Error;
32class Module;
33class Target;
34
35namespace lto {
36
37/// Runs a regular LTO backend. The regular LTO backend can also act as the
38/// regular LTO phase of ThinLTO, which may need to access the combined index.
39Error backend(Config &C, AddStreamFn AddStream,
40 unsigned ParallelCodeGenParallelismLevel,
41 std::unique_ptr<Module> M, ModuleSummaryIndex &CombinedIndex);
42
43/// Runs a ThinLTO backend.
44Error thinBackend(Config &C, unsigned Task, AddStreamFn AddStream, Module &M,
45 const ModuleSummaryIndex &CombinedIndex,
46 const FunctionImporter::ImportMapTy &ImportList,
47 const GVSummaryMapTy &DefinedGlobals,
48 MapVector<StringRef, BitcodeModule> &ModuleMap);
49}
50}
51
52#endif