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;
106 return ProducedBinaries;
115 return ProducedBinaryFiles;
194 SavedObjectsDirectoryPath = std::move(Path);
198 void setCpu(std::string Cpu) { TMBuilder.
MCpu = std::move(Cpu); }
201 void setAttr(std::string MAttr) { TMBuilder.
MAttr = std::move(MAttr); }
205 TMBuilder.
Options = std::move(Options);
224 OptLevel = (NewOptLevel > 3) ? 3 : NewOptLevel;
271 std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex);
296 std::vector<std::unique_ptr<MemoryBuffer>> ProducedBinaries;
299 std::vector<std::string> ProducedBinaryFiles;
303 std::vector<ThinLTOBuffer> Modules;
313 CachingOptions CacheOptions;
316 std::string SaveTempsDir;
319 std::string SavedObjectsDirectoryPath;
323 bool DisableCodeGen =
false;
327 bool CodeGenOnly =
false;
331 bool Freestanding =
false;
334 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.
CodeGenOpt::Level CGOptLevel
void promote(Module &Module, ModuleSummaryIndex &Index)
Perform promotion and renaming of exported internal functions, and additionally resolve weak and link...
StringRef getBufferIdentifier() const
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.
std::unique_ptr< TargetMachine > create() const
std::chrono::seconds Expiration
The expiration for a file.
std::chrono::seconds Interval
The pruning interval.
void addModule(StringRef Identifier, StringRef Data)
Add given module to the code generator.
void setCodeGenOnly(bool CGOnly)
Perform CodeGen only: disable all other stages.
void setCodeGenOptLevel(CodeGenOpt::Level CGOptLevel)
CodeGen optimization level.
Wrapper around MemoryBufferRef, owning the identifier.
std::unique_ptr< MemoryBuffer > codegen(Module &Module)
Perform ThinLTO CodeGen.
This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing...
MemoryBufferRef getMemBuffer() const
void run()
Process all the modules that were added to the code generator in parallel.
void setSaveTempsDir(std::string Path)
Set the path to a directory where to save temporaries at various stages of the processing.
unsigned MaxSizePercentageOfAvailableSpace
The maximum size for the cache directory, in terms of percentage of the available space on the the di...
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 crossReferenceSymbol(StringRef Name)
Adds to a list of all global symbols that are cross-referenced between ThinLTO files.
void optimize(Module &Module)
Perform post-importing ThinLTO optimizations.
Helper to gather options relevant to the target machine creation.
void setCachePruningInterval(int Interval)
Cache policy: interval (seconds) between two prune 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...
void setOptLevel(unsigned NewOptLevel)
IR optimization level: from 0 to 3.
Triple - Helper class for working with autoconf configuration names.
StringRef getBuffer() const
std::unique_ptr< ModuleSummaryIndex > linkCombinedIndex()
Produce the combined summary index from all the bitcode files: "thin-link".
static void gatherImportedSummariesForModule(StringRef ModulePath, ModuleSummaryIndex &Index, std::map< std::string, GVSummaryMapTy > &ModuleToSummariesForIndex)
Compute the list of summaries needed for importing into module.
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...
std::vector< std::string > & getProducedBinaryFiles()
Return the "on-disk" binaries produced by the code generator.
void preserveSymbol(StringRef Name)
Adds to a list of all global symbols that must exist in the final generated code. ...
void crossModuleImport(Module &Module, ModuleSummaryIndex &Index)
Perform cross-module importing for the module identified by ModuleIdentifier.
Optional< Reloc::Model > RelocModel
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
void internalize(Module &Module, ModuleSummaryIndex &Index)
Perform internalization.
void setCacheEntryExpiration(unsigned Expiration)
Cache policy: expiration (in seconds) for an entry.
StringSet - A wrapper for StringMap that provides set-like functionality.
CachePruningPolicy Policy
static void emitImports(StringRef ModulePath, StringRef OutputName, ModuleSummaryIndex &Index)
Compute and emit the imported files for module at ModulePath.
ThinLTOBuffer(StringRef Buffer, StringRef Identifier)
StringRef - Represent a constant reference to a string, i.e.