class ThinLTOCodeGenerator

Declaration

class ThinLTOCodeGenerator { /* full declaration omitted */ };

Description

This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing. The ThinLTOCodeGenerator is not intended to be reuse for multiple compilation: the model is that the client adds modules to the generator and ask to perform the ThinLTO optimizations / codegen, and finally destroys the codegenerator.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:53

Method Overview

Methods

void addModule(llvm::StringRef Identifier,
               llvm::StringRef Data)

Description

Add given module to the code generator.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:56

Parameters

llvm::StringRef Identifier
llvm::StringRef Data

void crossModuleImport(
    llvm::Module& Module,
    llvm::ModuleSummaryIndex& Index,
    const lto::InputFile& File)

Description

Perform cross-module importing for the module identified by ModuleIdentifier.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:268

Parameters

llvm::Module& Module
llvm::ModuleSummaryIndex& Index
const lto::InputFile& File

void crossReferenceSymbol(llvm::StringRef Name)

Description

Adds to a list of all global symbols that are cross-referenced between ThinLTO files. If the ThinLTO CodeGenerator can ensure that every references from a ThinLTO module to this symbol is optimized away, then the symbol can be discarded.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:71

Parameters

llvm::StringRef Name

void disableCodeGen(bool Disable)

Description

Disable CodeGen, only run the stages till codegen and stop. The output will be bitcode.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:231

Parameters

bool Disable

void emitImports(llvm::Module& Module,
                 llvm::StringRef OutputName,
                 llvm::ModuleSummaryIndex& Index,
                 const lto::InputFile& File)

Description

Compute and emit the imported files for module at \p ModulePath.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:260

Parameters

llvm::Module& Module
llvm::StringRef OutputName
llvm::ModuleSummaryIndex& Index
const lto::InputFile& File

void gatherImportedSummariesForModule(
    llvm::Module& Module,
    llvm::ModuleSummaryIndex& Index,
    std::map<std::string, GVSummaryMapTy>&
        ModuleToSummariesForIndex,
    const lto::InputFile& File)

Description

Compute the list of summaries needed for importing into module.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:274

Parameters

llvm::Module& Module
llvm::ModuleSummaryIndex& Index
std::map<std::string, GVSummaryMapTy>& ModuleToSummariesForIndex
const lto::InputFile& File

std::vector<std::unique_ptr<MemoryBuffer>>&
getProducedBinaries()

Description

Return the "in memory" binaries produced by the code generator. This is filled after run() unless setGeneratedObjectsDirectory() has been called, in which case results are available through getProducedBinaryFiles().

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:88

std::vector<std::string>& getProducedBinaryFiles()

Description

Return the "on-disk" binaries produced by the code generator. This is filled after run() when setGeneratedObjectsDirectory() has been called, in which case results are available through getProducedBinaries().

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:97

void internalize(llvm::Module& Module,
                 llvm::ModuleSummaryIndex& Index,
                 const lto::InputFile& File)

Description

Perform internalization. Index is updated to reflect linkage changes.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:282

Parameters

llvm::Module& Module
llvm::ModuleSummaryIndex& Index
const lto::InputFile& File

std::unique_ptr<ModuleSummaryIndex>
linkCombinedIndex()

Description

Produce the combined summary index from all the bitcode files: "thin-link".

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:247

void optimize(llvm::Module& Module)

Description

Perform post-importing ThinLTO optimizations.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:288

Parameters

llvm::Module& Module

void preserveSymbol(llvm::StringRef Name)

Description

Adds to a list of all global symbols that must exist in the final generated code. If a symbol is not listed there, it will be optimized away if it is inlined into every usage.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:63

Parameters

llvm::StringRef Name

void promote(llvm::Module& Module,
             llvm::ModuleSummaryIndex& Index,
             const lto::InputFile& File)

Description

Perform promotion and renaming of exported internal functions, and additionally resolve weak and linkonce symbols. Index is updated to reflect linkage changes from weak resolution.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:254

Parameters

