16 #ifndef LLVM_LTO_THINLTOCODEGENERATOR_H
17 #define LLVM_LTO_THINLTOCODEGENERATOR_H
36 std::string OwnedIdentifier;
41 : OwnedIdentifier(Identifier), Buffer(Buffer) {}
45 {OwnedIdentifier.c_str(), OwnedIdentifier.size()});
60 std::unique_ptr<TargetMachine>
create()
const;
105 return ProducedBinaries;
114 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); }
206 TMBuilder.
Options = std::move(Options);
221 OptLevel = (NewOptLevel > 3) ? 3 : NewOptLevel;
268 std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex);
293 std::vector<std::unique_ptr<MemoryBuffer>> ProducedBinaries;
296 std::vector<std::string> ProducedBinaryFiles;
300 std::vector<ThinLTOBuffer> Modules;
310 CachingOptions CacheOptions;
313 std::string SaveTempsDir;
316 std::string SavedObjectsDirectoryPath;
320 bool DisableCodeGen =
false;
324 bool CodeGenOnly =
false;
327 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
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.
unsigned MaxPercentageOfAvailableSpace
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.
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 setOptLevel(unsigned NewOptLevel)
IR optimization level: from 0 to 3.
Triple - Helper class for working with autoconf configuration names.
std::pair< uint32_t, uint32_t > Interval
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.
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.
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.