Go to the documentation of this file.
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);
225 OptLevel = (NewOptLevel > 3) ? 3 : NewOptLevel;
278 std::map<std::string, GVSummaryMapTy> &ModuleToSummariesForIndex,
307 std::vector<std::unique_ptr<MemoryBuffer>> ProducedBinaries;
310 std::vector<std::string> ProducedBinaryFiles;
314 std::vector<std::unique_ptr<lto::InputFile>> Modules;
324 CachingOptions CacheOptions;
327 std::string SaveTempsDir;
330 std::string SavedObjectsDirectoryPath;
334 bool DisableCodeGen =
false;
338 bool CodeGenOnly =
false;
342 bool Freestanding =
false;
345 unsigned OptLevel = 3;
349 bool DebugPassManager =
false;
void promote(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform promotion and renaming of exported internal functions, and additionally resolve weak and link...
CodeGenOpt::Level CGOptLevel
void setCodeGenOnly(bool CGOnly)
Perform CodeGen only: disable all other stages.
This is an optimization pass for GlobalISel generic memory operations.
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.
std::string writeGeneratedObject(int count, StringRef CacheEntryPath, const MemoryBuffer &OutputBuffer)
Write temporary object file to SavedObjectDirectoryPath, write symlink to Cache directory if needed.
void setMaxCacheSizeRelativeToAvailableSpace(unsigned Percentage)
Sets the maximum cache size that can be persistent across build, in terms of percentage of the availa...
void setSaveTempsDir(std::string Path)
Set the path to a directory where to save temporaries at various stages of the processing.
This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing.
Helper to gather options relevant to the target machine creation.
Triple - Helper class for working with autoconf configuration names.
CachePruningPolicy Policy
void crossModuleImport(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform cross-module importing for the module identified by ModuleIdentifier.
void emitImports(Module &Module, StringRef OutputName, ModuleSummaryIndex &Index, const lto::InputFile &File)
Compute and emit the imported files for module at ModulePath.
void setCacheEntryExpiration(unsigned Expiration)
Cache policy: expiration (in seconds) for an entry.
void setCacheMaxSizeBytes(uint64_t MaxSizeBytes)
Cache policy: the maximum size for the cache directory in bytes.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
void setCacheMaxSizeFiles(unsigned MaxSizeFiles)
Cache policy: the maximum number of files in the cache directory.
uint64_t MaxSizeBytes
The maximum size for the cache directory in bytes.
void internalize(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)
Perform internalization.
void setFreestanding(bool Enabled)
Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on t...
std::chrono::seconds Expiration
The expiration for a file.
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
std::vector< std::unique_ptr< MemoryBuffer > > & getProducedBinaries()
Return the "in memory" binaries produced by the code generator.
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 setCpu(std::string Cpu)
CPU to use to initialize the TargetMachine.
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...
Interval Class - An Interval is a set of nodes defined such that every node in the interval has all o...
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
void setGeneratedObjectsDirectory(std::string Path)
Set the path to a directory where to save generated object files.
void setAttr(std::string MAttr)
Subtarget attributes.
void setCodeGenOptLevel(CodeGenOpt::Level CGOptLevel)
CodeGen optimization level.
void gatherImportedSummariesForModule(Module &Module, ModuleSummaryIndex &Index, std::map< std::string, GVSummaryMapTy > &ModuleToSummariesForIndex, const lto::InputFile &File)
Compute the list of summaries needed for importing into module.
A Module instance is used to store all the information related to an LLVM module.
void setTargetOptions(TargetOptions Options)
TargetMachine options.
StringSet - A wrapper for StringMap that provides set-like functionality.
StringRef - Represent a constant reference to a string, i.e.
unsigned MaxSizePercentageOfAvailableSpace
The maximum size for the cache directory, in terms of percentage of the available space on the disk.
std::unique_ptr< ModuleSummaryIndex > linkCombinedIndex()
Produce the combined summary index from all the bitcode files: "thin-link".
void addModule(StringRef Identifier, StringRef Data)
Add given module to the code generator.
void setCachePruningInterval(int Interval)
Cache policy: interval (seconds) between two prunes of the cache.
Policy for the pruneCache() function.
void disableCodeGen(bool Disable)
Disable CodeGen, only run the stages till codegen and stop.
uint64_t MaxSizeFiles
The maximum number of files in the cache directory.
void optimize(Module &Module)
Perform post-importing ThinLTO optimizations.
llvm::Optional< std::chrono::seconds > Interval
The pruning interval.
std::unique_ptr< TargetMachine > create() const
void setCodePICModel(Optional< Reloc::Model > Model)
CodeModel.
void setDebugPassManager(unsigned Enabled)
Enable or disable debug output for the new pass manager.
Optional< Reloc::Model > RelocModel
void setCacheDir(std::string Path)
Provide a path to a directory where to store the cached files for incremental build.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
void setOptLevel(unsigned NewOptLevel)
IR optimization level: from 0 to 3.