15#ifndef LLVM_LTO_LEGACY_THINLTOCODEGENERATOR_H
16#define LLVM_LTO_LEGACY_THINLTOCODEGENERATOR_H
43 std::unique_ptr<TargetMachine>
create()
const;
88 return ProducedBinaries;
97 return ProducedBinaryFiles;
195 SavedObjectsDirectoryPath = std::move(Path);
199 void setCpu(std::string Cpu) { TMBuilder.
MCpu = std::move(Cpu); }
202 void setAttr(std::string MAttr) { TMBuilder.
MAttr = std::move(MAttr); }
225 OptLevel = (NewOptLevel > 3) ? 3 : NewOptLevel;
279 std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex,
308 std::vector<std::unique_ptr<MemoryBuffer>> ProducedBinaries;
311 std::vector<std::string> ProducedBinaryFiles;
315 std::vector<std::unique_ptr<lto::InputFile>> Modules;
325 CachingOptions CacheOptions;
328 std::string SaveTempsDir;
331 std::string SavedObjectsDirectoryPath;
335 bool DisableCodeGen =
false;
339 bool CodeGenOnly =
false;
343 bool Freestanding =
false;
346 unsigned OptLevel = 3;
350 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 gatherImportedSummariesForModule(Module &Module, ModuleSummaryIndex &Index, std::map< std::string, GVSummaryMapTy > &ModuleToSummariesForIndex, GVSummaryPtrSet &DecSummaries, const lto::InputFile &File)
Compute the list of summaries and the subset of declaration summaries needed for importing into modul...
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 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...
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
CodeGenOptLevel CGOptLevel
std::optional< Reloc::Model > RelocModel
CachePruningPolicy Policy