struct Config

Declaration

struct Config { /* full declaration omitted */ };

Description

LTO configuration. A linker can configure LTO by setting fields in this data structure and passing it to the lto::LTO constructor.

Declared at: llvm/include/llvm/LTO/Config.h:40

Member Variables

public std::string CPU
public llvm::TargetOptions Options
public std::vector<std::string> MAttrs
public std::vector<std::string> PassPlugins
public std::function<void(legacy::PassManager&)> PreCodeGenPassesHook
For adding passes that run right before codegen.
public Optional<Reloc::Model> RelocModel = Reloc::PIC_
public Optional<CodeModel::Model> CodeModel = None
public CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default
public llvm::CodeGenFileType CGFileType = CGFT_ObjectFile
public unsigned int OptLevel = 2
public bool DisableVerify = false
public bool UseDefaultPipeline = false
Use the standard optimization pipeline.
public bool Freestanding = false
Flag to indicate that the optimizer should not assume builtins are present on the target.
public bool CodeGenOnly = false
Disable entirely the optimizer, including importing for ThinLTO
public bool RunCSIRInstr = false
Run PGO context sensitive IR instrumentation.
public bool PGOWarnMismatch = true
Turn on/off the warning about a hash mismatch in the PGO profile data.
public bool HasWholeProgramVisibility = false
Asserts whether we can assume whole program visibility during the LTO link.
public bool AlwaysEmitRegularLTOObj = false
Always emit a Regular LTO object even when it is empty because no Regular LTO modules were linked. This option is useful for some build system which want to know a priori all possible output files.
public llvm::lto::Config::VisScheme VisibilityScheme = FromPrevailing
Allows non-imported definitions to get the potentially more constraining visibility from the prevailing definition. FromPrevailing is the default because it works for many binary formats. ELF can use the more optimized 'ELF' scheme.
public std::string OptPipeline
If this field is set, the set of passes run in the middle-end optimizer will be the one specified by the string. Only works with the new pass manager as the old one doesn't have this ability.
public std::string AAPipeline
public std::string OverrideTriple
Setting this field will replace target triples in input files with this triple.
public std::string DefaultTriple
Setting this field will replace unspecified target triples in input files with this triple.
public std::string CSIRProfile
Context Sensitive PGO profile path.
public std::string SampleProfile
Sample PGO profile path.
public std::string ProfileRemapping
Name remapping file for profile data.
public std::string DwoDir
The directory to store .dwo files.
public std::string SplitDwarfFile
The name for the split debug info file used for the DW_AT_[GNU_]dwo_name attribute in the skeleton CU. This should generally only be used when running an individual backend directly via thinBackend(), as otherwise all objects would use the same .dwo file. Not used as output path.
public std::string SplitDwarfOutput
The path to write a .dwo file to. This should generally only be used when running an individual backend directly via thinBackend(), as otherwise all .dwo files will be written to the same path. Not used in skeleton CU.
public std::string RemarksFilename
Optimization remarks file path.
public std::string RemarksPasses
Optimization remarks pass filter.
public bool RemarksWithHotness = false
Whether to emit optimization remarks with hotness informations.
public llvm::Optional<uint64_t> RemarksHotnessThreshold = 0
If threshold option is not specified, it is disabled by default.
public std::string RemarksFormat
The format used for serializing remarks (default: YAML).
public bool DebugPassManager = false
Whether to emit the pass manager debuggging informations.
public std::string StatsFile
Statistics output file path.
public std::vector<std::string> ThinLTOModulesToCompile
Specific thinLTO modules to compile.
public bool TimeTraceEnabled = false
Time trace enabled.
public unsigned int TimeTraceGranularity = 500
Time trace granularity.
public bool ShouldDiscardValueNames = true
public llvm::DiagnosticHandlerFunction DiagHandler
public bool AddFSDiscriminator = false
Add FSAFDO discriminators.
public bool OpaquePointers = true
Use opaque pointer types. Used to call LLVMContext::setOpaquePointers unless already set by the `-opaque-pointers` commandline option.
public std::unique_ptr<raw_ostream> ResolutionFile
If this field is set, LTO will write input file paths and symbol resolutions here in llvm-lto2 command line flag format. This can be used for testing and for running the LTO pipeline outside of the linker with llvm-lto2.
public llvm::PipelineTuningOptions PTO
Tunable parameters for passes in the default pipelines.
public llvm::lto::Config::ModuleHookFn PreOptModuleHook
This module hook is called after linking (regular LTO) or loading (ThinLTO) the module, before modifying it.
public llvm::lto::Config::ModuleHookFn PostPromoteModuleHook
This hook is called after promoting any internal functions (ThinLTO-specific).
public llvm::lto::Config::ModuleHookFn PostInternalizeModuleHook
This hook is called after internalizing the module.
public llvm::lto::Config::ModuleHookFn PostImportModuleHook
This hook is called after importing from other modules (ThinLTO-specific).
public llvm::lto::Config::ModuleHookFn PostOptModuleHook
This module hook is called after optimization is complete.
public llvm::lto::Config::ModuleHookFn PreCodeGenModuleHook
This module hook is called before code generation. It is similar to the PostOptModuleHook, but for parallel code generation it is called after splitting the module.
public llvm::lto::Config::CombinedIndexHookFn CombinedIndexHook

Method Overview

  • public llvm::Error addSaveTemps(std::string OutputFileName, bool UseInputModulePath = false, const DenseSet<llvm::StringRef> & SaveTempsArgs = {})

Methods

ΒΆllvm::Error addSaveTemps(
    std::string OutputFileName,
    bool UseInputModulePath = false,
    const DenseSet<llvm::StringRef>&
        SaveTempsArgs = {})

Description

This is a convenience function that configures this Config object to write temporary files named after the given OutputFileName for each of the LTO phases to disk. A client can use this function to implement -save-temps. FIXME: Temporary files derived from ThinLTO backends are currently named after the input file name, rather than the output file name, when UseInputModulePath is set to true. Specifically, it (1) sets each of the above module hooks and the combined index hook to a function that calls the hook function (if any) that was present in the appropriate field when the addSaveTemps function was called, and writes the module to a bitcode file with a name prefixed by the given output file name, and (2) creates a resolution file whose name is prefixed by the given output file name and sets ResolutionFile to its file handle. SaveTempsArgs can be specified to select which temps to save. If SaveTempsArgs is not provided, all temps are saved.

Declared at: llvm/include/llvm/LTO/Config.h:273

Parameters

std::string OutputFileName
bool UseInputModulePath = false
const DenseSet<llvm::StringRef>& SaveTempsArgs = {}