15#ifndef LLVM_LTO_LEGACY_THINLTOCODEGENERATOR_H
16#define LLVM_LTO_LEGACY_THINLTOCODEGENERATOR_H
37namespace ThinLTOCodeGeneratorImpl {
50 std::unique_ptr<TargetMachine>
create()
const;
95 return ProducedBinaries;
104 return ProducedBinaryFiles;
202 SavedObjectsDirectoryPath = std::move(Path);
206 void setCpu(std::string Cpu) { TMBuilder.
MCpu = std::move(Cpu); }
209 void setAttr(std::string MAttr) { TMBuilder.
MAttr = std::move(MAttr); }
232 OptLevel = (NewOptLevel > 3) ? 3 : NewOptLevel;
315 std::vector<std::unique_ptr<MemoryBuffer>> ProducedBinaries;
318 std::vector<std::string> ProducedBinaryFiles;
322 std::vector<std::unique_ptr<lto::InputFile>> Modules;
332 CachingOptions CacheOptions;
335 std::string SaveTempsDir;
338 std::string SavedObjectsDirectoryPath;
342 bool DisableCodeGen =
false;
346 bool CodeGenOnly =
false;
350 bool Freestanding =
false;
353 unsigned OptLevel = 3;
357 bool DebugPassManager =
false;
std::pair< uint64_t, uint64_t > Interval
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
StringSet - A set-like wrapper for the StringMap.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Class to hold module path string table and global value map, and encapsulate methods for operating on...
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
StringSet - A wrapper for StringMap that provides set-like functionality.
This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing.
void preserveSymbol(StringRef Name)
Adds to a list of all global symbols that must exist in the final generated code.
std::vector< std::unique_ptr< MemoryBuffer > > & getProducedBinaries()
Return the "in memory" binaries produced by the code generator.
void run()
Process all the modules that were added to the code generator in parallel.
void crossReferenceSymbol(StringRef Name)
Adds to a list of all global symbols that are cross-referenced between ThinLTO files.
void addModule(StringRef Identifier, StringRef Data)
Add given module to the code generator.
std::vector< std::string > & getProducedBinaryFiles()
Return the "on-disk" binaries produced by the code generator.
Triple - Helper class for working with autoconf configuration names.
void setCacheDir(std::string Path)
Provide a path to a directory where to store the cached files for incremental build.
void setCachePruningInterval(int Interval)
Cache policy: interval (seconds) between two prunes of the cache.
void setCacheEntryExpiration(unsigned Expiration)
Cache policy: expiration (in seconds) for an entry.
void setMaxCacheSizeRelativeToAvailableSpace(unsigned Percentage)
Sets the maximum cache size that can be persistent across build, in terms of percentage of the availa...
void setCacheMaxSizeBytes(uint64_t MaxSizeBytes)
Cache policy: the maximum size for the cache directory in bytes.
void setCacheMaxSizeFiles(unsigned MaxSizeFiles)
Cache policy: the maximum number of files in the cache directory.
void setCpu(std::string Cpu)
CPU to use to initialize the TargetMachine.
void disableCodeGen(bool Disable)
Disable CodeGen, only run the stages till codegen and stop.
void setGeneratedObjectsDirectory(std::string Path)
Set the path to a directory where to save generated object files.
void setTargetOptions(TargetOptions Options)
TargetMachine options.
void setOptLevel(unsigned NewOptLevel)
IR optimization level: from 0 to 3.
void setAttr(std::string MAttr)
Subtarget attributes.
void setFreestanding(bool Enabled)
Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on t...
void setSaveTempsDir(std::string Path)
Set the path to a directory where to save temporaries at various stages of the processing.
void setCodeGenOnly(bool CGOnly)
Perform CodeGen only: disable all other stages.
void setDebugPassManager(unsigned Enabled)
Enable or disable debug output for the new pass manager.
void setCodePICModel(std::optional< Reloc::Model > Model)
CodeModel.
void setCodeGenOptLevel(CodeGenOptLevel CGOptLevel)
CodeGen optimization level.
void optimize(Module &Module)
Perform post-importing ThinLTO optimizations.
std::unique_ptr< ModuleSummaryIndex > linkCombinedIndex()
Produce the combined summary index from all the bitcode files: "thin-link".
void crossModuleImport(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform cross-module importing for the module identified by ModuleIdentifier.
void emitImports(Module &Module, StringRef OutputName, ModuleSummaryIndex &Index, const lto::InputFile &File)
Compute and emit the imported files for module at ModulePath.
void internalize(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform internalization.
void gatherImportedSummariesForModule(Module &Module, ModuleSummaryIndex &Index, ModuleToSummariesForIndexTy &ModuleToSummariesForIndex, GVSummaryPtrSet &DecSummaries, const lto::InputFile &File)
Compute the list of summaries and the subset of declaration summaries needed for importing into modul...
void promote(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform promotion and renaming of exported internal functions, and additionally resolve weak and link...
std::string writeGeneratedObject(int count, StringRef CacheEntryPath, const MemoryBuffer &OutputBuffer)
Write temporary object file to SavedObjectDirectoryPath, write symlink to Cache directory if needed.
This is an optimization pass for GlobalISel generic memory operations.
CodeGenOptLevel
Code generation optimization level.
std::unordered_set< GlobalValueSummary * > GVSummaryPtrSet
A set of global value summary pointers.
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
std::map< std::string, GVSummaryMapTy, std::less<> > ModuleToSummariesForIndexTy
Map of a module name to the GUIDs and summaries we will import from that module.
Policy for the pruneCache() function.
uint64_t MaxSizeFiles
The maximum number of files in the cache directory.
std::optional< std::chrono::seconds > Interval
The pruning interval.
std::chrono::seconds Expiration
The expiration for a file.
uint64_t MaxSizeBytes
The maximum size for the cache directory in bytes.
unsigned MaxSizePercentageOfAvailableSpace
The maximum size for the cache directory, in terms of percentage of the available space on the disk.
Helper to gather options relevant to the target machine creation.
std::unique_ptr< TargetMachine > create() const
std::optional< Reloc::Model > RelocModel
CodeGenOptLevel CGOptLevel
CachePruningPolicy Policy