LLVM
8.0.1
|
This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing. More...
#include "llvm/LTO/legacy/ThinLTOCodeGenerator.h"
Classes | |
struct | CachingOptions |
Public Member Functions | |
void | addModule (StringRef Identifier, StringRef Data) |
Add given module to the code generator. More... | |
void | preserveSymbol (StringRef Name) |
Adds to a list of all global symbols that must exist in the final generated code. More... | |
void | crossReferenceSymbol (StringRef Name) |
Adds to a list of all global symbols that are cross-referenced between ThinLTO files. More... | |
void | run () |
Process all the modules that were added to the code generator in parallel. More... | |
std::vector< std::unique_ptr< MemoryBuffer > > & | getProducedBinaries () |
Return the "in memory" binaries produced by the code generator. More... | |
std::vector< std::string > & | getProducedBinaryFiles () |
Return the "on-disk" binaries produced by the code generator. More... | |
void | setCacheDir (std::string Path) |
Provide a path to a directory where to store the cached files for incremental build. More... | |
void | setCachePruningInterval (int Interval) |
Cache policy: interval (seconds) between two prunes of the cache. More... | |
void | setCacheEntryExpiration (unsigned Expiration) |
Cache policy: expiration (in seconds) for an entry. More... | |
void | setMaxCacheSizeRelativeToAvailableSpace (unsigned Percentage) |
Sets the maximum cache size that can be persistent across build, in terms of percentage of the available space on the disk. More... | |
void | setCacheMaxSizeBytes (uint64_t MaxSizeBytes) |
Cache policy: the maximum size for the cache directory in bytes. More... | |
void | setCacheMaxSizeFiles (unsigned MaxSizeFiles) |
Cache policy: the maximum number of files in the cache directory. More... | |
void | setSaveTempsDir (std::string Path) |
Set the path to a directory where to save temporaries at various stages of the processing. More... | |
void | setGeneratedObjectsDirectory (std::string Path) |
Set the path to a directory where to save generated object files. More... | |
void | setCpu (std::string Cpu) |
CPU to use to initialize the TargetMachine. More... | |
void | setAttr (std::string MAttr) |
Subtarget attributes. More... | |
void | setTargetOptions (TargetOptions Options) |
TargetMachine options. More... | |
void | setFreestanding (bool Enabled) |
Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on the target. More... | |
void | setCodePICModel (Optional< Reloc::Model > Model) |
CodeModel. More... | |
void | setCodeGenOptLevel (CodeGenOpt::Level CGOptLevel) |
CodeGen optimization level. More... | |
void | setOptLevel (unsigned NewOptLevel) |
IR optimization level: from 0 to 3. More... | |
void | disableCodeGen (bool Disable) |
Disable CodeGen, only run the stages till codegen and stop. More... | |
void | setCodeGenOnly (bool CGOnly) |
Perform CodeGen only: disable all other stages. More... | |
std::unique_ptr< ModuleSummaryIndex > | linkCombinedIndex () |
Produce the combined summary index from all the bitcode files: "thin-link". More... | |
void | promote (Module &Module, ModuleSummaryIndex &Index) |
Perform promotion and renaming of exported internal functions, and additionally resolve weak and linkonce symbols. More... | |
void | emitImports (Module &Module, StringRef OutputName, ModuleSummaryIndex &Index) |
Compute and emit the imported files for module at ModulePath . More... | |
void | crossModuleImport (Module &Module, ModuleSummaryIndex &Index) |
Perform cross-module importing for the module identified by ModuleIdentifier. More... | |
void | gatherImportedSummariesForModule (Module &Module, ModuleSummaryIndex &Index, std::map< std::string, GVSummaryMapTy > &ModuleToSummariesForIndex) |
Compute the list of summaries needed for importing into module. More... | |
void | internalize (Module &Module, ModuleSummaryIndex &Index) |
Perform internalization. More... | |
void | optimize (Module &Module) |
Perform post-importing ThinLTO optimizations. More... | |
This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing.
The ThinLTOCodeGenerator is not intended to be reuse for multiple compilation: the model is that the client adds modules to the generator and ask to perform the ThinLTO optimizations / codegen, and finally destroys the codegenerator.
Definition at line 70 of file ThinLTOCodeGenerator.h.
Add given module to the code generator.
Definition at line 490 of file ThinLTOCodeGenerator.cpp.
References Context, llvm::expectedToErrorOrAndEmitErrors(), llvm::getBitcodeTargetTriple(), llvm::ThinLTOBuffer::getMemBuffer(), and llvm::report_fatal_error().
void ThinLTOCodeGenerator::crossReferenceSymbol | ( | StringRef | Name | ) |
Adds to a list of all global symbols that are cross-referenced between ThinLTO files.
If the ThinLTO CodeGenerator can ensure that every references from a ThinLTO module to this symbol is optimized away, then the symbol can be discarded.
Definition at line 518 of file ThinLTOCodeGenerator.cpp.
|
inline |
Return the "in memory" binaries produced by the code generator.
This is filled after run() unless setGeneratedObjectsDirectory() has been called, in which case results are available through getProducedBinaryFiles().
Definition at line 105 of file ThinLTOCodeGenerator.h.
|
inline |
Return the "on-disk" binaries produced by the code generator.
This is filled after run() when setGeneratedObjectsDirectory() has been called, in which case results are available through getProducedBinaries().
Definition at line 114 of file ThinLTOCodeGenerator.h.
void ThinLTOCodeGenerator::preserveSymbol | ( | StringRef | Name | ) |
Adds to a list of all global symbols that must exist in the final generated code.
If a symbol is not listed there, it will be optimized away if it is inlined into every usage.
Definition at line 514 of file ThinLTOCodeGenerator.cpp.
void ThinLTOCodeGenerator::run | ( | ) |
Process all the modules that were added to the code generator in parallel.
Client can access the resulting object files using getProducedBinaries(), unless setGeneratedObjectsDirectory() has been called, in which case results are available through getProducedBinaryFiles().
Definition at line 815 of file ThinLTOCodeGenerator.cpp.
References llvm::AreStatisticsEnabled(), assert(), llvm::ThreadPool::async(), llvm::ComputeCrossModuleImport(), computeDeadSymbolsInIndex(), llvm::computeSyntheticCounts(), Context, llvm::count(), llvm::sys::fs::create_directories(), llvm::dbgs(), llvm::LLVMContext::enableDebugTypeODRUniquing(), llvm::errs(), llvm::sys::fs::F_None, internalizeAndPromoteInIndex(), llvm::sys::fs::is_directory(), LLVM_DEBUG, llvm::LTODiscardValueNames, llvm::LTOPassRemarksWithHotness, llvm::LTORemarksFilename, llvm::PrintStatistics(), llvm::pruneCache(), llvm::report_fatal_error(), llvm::reportAndResetTimings(), llvm::LLVMContext::setDiscardValueNames(), llvm::lto::setupOptimizationRemarks(), llvm::Module::size(), llvm::sort(), llvm::toString(), writeGeneratedObject(), and llvm::WriteIndexToFile().