LLVM  13.0.0git
Macros | Enumerations | Functions | Variables
LTOBackend.cpp File Reference
#include "llvm/LTO/LTOBackend.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Analysis/ModuleSummaryAnalysis.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/LLVMRemarkStreamer.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/LTO/LTO.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Object/ModuleSymbolTable.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Passes/PassPlugin.h"
#include "llvm/Passes/StandardInstrumentations.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/SmallVectorMemoryBuffer.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
#include "llvm/Transforms/Utils/SplitModule.h"
#include "llvm/Support/Extension.def"
Include dependency graph for LTOBackend.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "lto-backend"
 
#define HANDLE_EXTENSION(Ext)   llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
 
#define HANDLE_EXTENSION(Ext)   get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);
 

Enumerations

enum  LTOBitcodeEmbedding { LTOBitcodeEmbedding::DoNotEmbed = 0, LTOBitcodeEmbedding::EmbedOptimized = 1, LTOBitcodeEmbedding::EmbedPostMergePreOptimized = 2 }
 

Functions

static LLVM_ATTRIBUTE_NORETURN void reportOpenError (StringRef Path, Twine Msg)
 
static void RegisterPassPlugins (ArrayRef< std::string > PassPlugins, PassBuilder &PB)
 
static std::unique_ptr< TargetMachinecreateTargetMachine (const Config &Conf, const Target *TheTarget, Module &M)
 
static void runNewPMPasses (const Config &Conf, Module &Mod, TargetMachine *TM, unsigned OptLevel, bool IsThinLTO, ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary)
 
static void runOldPMPasses (const Config &Conf, Module &Mod, TargetMachine *TM, bool IsThinLTO, ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary)
 
static void codegen (const Config &Conf, TargetMachine *TM, AddStreamFn AddStream, unsigned Task, Module &Mod, const ModuleSummaryIndex &CombinedIndex)
 
static void splitCodeGen (const Config &C, TargetMachine *TM, AddStreamFn AddStream, unsigned ParallelCodeGenParallelismLevel, Module &Mod, const ModuleSummaryIndex &CombinedIndex)
 
static Expected< const Target * > initAndLookupTarget (const Config &C, Module &Mod)
 
static void dropDeadSymbols (Module &Mod, const GVSummaryMapTy &DefinedGlobals, const ModuleSummaryIndex &Index)
 

Variables

static cl::opt< LTOBitcodeEmbeddingEmbedBitcode ("lto-embed-bitcode", cl::init(LTOBitcodeEmbedding::DoNotEmbed), cl::values(clEnumValN(LTOBitcodeEmbedding::DoNotEmbed, "none", "Do not embed"), clEnumValN(LTOBitcodeEmbedding::EmbedOptimized, "optimized", "Embed after all optimization passes"), clEnumValN(LTOBitcodeEmbedding::EmbedPostMergePreOptimized, "post-merge-pre-opt", "Embed post merge, but before optimizations")), cl::desc("Embed LLVM bitcode in object files produced by LTO"))
 
static cl::opt< bool > ThinLTOAssumeMerged ("thinlto-assume-merged", cl::init(false), cl::desc("Assume the input has already undergone ThinLTO function " "importing and the other pre-optimization pipeline changes."))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "lto-backend"

Definition at line 53 of file LTOBackend.cpp.

◆ HANDLE_EXTENSION [1/2]

#define HANDLE_EXTENSION (   Ext)    llvm::PassPluginLibraryInfo get##Ext##PluginInfo();

Definition at line 157 of file LTOBackend.cpp.

◆ HANDLE_EXTENSION [2/2]

#define HANDLE_EXTENSION (   Ext)    get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);

Definition at line 157 of file LTOBackend.cpp.

Enumeration Type Documentation

◆ LTOBitcodeEmbedding

enum LTOBitcodeEmbedding
strong
Enumerator
DoNotEmbed 
EmbedOptimized 
EmbedPostMergePreOptimized 

Definition at line 55 of file LTOBackend.cpp.

Function Documentation

◆ codegen()

static void codegen ( const Config Conf,
TargetMachine TM,
AddStreamFn  AddStream,
unsigned  Task,
Module Mod,
const ModuleSummaryIndex CombinedIndex 
)
static

◆ createTargetMachine()

static std::unique_ptr<TargetMachine> createTargetMachine ( const Config Conf,
const Target TheTarget,
Module M 
)
static

◆ dropDeadSymbols()

static void dropDeadSymbols ( Module Mod,
const GVSummaryMapTy DefinedGlobals,
const ModuleSummaryIndex Index 
)
static

◆ initAndLookupTarget()

static Expected<const Target *> initAndLookupTarget ( const Config C,
Module Mod 
)
static

◆ RegisterPassPlugins()

static void RegisterPassPlugins ( ArrayRef< std::string >  PassPlugins,
PassBuilder PB 
)
static

◆ reportOpenError()

static LLVM_ATTRIBUTE_NORETURN void reportOpenError ( StringRef  Path,
Twine  Msg 
)
static

Definition at line 77 of file LTOBackend.cpp.

References llvm::errs(), exit(), and llvm::raw_ostream::flush().

Referenced by llvm::lto::Config::addSaveTemps().

◆ runNewPMPasses()

static void runNewPMPasses ( const Config Conf,
Module Mod,
TargetMachine TM,
unsigned  OptLevel,
bool  IsThinLTO,
ModuleSummaryIndex ExportSummary,
const ModuleSummaryIndex ImportSummary 
)
static

◆ runOldPMPasses()

static void runOldPMPasses ( const Config Conf,
Module Mod,
TargetMachine TM,
bool  IsThinLTO,
ModuleSummaryIndex ExportSummary,
const ModuleSummaryIndex ImportSummary 
)
static

◆ splitCodeGen()

static void splitCodeGen ( const Config C,
TargetMachine TM,
AddStreamFn  AddStream,
unsigned  ParallelCodeGenParallelismLevel,
Module Mod,
const ModuleSummaryIndex CombinedIndex 
)
static

Variable Documentation

◆ EmbedBitcode

cl::opt<LTOBitcodeEmbedding> EmbedBitcode("lto-embed-bitcode", cl::init(LTOBitcodeEmbedding::DoNotEmbed), cl::values(clEnumValN(LTOBitcodeEmbedding::DoNotEmbed, "none", "Do not embed"), clEnumValN(LTOBitcodeEmbedding::EmbedOptimized, "optimized", "Embed after all optimization passes"), clEnumValN(LTOBitcodeEmbedding::EmbedPostMergePreOptimized, "post-merge-pre-opt", "Embed post merge, but before optimizations")), cl::desc("Embed LLVM bitcode in object files produced by LTO"))
static

◆ ThinLTOAssumeMerged

cl::opt<bool> ThinLTOAssumeMerged("thinlto-assume-merged", cl::init(false), cl::desc("Assume the input has already undergone ThinLTO function " "importing and the other pre-optimization pipeline changes."))
static