llvm::Module& Module
llvm::ModuleSummaryIndex& Index
const lto::InputFile& File

void run()

Description

Process all the modules that were added to the code generator in parallel. Client can access the resulting object files using getProducedBinaries(), unless setGeneratedObjectsDirectory() has been called, in which case results are available through getProducedBinaryFiles().

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:80

void setAttr(std::string MAttr)

Description

Subtarget attributes

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:203

Parameters

std::string MAttr

void setCacheDir(std::string Path)

Description

Provide a path to a directory where to store the cached files for incremental build.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:133

Parameters

std::string Path

void setCacheEntryExpiration(
    unsigned int Expiration)

Description

Cache policy: expiration (in seconds) for an entry. A value of 0 will be ignored.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:147

Parameters

unsigned int Expiration

void setCacheMaxSizeBytes(uint64_t MaxSizeBytes)

Description

Cache policy: the maximum size for the cache directory in bytes. A value over the amount of available space on the disk will be reduced to the amount of available space. A value of 0 will be ignored.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:173

Parameters

uint64_t MaxSizeBytes

void setCacheMaxSizeFiles(
    unsigned int MaxSizeFiles)

Description

Cache policy: the maximum number of files in the cache directory. A value of 0 will be ignored.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:180

Parameters

unsigned int MaxSizeFiles

void setCachePruningInterval(int Interval)

Description

Cache policy: interval (seconds) between two prunes of the cache. Set to a negative value to disable pruning. A value of 0 will force pruning to occur.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:138

Parameters

int Interval

void setCodeGenOnly(bool CGOnly)

Description

Perform CodeGen only: disable all other stages.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:234

Parameters

bool CGOnly

void setCodeGenOptLevel(
    CodeGenOpt::Level CGOptLevel)

Description

CodeGen optimization level

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:220

Parameters

CodeGenOpt::Level CGOptLevel

void setCodePICModel(Optional<Reloc::Model> Model)

Description

CodeModel

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:215

Parameters

Optional<Reloc::Model> Model

void setCpu(std::string Cpu)

Description

CPU to use to initialize the TargetMachine

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:200

Parameters

std::string Cpu

void setFreestanding(bool Enabled)

Description

Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on the target.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:212

Parameters

bool Enabled

void setGeneratedObjectsDirectory(
    std::string Path)

Description

Set the path to a directory where to save generated object files. This path can be used by a linker to request on-disk files instead of in-memory buffers. When set, results are available through getProducedBinaryFiles() instead of getProducedBinaries().

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:195

Parameters

std::string Path

void setMaxCacheSizeRelativeToAvailableSpace(
    unsigned int Percentage)

Description

Sets the maximum cache size that can be persistent across build, in terms of percentage of the available space on the disk. Set to 100 to indicate no limit, 50 to indicate that the cache size will not be left over half the available space. A value over 100 will be reduced to 100, and a value of 0 will be ignored. The formula looks like: AvailableSpace = FreeSpace + ExistingCacheSize NewCacheSize = AvailableSpace * P/100

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:165

Parameters

unsigned int Percentage

void setOptLevel(unsigned int NewOptLevel)

Description

IR optimization level: from 0 to 3.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:225

Parameters

unsigned int NewOptLevel

void setSaveTempsDir(std::string Path)

Description

Set the path to a directory where to save temporaries at various stages of the processing.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:189

Parameters

std::string Path

void setTargetOptions(llvm::TargetOptions Options)

Description

TargetMachine options

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:206

Parameters

llvm::TargetOptions Options

std::string writeGeneratedObject(
    int count,
    llvm::StringRef CacheEntryPath,
    const llvm::MemoryBuffer& OutputBuffer)

Description

Write temporary object file to SavedObjectDirectoryPath, write symlink to Cache directory if needed. Returns the path to the generated file in SavedObjectsDirectoryPath.

Declared at: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:295

Parameters

int count
llvm::StringRef CacheEntryPath
const llvm::MemoryBuffer& OutputBuffer