15#ifndef LLVM_LTO_LEGACY_THINLTOCODEGENERATOR_H
16#define LLVM_LTO_LEGACY_THINLTOCODEGENERATOR_H
96 return ProducedBinaries;
105 return ProducedBinaryFiles;
140 void setCacheDir(std::string Path) { CacheOptions.Path = std::move(Path); }
147 CacheOptions.Policy.Interval.reset();
149 CacheOptions.Policy.Interval = std::chrono::seconds(
Interval);
156 CacheOptions.Policy.Expiration = std::chrono::seconds(Expiration);
174 CacheOptions.Policy.MaxSizePercentageOfAvailableSpace = Percentage;
182 CacheOptions.Policy.MaxSizeBytes = MaxSizeBytes;
189 CacheOptions.Policy.MaxSizeFiles = MaxSizeFiles;
203 SavedObjectsDirectoryPath = std::move(Path);
207 void setCpu(std::string Cpu) { TMBuilder.MCpu = std::move(Cpu); }
210 void setAttr(std::string MAttr) { TMBuilder.MAttr = std::move(MAttr); }
214 TMBuilder.Options = std::move(
Options);
223 TMBuilder.RelocModel = Model;
228 TMBuilder.CGOptLevel = CGOptLevel;
233 OptLevel = (NewOptLevel > 3) ? 3 : NewOptLevel;
316 std::vector<std::unique_ptr<MemoryBuffer>> ProducedBinaries;
319 std::vector<std::string> ProducedBinaryFiles;
323 std::vector<std::unique_ptr<lto::InputFile>> Modules;
333 CachingOptions CacheOptions;
336 std::string SaveTempsDir;
339 std::string SavedObjectsDirectoryPath;
343 bool DisableCodeGen =
false;
347 bool CodeGenOnly =
false;
351 bool Freestanding =
false;
354 unsigned OptLevel = 3;
358 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.
Primary interface to the complete machine description for the target machine.
This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing.
LLVM_ABI 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.
LLVM_ABI void run()
Process all the modules that were added to the code generator in parallel.
LLVM_ABI void crossReferenceSymbol(StringRef Name)
Adds to a list of all global symbols that are cross-referenced between ThinLTO files.
LLVM_ABI 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.
LLVM_ABI void optimize(Module &Module)
Perform post-importing ThinLTO optimizations.
LLVM_ABI std::unique_ptr< ModuleSummaryIndex > linkCombinedIndex()
Produce the combined summary index from all the bitcode files: "thin-link".
LLVM_ABI void crossModuleImport(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform cross-module importing for the module identified by ModuleIdentifier.
LLVM_ABI void emitImports(Module &Module, StringRef OutputName, ModuleSummaryIndex &Index, const lto::InputFile &File)
Compute and emit the imported files for module at ModulePath.
LLVM_ABI void internalize(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform internalization.
LLVM_ABI 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...
LLVM_ABI void promote(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform promotion and renaming of exported internal functions, and additionally resolve weak and link...
LLVM_ABI std::string writeGeneratedObject(int count, StringRef CacheEntryPath, const MemoryBuffer &OutputBuffer)
Write temporary object file to SavedObjectDirectoryPath, write symlink to Cache directory if needed.
ThinLTOCodeGeneratorImpl - Namespace used for ThinLTOCodeGenerator implementation details.
This is an optimization pass for GlobalISel generic memory operations.
std::unordered_set< GlobalValueSummary * > GVSummaryPtrSet
A set of global value summary pointers.
std::map< std::string, GVSummaryMapTy, std::less<> > ModuleToSummariesForIndexTy
Map of a module name to the GUIDs and summaries we will import from that module.
CodeGenOptLevel
Code generation optimization level.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
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.
Helper to gather options relevant to the target machine creation.
LLVM_ABI std::unique_ptr< TargetMachine > create() const
std::optional< Reloc::Model > RelocModel
CodeGenOptLevel CGOptLevel
CachePruningPolicy Policy