16 #ifndef LLVM_LTO_THINLTOCODEGENERATOR_H 17 #define LLVM_LTO_THINLTOCODEGENERATOR_H 37 std::string OwnedIdentifier;
42 : OwnedIdentifier(Identifier), Buffer(Buffer) {}
46 {OwnedIdentifier.c_str(), OwnedIdentifier.
size()});
61 std::unique_ptr<TargetMachine> create()
const;
88 void crossReferenceSymbol(
StringRef Name);
106 return ProducedBinaries;
115 return ProducedBinaryFiles;
150 void setCacheDir(std::string Path) { CacheOptions.Path = std::move(Path); }
157 CacheOptions.Policy.Interval.reset();
159 CacheOptions.Policy.Interval = std::chrono::seconds(Interval);
166 CacheOptions.Policy.Expiration = std::chrono::seconds(Expiration);
184 CacheOptions.Policy.MaxSizePercentageOfAvailableSpace = Percentage;
192 CacheOptions.Policy.MaxSizeBytes = MaxSizeBytes;
199 CacheOptions.Policy.MaxSizeFiles = MaxSizeFiles;
213 SavedObjectsDirectoryPath = std::move(Path);
217 void setCpu(std::string Cpu) { TMBuilder.MCpu = std::move(Cpu); }
220 void setAttr(std::string MAttr) { TMBuilder.MAttr = std::move(MAttr); }
224 TMBuilder.Options = std::move(Options);
233 TMBuilder.RelocModel =
Model;
238 TMBuilder.CGOptLevel = CGOptLevel;
243 OptLevel = (NewOptLevel > 3) ? 3 : NewOptLevel;
264 std::unique_ptr<ModuleSummaryIndex> linkCombinedIndex();
276 void emitImports(Module &Module,
StringRef OutputName,
290 std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex);
300 void optimize(Module &Module);
310 std::vector<std::unique_ptr<MemoryBuffer>> ProducedBinaries;
313 std::vector<std::string> ProducedBinaryFiles;
317 std::vector<ThinLTOBuffer> Modules;
330 std::string SaveTempsDir;
333 std::string SavedObjectsDirectoryPath;
337 bool DisableCodeGen =
false;
341 bool CodeGenOnly =
false;
345 bool Freestanding =
false;
348 unsigned OptLevel = 3;
void setCacheDir(std::string Path)
Provide a path to a directory where to store the cached files for incremental build.
void setCodePICModel(Optional< Reloc::Model > Model)
CodeModel.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
Interval Class - An Interval is a set of nodes defined such that every node in the interval has all o...
void setGeneratedObjectsDirectory(std::string Path)
Set the path to a directory where to save generated object files.
void setCpu(std::string Cpu)
CPU to use to initialize the TargetMachine.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
void setCodeGenOnly(bool CGOnly)
Perform CodeGen only: disable all other stages.
void setCodeGenOptLevel(CodeGenOpt::Level CGOptLevel)
CodeGen optimization level.
void setCacheMaxSizeFiles(unsigned MaxSizeFiles)
Cache policy: the maximum number of files in the cache directory.
Wrapper around MemoryBufferRef, owning the identifier.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
StringRef getBuffer() const
This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing...
void setSaveTempsDir(std::string Path)
Set the path to a directory where to save temporaries at various stages of the processing.
void disableCodeGen(bool Disable)
Disable CodeGen, only run the stages till codegen and stop.
void setTargetOptions(TargetOptions Options)
TargetMachine options.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
void setAttr(std::string MAttr)
Subtarget attributes.
void gatherImportedSummariesForModule(StringRef ModulePath, const StringMap< GVSummaryMapTy > &ModuleToDefinedGVSummaries, const FunctionImporter::ImportMapTy &ImportList, std::map< std::string, GVSummaryMapTy > &ModuleToSummariesForIndex)
Compute the set of summaries needed for a ThinLTO backend compilation of ModulePath.
Helper to gather options relevant to the target machine creation.
void setCachePruningInterval(int Interval)
Cache policy: interval (seconds) between two prunes of the cache.
std::vector< std::unique_ptr< MemoryBuffer > > & getProducedBinaries()
Return the "in memory" binaries produced by the code generator.
void setFreestanding(bool Enabled)
Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on t...
StringRef getBufferIdentifier() const
void setOptLevel(unsigned NewOptLevel)
IR optimization level: from 0 to 3.
void setCacheMaxSizeBytes(uint64_t MaxSizeBytes)
Cache policy: the maximum size for the cache directory in bytes.
Triple - Helper class for working with autoconf configuration names.
Policy for the pruneCache() function.
void setMaxCacheSizeRelativeToAvailableSpace(unsigned Percentage)
Sets the maximum cache size that can be persistent across build, in terms of percentage of the availa...
MemoryBufferRef getMemBuffer() const
std::vector< std::string > & getProducedBinaryFiles()
Return the "on-disk" binaries produced by the code generator.
Optional< Reloc::Model > RelocModel
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
void setCacheEntryExpiration(unsigned Expiration)
Cache policy: expiration (in seconds) for an entry.
StringSet - A wrapper for StringMap that provides set-like functionality.
CachePruningPolicy Policy
ThinLTOBuffer(StringRef Buffer, StringRef Identifier)
StringRef - Represent a constant reference to a string, i.e.